Don't Starve Together

Don't Starve Together

Personal Chesters
Muche 10 Dec, 2015 @ 6:10pm
Feature request
Regarding making personal chesters private, i.e. can be opened only by owner, following seems to work (relies on Ownership mod to enforce that):
--- modinfo.lua +++ modinfo.patch.lua @@ -28,4 +28,15 @@ server_filter_tags = { "personalchesters", } ---configuration_options = {} \ No newline at end of file +configuration_options = { + { + name = "ownership", + label = "Ownership Restriction?", + options = + { + {description = "Enable", data = true}, + {description = "Disable", data = false} + }, + default = false, + }, +} --- modmain.lua +++ modmain.patch.lua @@ -11,6 +11,8 @@ local STRINGS = GLOBAL.STRINGS STRINGS.NAMES.PERSONAL_CHESTER = "Personal Chester" STRINGS.NAMES.PERSONAL_CHESTER_EYEBONE = "Personal Eye Bone" +local ownership = GetModConfigData("ownership") + -- An eyebone is given every time player is spawned/loaded. It's not saved local function GiveEyebone(inst) local eyebone = GLOBAL.SpawnPrefab("personal_chester_eyebone") @@ -21,6 +23,7 @@ local function GiveEyebone(inst) inst.components.inventory:GiveItem(eyebone) inst.components.inventory.ignoresound = false eyebone.components.named:SetName(inst.name.."'s Eye Bone") + eyebone.ownership = ownership return eyebone end end @@ -151,6 +154,7 @@ local function PersonalChester(inst) end inst.eyebone.owner = inst + inst.eyebone.ownership = ownership if OnLoad_prev then --- scripts/prefabs/personal_chester_eyebone.lua +++ scripts/prefabs/personal_chester_eyebone.patch.lua @@ -7,6 +7,7 @@ local assets = } local SPAWN_DIST = 30 +local ownershiptag = 'uid_private' local function OpenEye(inst) inst.isOpenEye = true @@ -110,6 +111,10 @@ local function RebindChester(inst, chester) if chester ~= nil then if inst.owner then chester.components.named:SetName(inst.owner.name.."'s Chester") + if inst.ownership then + chester:AddTag(ownershiptag) + chester:AddTag("uid_" .. inst.owner.userid) + end end inst.AnimState:PlayAnimation("idle_loop", true) OpenEye(inst)

This solves only opening the chester (and looting him), it's still possible to grief by attacking him or taking the eyebone from the ground.
< >
Showing 1-4 of 4 comments
Dragon Wolf Leo  [developer] 13 Dec, 2015 @ 2:44am 
Added. Thanks.
Jack Ironhide 14 May, 2016 @ 4:53pm 
Hey you think you can add an option for Hutch too? He's the Fish Chester found in caves.
Serp 14 Aug, 2016 @ 7:04am 
Befriend spiders from webber will attack all personal chesters, including the one from webber.
Same if you wear the spiderhat.
I don't think this is intended?
pinkmollies 20 Jul, 2017 @ 8:27am 
are you able to make a craft option, instead of it spawning in the world with you
< >
Showing 1-4 of 4 comments
Per page: 1530 50