TombEngine
TombEngine copied to clipboard
Looping EventSet cannot be stopped
It seems even after trying to stop a looping EventSet, it keeps being active.
In this case, my LevelFuncs.LowerPlantHolder
function keeps being called even after I've called the :Stop()
method (I keep getting the printed text over and over in the console.
LevelFuncs.LowerPlantHolder = function()
-- ... some code to check if the PlantHolder object has reached the target position
if SomeCondition then
print("Target reached, stopping now")
ES_LowerPlantHolder:Stop() -- This keeps being called
end
end
local ES_LowerPlantHolder = EventSequence.Create(
"Plant_LowerPlantHolder",
true, -- does loop
false, -- timer format, not needed (only for debugging),
0, {LevelFuncs.LowerPlantHolder},
0, {LevelFuncs.FunctionCall, "Void"} -- trick to make the EventSequence loop (cf issue #940)
)
--- This is called once via a volume trigger in-game
LevelFuncs.SomeEvent = function()
ES_LowerPlantHolder:Start()
end
--- Calls a global function and passes it the argument (needed for EventSequence to call global funcs and not just LevelFuncs).
---
--- @param functionName string
--- @param arg any
LevelFuncs.FunctionCall = function(functionName, arg)
_G[functionName](arg)
end
function Void()
-- does literally nothing
end
It seems both internal timers (__TEN_evenSequence_{name}_timer1
and __TEN_evenSequence_{name}_timer1
) remain active even after calling ES:Stop()
.
I've tried pausing it with SetPaused(true)
instead of stopping it, and same result, the EventSequence remains active.