minetest-mods / xdecor

A decoration mod for Minetest meant to be light, simple and well-featured
Other
29 stars 46 forks source link

Crash when user tries to open iron door through pressureplate #98

Closed JakubVanek closed 6 years ago

JakubVanek commented 6 years ago

Hi,

I have found a small bug in the door opening code.

How to reproduce:

  1. place a iron/locked door as user1
  2. place a pressure plate from this mod as user2
  3. make user2 step on the pressure plate

This will trigger a crash. Stack trace shows this:

2018-09-15 16:57:44: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback node_on_timer(): ....minetest/games/minetest_game/mods/default/functions.lua:557: attempt to call method 'get_player_name' (a nil value)
2018-09-15 16:57:44: ERROR[Main]: stack traceback:
2018-09-15 16:57:44: ERROR[Main]:   ....minetest/games/minetest_game/mods/default/functions.lua:557: in function 'can_interact_with_node'
2018-09-15 16:57:44: ERROR[Main]:   ...netest/.minetest/games/minetest_game/mods/doors/init.lua:153: in function 'open'
2018-09-15 16:57:44: ERROR[Main]:   /media/minetest/.minetest/mods/xdecor/src/mechanisms.lua:17: in function 'door_toggle'
2018-09-15 16:57:44: ERROR[Main]:   /media/minetest/.minetest/mods/xdecor/src/mechanisms.lua:43: in function </media/minetest/.minetest/mods/xdecor/src/mechanisms.lua:33>

This indicates that door:open()/door:close() want the player object and not the player name.

The fix in #97 works on Minetest 0.4.17.1 multiplayer server.

Regards,

Jakub Vaněk