mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-26 03:07:32 +01:00
Fix crash while fighting whither (#4392)
Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/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:
parent
bf67fd52e1
commit
1f32b47208
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user