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 using //count #100

Closed Montandalar closed 1 year ago

Montandalar commented 1 year ago

System info

Minetest version: 5.8.0-dev-5cd6a22d (self-compiled under Debian). Lua runtime: LuaJIT

Steps to reproduce

  1. Place pos1 with //pos1 at non-integer coordinates. The selection appears where the player stood, not aligned to the node like standard worldedit.
  2. Place pos2 with //pos2, no restriction on placement is necessary.
  3. Run //count. The game crashes with this error message:
AsyncErr: Lua: Runtime error from mod 'worldeditadditions_commands' in callback on_chat_message(): ...test-WorldEditAdditions/worldeditadditions/lib/count.lua:29: table index is nil
stack traceback:
    ...test-WorldEditAdditions/worldeditadditions/lib/count.lua:29: in function 'count'
    ...Additions/worldeditadditions_commands/commands/count.lua:26: in function 'func'
    ...itAdditions/worldeditadditions_core/core/run_command.lua:9: in function 'run_command_stage2'
    ...itAdditions/worldeditadditions_core/core/run_command.lua:53: in function 'run_command'
    ...itions/worldeditadditions_core/core/register_command.lua:57: in function 'func'
    /usr/local/share/minetest/builtin/game/chat.lua:79: in function </usr/local/share/minetest/builtin/game/chat.lua:52>
    /usr/local/share/minetest/builtin/game/register.lua:446: in function </usr/local/share/minetest/builtin/game/register.lua:432>
  1. For contrast, re-run the test but in steps 1 and 2, teleport the player to integer coordinates while fly and noclip before running each command. No crash with only integer coordinates.

Remarks

It is probably necessary to clamp the positions to the nearest node boundaries when running the check. I'm new to this mod though and don't know why non-block-aligned positions would be useful.

VorTechnix commented 1 year ago

It is probably necessary to clamp the positions to the nearest node boundaries when running the check. I'm new to this mod though and don't know why non-block-aligned positions would be useful.

Sorry for your rough introduction to our mod. We just implemented a fancy new selection system that apparently still has some bugs.

To clarify all positions should be aligned to node as they are in worldedit.

VorTechnix commented 1 year ago

image

Yah, this should not happen.

VorTechnix commented 1 year ago

@Montandalar it should be fixed now with commit d2fb6db3d0c8e73dac871e2acd28c41cf1b46541.

If you have this problem again please let us know. Thanks for the report!