blert2112 / mobs_water

9 stars 12 forks source link

Turtle crashes my server (5.0.0 dev) #5

Open wziard opened 5 years ago

wziard commented 5 years ago

2018-11-24 11:59:57: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'mobs_turtles' in callback luaentity_run_simple_callback(): /.minetest/mods/mobs_water/mobs_turtles/init.lua:54: attempt to call global 'set_velocity' (a nil value) 2018-11-24 11:59:57: ERROR[Main]: stack traceback: 2018-11-24 11:59:57: ERROR[Main]: .minetest/mods/mobs_water/mobs_turtles/init.lua:54: in function <.minetest/mods/mobs_water/mobs_turtles/init.lua:52>

SmallJoker commented 5 years ago

https://github.com/blert2112/mobs_water/blob/04474de70c333210e038368c4795363b8bb57282/mobs_turtles/init.lua#L54

Change to

self.object:set_velocity({x=0,y=0,z=0})
wziard commented 5 years ago

This seemed to help for a bit, but now the same crash is back (with this fix applied).

The fix doesn't match the error message btw. Because the error complains that set_velocity itself is a nil value, so no matter what params you pass it it'll crash.

SmallJoker commented 5 years ago

@wziard I tested the change locally and right-clicking the turtle works fine now. In this case you did not apply the change correctly or you're using a somewhat outdated Minetest version (< 0.4.16).

wziard commented 5 years ago

Oh, my bad. I made a mistake applying your fix. It seems to work now.

I'm still a bit confused, as the crash happens when nobody is right-clicking the turtle. It looks like it happend each time just after the last player disconnected.

But anyway, this indeed seems to fix it.

jubalh commented 5 years ago

Should this fix not rather be in the code here?

SmallJoker commented 5 years ago

@jubalh Good luck. blert2112 was last seen in 2016.