Jump to content

Night Hand issues when entity is put to sleep


hoxi
  • Pending

Night Hands might not get removed if put to sleep as they're dissipating, due to depending on the animation finishing to do so.

Shouldn't these functions schedule a task for removal based on animation length (like how it's done in for a lot of entities), in case the entity goes to sleep?

local function Dissipate(inst)
    -- rest of the function

    inst.AnimState:PlayAnimation("hand_scare")
    inst:ListenForEvent("animover", inst.Remove)
end

local function DoConsumeFire(inst)
    -- rest of the function

    inst.AnimState:PlayAnimation("grab_pst")
    inst:ListenForEvent("animover", inst.Remove)
end

Namely something like:

inst:DoTaskInTime(inst.AnimState:GetCurrentAnimationLength() + FRAMES, inst.Remove)

---------------------------------------------------------------------------------------------------------------------

If a Night Hand goes to sleep, it will become stuck due to its locomotor component stopping. While this could be addressed so they resume movement, wouldn't it make more sense that, if there's no players within that much distance (for them to go asleep), the hands would just reach the fire? If so, something like this could be done maybe?

local function OnEntitySleep(inst)
	if not inst.dissipating and inst.fire then
		inst:RemoveEventCallback("onextinguish", inst.dissipatefn, inst.fire)
		inst:RemoveEventCallback("onremove", inst.dissipatefn, inst.fire)

		ACTIONS.EXTINGUISH.fn({target = inst.fire}) -- bit of a hack, but it's basically to avoid copying that function and pasting it here
		inst:Remove()
	end
end

If the first bug isn't addressed, it might need to be done like this instead:

local function OnEntitySleep(inst)
	if inst.dissipating then
		inst:Remove()
	elseif inst.fire then
		inst:RemoveEventCallback("onextinguish", inst.dissipatefn, inst.fire)
		inst:RemoveEventCallback("onremove", inst.dissipatefn, inst.fire)

		ACTIONS.EXTINGUISH.fn({target = inst.fire}) -- bit of a hack, but it's basically to avoid copying that function and pasting it here
		inst:Remove()
	end
end

 


Steps to Reproduce

The issue with dissipating can't really be checked outside of timing it so they go asleep as they start playing that animation, and checked with console commands that the hands haven't been removed, until they wake up again.

Regarding the second issue:

  1. Wait for Night Hands to spawn, make sure the fire is big in case 2 of them spawn.
  2. Walk into one, then immediately run away far enough, or use a wormhole nearby, or similar. To make them go sleep.
  3. Return to them and notice how they're stuck in place. At least until you walk up to them again.



User Feedback


There are no comments to display.



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...