Closed mrbid closed 2 years ago
Ok? What am I supposed to guess? Give me details please.
local old_is_creative_enabled = core.is_creative_enabled
function core.is_creative_enabled(name)
if name == "" then
return old_is_creative_enabled(name)
end
return core.check_player_privs(name, {creative = true}) or old_is_creative_enabled(name)
end
old_is_creative_enabled
just calls core.is_creative_enabled
again, it's redundant. I recommend.
function core.is_creative_enabled(name)
if name ~= nil and name == "" then
return false
end
return core.check_player_privs(name, {creative = true})
end
I noticed this part of the code crashing my server quite a few times and the stack trace leading through 3d_armor and skinsdb.
2022-02-18 08:30:43: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'i3' in callback environment_Step(): (load):19: core.check_player_privs expects a player or playername as argument.
2022-02-18 08:30:43: ERROR[Main]: stack traceback:
2022-02-18 08:30:43: ERROR[Main]: [C]: in function 'error'
2022-02-18 08:30:43: ERROR[Main]: ...home/x/mtnew/minetest/bin/../builtin/game/misc.lua:23: in function 'check_player_privs'
2022-02-18 08:30:43: ERROR[Main]: (load):19: in function 'is_creative_enabled'
2022-02-18 08:30:43: ERROR[Main]: (load):1255: in function 'hide_items'
2022-02-18 08:30:43: ERROR[Main]: (load):1272: in function 'get_items_fs'
2022-02-18 08:30:43: ERROR[Main]: (load):1493: in function 'make_fs'
2022-02-18 08:30:43: ERROR[Main]: (load):170: in function 'func'
2022-02-18 08:30:43: ERROR[Main]: ...e/x/mtnew/minetest/bin/../builtin/common/after.lua:20: in function '?'
2022-02-18 08:30:43: ERROR[Main]: .../x/mtnew/minetest/bin/../builtin/game/register.lua:425: in function <.../x/mtnew/minetest/bin/../builtin/game/register.lua:409>
But after nil checking that part of the code and another part of the code, I forget which now, it seems to have stopped this.
Is there any further backtrace before register.lua
? I suppose there's a mod (or i3 itself) that calls to core.is_creative_enabled
using invalid parameters (nil?).
Also this is not recursion.
sadly that is all the output I have
MTG's creative
shares the same code and there has been no issue with it so far.
common.lua > core.is_creative_enabled