kestral246 / tunnelmaker

Minetest mod
Creative Commons Zero v1.0 Universal
8 stars 8 forks source link

Runtime Error #8

Closed Git-Forked closed 3 years ago

Git-Forked commented 3 years ago

2021-05-01 19:10:12: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback item_OnPlace(): ...est/minetest/bin/../mods/latency_protection/init.lua:77: bad argument #1 to 'get_player_by_name' (string expected, got userdata) 2021-05-01 19:10:12: ERROR[Main]: stack traceback: 2021-05-01 19:10:12: ERROR[Main]: [C]: in function 'get_player_by_name' 2021-05-01 19:10:12: ERROR[Main]: ...est/minetest/bin/../mods/latency_protection/init.lua:77: in function 'is_protected' 2021-05-01 19:10:12: ERROR[Main]: ...e/minetest/minetest/bin/../mods/tunnelmaker/init.lua:354: in function 'ok_to_tunnel' 2021-05-01 19:10:12: ERROR[Main]: ...e/minetest/minetest/bin/../mods/tunnelmaker/init.lua:463: in function '?' 2021-05-01 19:10:12: ERROR[Main]: ...e/minetest/minetest/bin/../mods/tunnelmaker/init.lua:761: in function 'run_list' 2021-05-01 19:10:12: ERROR[Main]: ...e/minetest/minetest/bin/../mods/tunnelmaker/init.lua:886: in function 'dig_tunnel' 2021-05-01 19:10:12: ERROR[Main]: ...e/minetest/minetest/bin/../mods/tunnelmaker/init.lua:980: in function <...e/minetest/minetest/bin/../mods/tunnelmaker/init.lua:961>

Minetest server info:

Minetest 5.4.0 (Linux)
Using Irrlicht 1.8.4
Using Lua 5.1.5
BUILD_TYPE=Release
RUN_IN_PLACE=0
USE_CURL=1
USE_GETTEXT=0
USE_SOUND=1
USE_FREETYPE=1

Error causes server to shutdown.

kestral246 commented 3 years ago

Verified issue. Working on a fix.

kestral246 commented 3 years ago

I've checked in an initial fix for this issue.

It prevents digging protected areas, and doesn't crash with latency_protection, but has a problem with the latter's damage option. Tunnelmaker digs many dozens of nodes at once, and checks protection for each node in turn. If this is done in a protected area with latency_protection's damage option enabled, the player will die.

I'm going to think about this some more before I re-release to ContentDB. A couple of options are to stop digging at the first protected node, or to test all nodes before starting to dig any nodes.

kestral246 commented 3 years ago

Updated to test all nodes before digging tunnel. Also updated protection checks when clearing tree cover and replacing reference nodes.

Thanks for pointing out this issue.