mirror of
https://github.com/minetest-mods/gauges.git
synced 2025-07-03 08:40:30 +02:00
Make health bars show rough percentage of max hp
This commit is contained in:
2
init.lua
2
init.lua
@ -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
|
||||||
|
Reference in New Issue
Block a user