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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -50,7 +50,7 @@ minetest.register_entity("gauges:hp_bar", {
return
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)
if self.hp ~= hp or self.breath ~= breath then