1
0
Fork 0

Fix crash while fighting whither (#4392)

Reviewed-on: VoxeLibre/VoxeLibre#4392
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
Co-authored-by: teknomunk <teknomunk@protonmail.com>
Co-committed-by: teknomunk <teknomunk@protonmail.com>
This commit is contained in:
teknomunk 2024-06-12 14:18:03 +02:00 committed by the-real-herowl
parent bf67fd52e1
commit 1f32b47208
1 changed files with 8 additions and 3 deletions

View File

@ -1352,7 +1352,7 @@ minetest.register_globalstep(function(dtime)
potions_set_hud(object) potions_set_hud(object)
else else
local ent = object:get_luaentity() local ent = object:get_luaentity()
if ent then if ent and ent._mcl_potions then
ent._mcl_potions["_EF_"..name] = nil ent._mcl_potions["_EF_"..name] = nil
end end
end end
@ -1367,7 +1367,7 @@ minetest.register_globalstep(function(dtime)
end end
else else
local ent = object:get_luaentity() local ent = object:get_luaentity()
if ent then if ent and ent._mcl_potions then
ent._mcl_potions["_EF_"..name] = EF[name][object] ent._mcl_potions["_EF_"..name] = EF[name][object]
end end
end end
@ -1780,9 +1780,14 @@ end
local function target_valid(object, name) local function target_valid(object, name)
if not object or object:get_hp() <= 0 then return false end if not object or object:get_hp() <= 0 then return false end
-- Don't apply effects to anything other than players and entities that have mcl_potions support
-- but are not bosses
local entity = object:get_luaentity() local entity = object:get_luaentity()
if entity and entity.is_boss then return false end if not object:is_player() and (not entity or entity.is_boss or not entity._mcl_potions) then
return false
end
-- Check resistances
for i=1, #registered_res_predicates do for i=1, #registered_res_predicates do
if registered_res_predicates[i](object, name) then return false end if registered_res_predicates[i](object, name) then return false end
end end