This reverts commit 84dc7da461
.
This commit is contained in:
parent
84dc7da461
commit
ea9d9ad2d8
9 changed files with 66 additions and 45 deletions
|
@ -133,21 +133,22 @@ end)
|
|||
|
||||
-- If player takes damage while healing,
|
||||
-- stop regen and revert back to original state
|
||||
minetest.register_on_player_hpchange(function(player, hp_change, reason)
|
||||
minetest.register_on_player_hpchange(function(player, hp, reason)
|
||||
local name = player:get_player_name()
|
||||
if hp_change < 0 then
|
||||
if hp < 0 then
|
||||
if players[name] then
|
||||
player:hud_remove(players[name].hud)
|
||||
players[name] = nil -- Don't use stop_healing(), it uses set_hp() and won't allocate deaths or score properly
|
||||
end
|
||||
if reason.type == "punch" then
|
||||
if reason and reason.type == "punch" then
|
||||
local hitter = reason.object
|
||||
if hitter and players[hitter:get_player_name()] then
|
||||
stop_healing(hitter, "attack")
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
return hp
|
||||
end, true)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
players[player:get_player_name()] = nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue