mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 04:21:07 +01:00
Clear bad omen when raid complete
This commit is contained in:
parent
6251c623dd
commit
c3455de604
2 changed files with 9 additions and 2 deletions
|
@ -106,8 +106,9 @@ function mcl_raids.promote_to_raidcaptain(c) -- object
|
||||||
l._banner = nil
|
l._banner = nil
|
||||||
mcl_raids.drop_obanner(pos)
|
mcl_raids.drop_obanner(pos)
|
||||||
if cmi_cause.type == "punch" and cmi_cause.puncher:is_player() then
|
if cmi_cause.type == "punch" and cmi_cause.puncher:is_player() then
|
||||||
local lv = mcl_potions.player_get_effect(cmi_cause.puncher, "bad_omen").factor
|
local lv = mcl_potions.player_get_effect(cmi_cause.puncher, "bad_omen")
|
||||||
if not lv then lv = 0 end
|
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.bad_omen_func(cmi_cause.puncher,lv,6000)
|
mcl_potions.bad_omen_func(cmi_cause.puncher,lv,6000)
|
||||||
end
|
end
|
||||||
|
@ -281,6 +282,7 @@ mcl_events.register_event("raid",{
|
||||||
on_complete = function(self)
|
on_complete = function(self)
|
||||||
--minetest.log("RAID complete")
|
--minetest.log("RAID complete")
|
||||||
awards.unlock(self.player,"mcl:hero_of_the_village")
|
awards.unlock(self.player,"mcl:hero_of_the_village")
|
||||||
|
mcl_potions.player_clear_effect(minetest.get_player_by_name(self.player),"bad_omen")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -524,6 +524,11 @@ function mcl_potions.player_get_effect(player, effect_name)
|
||||||
return EF[effect_name][player]
|
return EF[effect_name][player]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function mcl_potions.player_clear_effect(player,effect)
|
||||||
|
EF[effect][player] = nil
|
||||||
|
potions_set_icons(player)
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_on_leaveplayer( function(player)
|
minetest.register_on_leaveplayer( function(player)
|
||||||
mcl_potions._save_player_effects(player)
|
mcl_potions._save_player_effects(player)
|
||||||
mcl_potions._clear_cached_player_data(player) -- clearout the buffer to prevent looking for a player not there
|
mcl_potions._clear_cached_player_data(player) -- clearout the buffer to prevent looking for a player not there
|
||||||
|
|
Loading…
Reference in a new issue