sbrl / Minetest-WorldEditAdditions

Extra tools and commands to extend WorldEdit for Minetest
https://worldeditadditions.mooncarrot.space/
Mozilla Public License 2.0
16 stars 3 forks source link

Crash on non-numerical seed #7

Closed Bastrabun closed 4 years ago

Bastrabun commented 4 years ago

When I use a non-numerical seed, I crash my game:

//maze default:dirt 2 3 seed

AsyncErr: ServerThread::run Lua: Runtime error from mod 'worldeditadditions_commands' in callback on_chat_message(): .....\mods\worldeditadditions\worldeditadditions/maze2d.lua:26: bad argument #1 to 'randomseed' (number expected, got nil)
stack traceback:
    [C]: in function 'randomseed'
    .....\mods\worldeditadditions\worldeditadditions/maze2d.lua:26: in function 'generate_maze'
    .....\mods\worldeditadditions\worldeditadditions/maze2d.lua:152: in function 'maze2d'
    ...tadditions\worldeditadditions_commands/commands/maze.lua:57: in function 'func'
    ....0\minetest-5.2.0-win64-dev\bin\..\builtin\game\chat.lua:69: in function <....0\minetest-5.2.0-win64-dev\bin\..\builtin\game\chat.lua:48>
    ...inetest-5.2.0-win64-dev\bin\..\builtin\game\register.lua:429: in function <...inetest-5.2.0-win64-dev\bin\..\builtin\game\register.lua:413>

Sorry, took me a while to properly test it.

Bastrabun commented 4 years ago

Also crashes on

//maze default:dirt -1 //maze default:dirt 0.5

I assume they count as string rather than proper numbers?

sbrl commented 4 years ago

Hey, thanks for the report! Sorry that it's taken me until now to get to it :P

I've just finished migrating everything to worldedit.register_command() (see #5). As part of this I made it more strict about the seed, so this now does not crash for me for that first example.

Thanks for those path dimension edge cases too - I've fixed those too.

Could you try updating and trying these again please?

I'll close this for now, but if you do continue to experience issues, comment here and I'll reopen.