From 049406162e0050819adab2624718e90df2a693bb Mon Sep 17 00:00:00 2001 From: ancientmarinerdev Date: Fri, 24 Mar 2023 23:05:16 +0000 Subject: [PATCH] Fix crash when skeleton tries to jock when there is no pos, maybe because pos is unloaded. --- mods/ENTITIES/mcl_mobs/api.lua | 5 ++++- mods/ENTITIES/mobs_mc/skeleton+stray.lua | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 50b9ad8ec..39d2f45a9 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -62,8 +62,11 @@ function mob_class:update_tag() --update nametag and/or the debug box end function mob_class:jock_to(mob, reletive_pos, rot) + local pos = self.object:get_pos() + if not pos then return end + self.jockey = mob - local jock = minetest.add_entity(self.object:get_pos(), mob) + local jock = minetest.add_entity(pos, mob) if not jock then return end jock:get_luaentity().docile_by_day = false jock:get_luaentity().riden_by_jock = true diff --git a/mods/ENTITIES/mobs_mc/skeleton+stray.lua b/mods/ENTITIES/mobs_mc/skeleton+stray.lua index 75cfa8bd8..0ee53e8ec 100644 --- a/mods/ENTITIES/mobs_mc/skeleton+stray.lua +++ b/mods/ENTITIES/mobs_mc/skeleton+stray.lua @@ -91,7 +91,7 @@ local skeleton = { }, on_spawn = function(self) if math.random(100) == 1 then - self:jock_to("mobs_mc:spider", vector.new(0,0,0), vector.new(0,0,0)) + self:jock_to("mobs_mc:spider", vector.zero(), vector.zero()) end return true end,