forked from MineClone5/MineClone5
Update fire resistance to allow damage if "drowning" in lava
This commit is contained in:
parent
eee75f8988
commit
9301e03b52
|
@ -59,7 +59,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) )
|
player:set_hp( math.max(player:get_hp() - 1, 1), { type = "punch", from = "potion" })
|
||||||
end
|
end
|
||||||
|
|
||||||
is_poisoned[player].hit_timer = 0
|
is_poisoned[player].hit_timer = 0
|
||||||
|
@ -259,6 +259,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- Prevent damage to player with Fire Resistance enabled
|
||||||
minetest.register_on_player_hpchange(function(player, hp_change)
|
minetest.register_on_player_hpchange(function(player, hp_change)
|
||||||
|
|
||||||
if is_fire_proof[player] and hp_change < 0 then
|
if is_fire_proof[player] and hp_change < 0 then
|
||||||
|
@ -268,7 +269,11 @@ minetest.register_on_player_hpchange(function(player, hp_change)
|
||||||
local player_info = mcl_playerinfo[player:get_player_name()]
|
local player_info = mcl_playerinfo[player:get_player_name()]
|
||||||
|
|
||||||
if is_fire_node[player_info.node_head] or is_fire_node[player_info.node_feet] or is_fire_node[player_info.node_stand] then
|
if is_fire_node[player_info.node_head] or is_fire_node[player_info.node_feet] or is_fire_node[player_info.node_stand] then
|
||||||
|
if player:get_breath() == 0 then -- probably drowning
|
||||||
|
return -1
|
||||||
|
else
|
||||||
return 0
|
return 0
|
||||||
|
end
|
||||||
else
|
else
|
||||||
return hp_change
|
return hp_change
|
||||||
end
|
end
|
||||||
|
@ -466,7 +471,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)
|
player:set_hp(player:get_hp() + hp, { type = "punch", from = "potion" })
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue