Jump to content

fns.startonenter in run_start of commonstates is called twice


Leonardo Cox
  • Pending

in stategraphs/commonstates.lua:

name = "run_start",
        tags = { "moving", "running", "canrotate" },

        onenter = function(inst)
			if fns ~= nil and fns.startonenter ~= nil then
				fns.startonenter(inst)
			end
			if not delaystart then
	            inst.components.locomotor:RunForward()
			end
            inst.AnimState:PlayAnimation(get_loco_anim(inst, anims ~= nil and anims.startrun or nil, "run_pre"))
			if fns ~= nil and fns.startonenter ~= nil then
				fns.startonenter(inst)
			end
        end,

fns.startonenter gets called twice for the run_start state (line 305 in my current build of DST). As far as I'm aware, none of the vanilla mobs make use of fns.startonenter, but it can causes issues to modded mobs that might use them. 


Steps to Reproduce

1. Have a mob have fns.startonenter for CommonStates.AddRunStates() in their stategraph.

2. Watch as it gets called twice.

3. Profit.




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