Recent HV_Quarry changes crashing on server EdenLost
dennisjenkins75 opened this issue · comments
Server is "multicraft-2.0.0"
ServerError: AsyncErr: environment_Step: Runtime error from mod 'technic' in callback environment_Step(): ...s/world/worldmods/technic/technic/machines/HV/quarry.lua:113: bad argument #1 to 'tonumber' (value expected)
stack traceback:
[C]: in function 'tonumber'
...s/world/worldmods/technic/technic/machines/HV/quarry.lua:113: in function 'do_digging'
...s/world/worldmods/technic/technic/machines/HV/quarry.lua:226: in function <...s/world/worldmods/technic/technic/machines/HV/quarry.lua:211>
...lds/world/worldmods/technic/technic/machines/network.lua:600: in function 'run_nodes'
...lds/world/worldmods/technic/technic/machines/network.lua:640: in function 'network_run'
...echnic/technic/machines/switching_station_globalstep.lua:41: in function <...echnic/technic/machines/switching_station_globalstep.lua:9>
/home/1hit/multicraft/bin/../builtin/game/register.lua:441: in function </home/1hit/multicraft/bin/../builtin/game/register.lua:425>
stack traceback:
Looks like a multicraft issue, or maybe an issue with Lua in multicraft.
This is the code, meta:get()
returns either a string or nil, and tonumber()
should return nil when passed a nil value.
technic/technic/machines/HV/quarry.lua
Line 113 in 1546aa0
tonumber(nil)
returns nil
, but tonumber()
throws an error. In MultiCraft, meta:get
probably returns nothing (not nil
) when the key is not found. This was fixed some time ago in Minetest. As a workaround, add parentheses: tonumber((meta:get("step")))
.
even as this is a fixed issue in upstream multicraft now, perhaps a monkey patch to the api for older versions, or patching every meta instance is in order since (at least according to cdb), this mod supports 5.0 and up
Oh, that was a 5.5.0 fix... minetest/minetest@5aa95fe
So yeah, it should be fixed here too.
Decided to change it to tonumber(meta:get("step") or "")
rather than adding the extra parentheses, it's clearer that way, and it still works the same.