Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when hitting mummies using draconis weapons. #45

Open
TheNoobMinetest opened this issue Feb 15, 2022 · 2 comments
Open

Crash when hitting mummies using draconis weapons. #45

TheNoobMinetest opened this issue Feb 15, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@TheNoobMinetest
Copy link

Not much else to be said.

@dennisjenkins75
Copy link
Contributor

dennisjenkins75 commented Feb 15, 2022

(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
Copy link
Contributor

For the time being, I've rolled back the draconis update to version ElCeejo/draconis@39f1ac6, ElCeejo's last update before a massive code change set.

@dennisjenkins75 dennisjenkins75 changed the title Crash when hitting mummies Crash when hitting mummies using draconis weapons. Feb 15, 2022
@dennisjenkins75 dennisjenkins75 added the bug Something isn't working label May 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants