From 5c2cb597b8f291439e0c8daf9eefc968b6449996 Mon Sep 17 00:00:00 2001 From: LoneWolfHT Date: Sat, 28 Aug 2021 15:16:42 -0700 Subject: [PATCH] Make health bars show rough percentage of max hp --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 8cc1224..caed281 100644 --- a/init.lua +++ b/init.lua @@ -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