mirror of
https://git.minetest.land/Mineclonia/Mineclonia.git
synced 2024-11-24 14:45:12 +00:00
Allow damage to armor players with poison
This commit is contained in:
parent
16d9ee47b6
commit
5baa1b0275
2 changed files with 10 additions and 6 deletions
|
@ -499,6 +499,10 @@ minetest.register_on_player_hpchange(function(player, hp_change, reason)
|
||||||
return hp_change
|
return hp_change
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if reason.other == "poison" then
|
||||||
|
return hp_change
|
||||||
|
end
|
||||||
|
|
||||||
local heal_max = 0
|
local heal_max = 0
|
||||||
local items = 0
|
local items = 0
|
||||||
local armor_damage = math.max(1, math.floor(math.abs(hp_change)/4))
|
local armor_damage = math.max(1, math.floor(math.abs(hp_change)/4))
|
||||||
|
|
|
@ -51,7 +51,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
if player._cmi_is_mob then
|
if player._cmi_is_mob then
|
||||||
player.health = math.max(player.health - 1, 1)
|
player.health = math.max(player.health - 1, 1)
|
||||||
else
|
else
|
||||||
player:set_hp( math.max(player:get_hp() - 1, 1), { type = "punch", from = "potion" })
|
player:set_hp( math.max(player:get_hp() - 1, 1), { type = "punch", other = "poison"})
|
||||||
end
|
end
|
||||||
|
|
||||||
is_poisoned[player].hit_timer = 0
|
is_poisoned[player].hit_timer = 0
|
||||||
|
@ -81,7 +81,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
if player:get_pos() then mcl_potions._add_spawner(player, "#A52BB2") end
|
if player:get_pos() then mcl_potions._add_spawner(player, "#A52BB2") end
|
||||||
|
|
||||||
if is_regenerating[player].heal_timer >= is_regenerating[player].step then
|
if is_regenerating[player].heal_timer >= is_regenerating[player].step then
|
||||||
player:set_hp(math.min(player:get_properties().hp_max or 20, player:get_hp() + 1))
|
player:set_hp(math.min(player:get_properties().hp_max or 20, player:get_hp() + 1), { type = "set_hp", other = "regeneration" })
|
||||||
is_regenerating[player].heal_timer = 0
|
is_regenerating[player].heal_timer = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -467,7 +467,7 @@ function mcl_potions.healing_func(player, hp)
|
||||||
if obj and obj._cmi_is_mob then
|
if obj and obj._cmi_is_mob then
|
||||||
obj.health = math.max(obj.health + hp, obj.hp_max)
|
obj.health = math.max(obj.health + hp, obj.hp_max)
|
||||||
else
|
else
|
||||||
player:set_hp(math.min(player:get_hp() + hp, player:get_properties().hp_max))
|
player:set_hp(math.min(player:get_hp() + hp, player:get_properties().hp_max), { type = "set_hp", other = "healing" })
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -475,7 +475,7 @@ function mcl_potions.healing_func(player, hp)
|
||||||
if obj and obj._cmi_is_mob then
|
if obj and obj._cmi_is_mob then
|
||||||
obj.health = obj.health + hp
|
obj.health = obj.health + hp
|
||||||
else
|
else
|
||||||
player:set_hp(player:get_hp() + hp, { type = "punch", from = "potion" })
|
player:set_hp(player:get_hp() + hp, { type = "punch", other = "harming" })
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue