mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 05:43:43 +01:00
Fix crashes with raids and bad omen effect (#4326)
Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4326 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
68e5c19df4
commit
8feecf2492
@ -105,8 +105,6 @@ function mcl_raids.promote_to_raidcaptain(c) -- object
|
|||||||
if cmi_cause and cmi_cause.type == "punch" and cmi_cause.puncher:is_player() then
|
if cmi_cause and cmi_cause.type == "punch" and cmi_cause.puncher:is_player() then
|
||||||
awards.unlock(cmi_cause.puncher:get_player_name(), "mcl:voluntary_exile")
|
awards.unlock(cmi_cause.puncher:get_player_name(), "mcl:voluntary_exile")
|
||||||
local lv = mcl_potions.get_effect_level(cmi_cause.puncher, "bad_omen")
|
local lv = mcl_potions.get_effect_level(cmi_cause.puncher, "bad_omen")
|
||||||
if not lv then lv = 0
|
|
||||||
else lv = lv.factor end
|
|
||||||
lv = math.max(5,lv + 1)
|
lv = math.max(5,lv + 1)
|
||||||
mcl_potions.give_effect_by_level("bad_omen", cmi_cause.puncher, lv, 6000)
|
mcl_potions.give_effect_by_level("bad_omen", cmi_cause.puncher, lv, 6000)
|
||||||
end
|
end
|
||||||
@ -311,7 +309,7 @@ mcl_events.register_event("raid",{
|
|||||||
self.health_max = 1
|
self.health_max = 1
|
||||||
self.health = 0
|
self.health = 0
|
||||||
local lv = mcl_potions.get_effect_level(minetest.get_player_by_name(self.player), "bad_omen")
|
local lv = mcl_potions.get_effect_level(minetest.get_player_by_name(self.player), "bad_omen")
|
||||||
if lv and lv.factor and lv.factor > 1 then self.max_stage = 6 end
|
if lv > 1 then self.max_stage = 6 end
|
||||||
end,
|
end,
|
||||||
cond_progress = function(self)
|
cond_progress = function(self)
|
||||||
if not is_player_near(self) then return false end
|
if not is_player_near(self) then return false end
|
||||||
|
Loading…
Reference in New Issue
Block a user