minetest-mods / xdecor

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

Chess error #105

Closed GreenXenith closed 5 years ago

GreenXenith commented 5 years ago

I believe this is different than #104.

ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'xdecor' in callback nodemeta_inventory_AllowMove(): /home/minetest/.minetest/mods/xdecor/src/chess.lua:5: attempt to perform arithmetic on local 'idx' (a nil value)
ERROR[Main]: stack traceback:
ERROR[Main]:    /home/minetest/.minetest/mods/xdecor/src/chess.lua:5: in function 'index_to_xy'
ERROR[Main]:    /home/minetest/.minetest/mods/xdecor/src/chess.lua:46: in function 'attacked'
ERROR[Main]:    /home/minetest/.minetest/mods/xdecor/src/chess.lua:708: in function </home/minetest/.minetest/mods/xdecor/src/chess.lua:237>
kilbith commented 5 years ago

There is chess AI branch I’m working on which fixes that. But got no time to finish it.

sofar commented 5 years ago

You can place a king (incorrectly) into check (illegal). After that, the next move will trigger this error. The code that crashes at line 5 is fine, the whole situation should not have happened, I think.

kilbith commented 5 years ago

https://github.com/minetest-mods/xdecor/commit/ee7a28176b59933e714ddf8bc035de2a94fc68c4

Please check if the issue can still be reproduced.