Make health bars show rough percentage of max hp

This commit is contained in:
LoneWolfHT
2021-08-28 15:16:42 -07:00
committed by GitHub
parent 622e31394e
commit 5c2cb597b8

View File

@ -50,7 +50,7 @@ minetest.register_entity("gauges:hp_bar", {
return return
end end
local hp = min(player:get_hp(), 20) local hp = min(math.ceil((player:get_hp() / player:get_properties().hp_max) * 20), 20)
local breath = min(player:get_breath(), max_breath) local breath = min(player:get_breath(), max_breath)
if self.hp ~= hp or self.breath ~= breath then if self.hp ~= hp or self.breath ~= breath then