EdenLostMinetest / edenlost

Issues, mods, configs for the EdenLost Minetest server (el.edgy1.net:48131)
Apache License 2.0
1 stars 0 forks source link

Crash when hitting mummies using draconis weapons. #45

Open TheNoobMinetest opened 2 years ago

TheNoobMinetest commented 2 years ago

Not much else to be said.

dennisjenkins75 commented 2 years ago

(edit - Seems that I grabbed the wrong stack trace at first).

@TheNoobMinetest were you using a draconis sword to attack the mummy?

ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'tsm_pyramids' in callback luaentity_Punch(): /home/1hit/worlds/world/worldmods/tsm_pyramids/mummy.lua:154: attempt to compare number with nil
stack traceback:
        /home/1hit/worlds/world/worldmods/tsm_pyramids/mummy.lua:154: in function 'old_punch'
        /home/1hit/worlds/world/worldmods/draconis/api/api.lua:1704: in function </home/1hit/worlds/world/worldmods/draconis/api/api.lua:1703>

From mummy.lua:

MUMMY_DEF.on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage)
   ... (code)
   if damage > 0 then

Looks like draconis is passing nil instead of 0 (or some other integer) when it calls on_punch(). Actually, its not even passing a damage value at all, so lua converts that to nil.

From Draconis. Note the call to old_punch() is missing a 5th argument (damage, integer).

            local old_punch = def.on_punch
            if not old_punch then
                old_punch = function() end
            end
            local on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir)
                old_punch(self, puncher, time_from_last_punch,  tool_capabilities, dir)

The canonical docs for on_punch() state that it takes 5 args, the last being damage.

https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L2081

    entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction,
                    damage)

ISTM that this is a bug in draconis.

dennisjenkins75 commented 2 years ago

For the time being, I've rolled back the draconis update to version https://github.com/ElCeejo/draconis/commit/39f1ac6e76c2581923a3a75eee3515505d7a417f, ElCeejo's last update before a massive code change set.