Fix medkits not allocating deaths/score after death (#749)

* Fix medkits preventing kills or score from being given on death
* Remove HUD
This commit is contained in:
Apelta 2021-01-17 22:25:08 -06:00 committed by GitHub
parent 2e3ffe8be0
commit 62cedd9267
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -130,9 +130,11 @@ end)
-- If player takes damage while healing,
-- stop regen and revert back to original state
minetest.register_on_player_hpchange(function(player, hp, reason)
local name = player:get_player_name()
if hp < 0 then
if players[player:get_player_name()] then
stop_healing(player, "damage")
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 and reason.type == "punch" then
local hitter = reason.object