Closed fluxionary closed 3 years ago
This probably has to do with the entity being removed while the behavior is still running. how are you calling lq_fallover, just regular from hq_die or some custom thing?
Anyway, the mobkit way would be to terminate the behavior if the entity is no longer around like this:
if not mobkit.exists(self) then return true end
@ElCeejo can you comment on TheTermos's question? I haven't dug through the paleotest code much yet.
I'm using a custom death function but it has multiple failsafes to avoid the entity being removed while any behaviors may be running. the area where hq_fallover is called is the same has the mobkit default death function.
Anyway, there's no point keeping a behavior running if the entity is no longer around, so can you please change it like below and report back whether the problem is gone?
function mobkit.lq_fallover(self)
local zrot = 0
local init = true
local func=function(self)
if not mobkit.exists(self) then return true end -- here
if init then
-- and so on ...
(not forgetting this; just been busy)
It's been a while so I assumed that your suggested solution of adding if not mobkit.exists(self) then return true end
worked, but the crash happened again so it appears that the issue has to do with something other than the entity being prematurely removed.
Can you provide a trace and maybe describe a way to reproduce this?
If get_rotation() returns nil while an entity is active it's probably the engine's fault. I want to avoid putting nil checks everywhere or the code is going to get really ugly.
Both of those were already done, I forgot to post an update here. The issue has been fixed already and you can feel free to close this now.
Ok. I'll be moving example behaviors to a separate file, they're meant to be modified anyways.
Caveats: I'm not entirely sure why
:get_rotation()
is sometimes returningnil
, but I'm not the only one to get a crash because it sometimes is. I'm suspecting it has to do w/ something w/ minetest 5.3.0+. I don't know enough about this mod to say if skipping the call toset_rotation()
won't have any important consequences, but my intuition says it won't.Example crash stacktrace: