Jump to content

Recommended Posts

local assets ={	Asset("ANIM", "anim/r_shelter.zip"),}local function onhammered(inst, worker)	inst.components.lootdropper:DropLoot()	SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition())	inst.SoundEmitter:PlaySound("dontstarve/common/destroy_wood")	inst:Remove()endlocal function onhit(inst, worker)	 inst.AnimState:PlayAnimation("idle")	 inst.AnimState:PushAnimation("idle", true)endlocal function onbuilt(inst)	inst.components.resurrector.active = true        ProfileStatsSet("r_shelter_activated", true)	inst.AnimState:PlayAnimation("idle")	inst.AnimState:PushAnimation("idle", true)	inst.SoundEmitter:PlaySound("dontstarve/common/resurrectionstone_activate")	inst.components.resurrector:OnBuilt()endlocal function doresurrect(inst, dude)	inst:AddTag("busy")		inst.MiniMapEntity:SetEnabled(false)    if inst.Physics then		MakeInventoryPhysics(inst)    end    ProfileStatsSet("r_shelter_used", true)    GetClock():MakeNextDay()    dude.Transform:SetPosition(inst.Transform:GetWorldPosition())    dude:Hide()    TheCamera:SetDistance(12)	dude.components.hunger:Pause()    scheduler:ExecuteInTime(3, function()        dude:Show()        GetSeasonManager():DoLightningStrike(Vector3(inst.Transform:GetWorldPosition()))    	local smoke = SpawnPrefab("maxwell_smoke")    	local pos = inst:GetPosition()    		smoke.Transform:SetPosition(pos.x, pos.y, pos.z)    		smoke.Transform:SetScale(2,2,2)        if dude.components.hunger then            dude.components.hunger:SetPercent(1)        end        if dude.components.health then            dude.components.health:SetPercent(1)        end        if dude.components.sanity then	    dude.components.sanity:SetPercent(1)        end        dude.sg:GoToState("wakeup")        dude:DoTaskInTime(3, function(inst) 		            if dude.HUD then		                dude.HUD:Show()		            end		            TheCamera:SetDefault()		            inst:RemoveTag("busy")        end)            end)endlocal function makeused(inst)	-- inst:Remove()endlocal function fn(Sim)	local inst = CreateEntity()	local trans = inst.entity:AddTransform()	local anim = inst.entity:AddAnimState()	inst.entity:AddSoundEmitter()    anim:SetBank("r_shelter")    anim:SetBuild("r_shelter")    anim:PlayAnimation("idle", true)	local minimap = inst.entity:AddMiniMapEntity()	minimap:SetIcon( "r_shelter.tex" )    inst:AddTag("shelter")        inst:AddComponent("inspectable")     inst:AddComponent("lootdropper")    inst:AddComponent("workable")        inst.components.workable:SetWorkAction(ACTIONS.HAMMER)        inst.components.workable:SetWorkLeft(4)	inst.components.workable:SetOnFinishCallback(onhammered)	inst.components.workable:SetOnWorkCallback(onhit)	inst:AddComponent("resurrector")	inst.components.resurrector.doresurrect = doresurrect	inst:ListenForEvent( "onbuilt", onbuilt)	-- inst.components.resurrector.makeusedfn = makeused	inst.components.inspectable:RecordViews()    return instendreturn Prefab( "common/r_shelter", fn, assets),		MakePlacer( "common/r_shelter_placer", "r_shelter", "r_shelter", "idle" ) 

why i can resurrect only one times?

Link to comment
https://forums.kleientertainment.com/forums/topic/55202-resurrect/
Share on other sites

 

hi, thanks for your help.
I put "inst.components.resurrector:OnBuilt()" next "dude.sg:GoToState("wakeup")" but it not work.

 

 

of course not, you forgot the parameter:

 

inst.components.resurrector:OnBuilt(dude)

 

I previously placed "wilson" there, sorry if that confused you.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...