lhofhansl / rangedweapons

Other
5 stars 4 forks source link

`Invalid position` crash #3

Closed MoNTE48 closed 1 month ago

MoNTE48 commented 3 months ago
2024-03-19 07:06:00: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'default' in callback luaentity_Step(): Invalid position (expected table got nil). 
2024-03-19 07:06:00: ERROR[Main]: stack traceback: 2024-03-19 07:06:00: ERROR[Main]: [C]: in function 'get_meta' 
2024-03-19 07:06:00: ERROR[Main]: .../../games/minetest_game_28/mods/tnt/init.lua:410: in function 'boom' 
2024-03-19 07:06:00: ERROR[Main]: .../worldmods/rangedweapons/ammo.lua:762: in function 'OnCollision' 
2024-03-19 07:06:00: ERROR[Main]: .../worldmods/rangedweapons/ammo.lua:249: in function <.../worldmods/rangedweapons/ammo.lua:31>
lhofhansl commented 1 month ago

I noticed that in other mods too. Seems to be related to a change in the minetest-game TNT mod. Can you tell me what exactly you did - i.e. what kind of weapon this was?

lhofhansl commented 1 month ago

I fixed it like this in MT game:

diff --git a/mods/tnt/init.lua b/mods/tnt/init.lua
index 622b6c9..ab438a5 100644
--- a/mods/tnt/init.lua
+++ b/mods/tnt/init.lua
@@ -159,6 +159,7 @@ local function entity_physics(pos, radius, drops)
    local objs = minetest.get_objects_inside_radius(pos, radius)
    for _, obj in pairs(objs) do
        local obj_pos = obj:get_pos()
+       if obj_pos then
        local dist = math.max(1, vector.distance(pos, obj_pos))

        local damage = (4 / dist) * radius
@@ -200,6 +201,7 @@ local function entity_physics(pos, radius, drops)
                end
            end
        end
+       end
    end
 end
MoNTE48 commented 1 month ago

Unfortunately, it's just raw logs from one of the servers. I have no idea what the player was doing at the time of the crash.

lhofhansl commented 1 month ago

I think it's a recent engine change, but haven't had time to take a look.

lhofhansl commented 1 month ago

This is now fixed in MT game. (https://github.com/minetest/minetest_game/pull/3121)

lhofhansl commented 1 month ago

I'm closing this one here, since this is a not problem with this mod - and would not know how to fix it here.