From 2ee4395adf1722e3016f1e80df830fa551bdd522 Mon Sep 17 00:00:00 2001 From: LoneWolfBT Date: Mon, 25 Dec 2023 15:41:32 -0800 Subject: [PATCH] Fix how hp is displayed --- builtin/game/statbars.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/builtin/game/statbars.lua b/builtin/game/statbars.lua index 78d1d2728a172..065ed063980ae 100644 --- a/builtin/game/statbars.lua +++ b/builtin/game/statbars.lua @@ -29,11 +29,15 @@ local bar_definitions = { local hud_ids = {} local function scaleToHudMax(player, field) - -- Scale "hp" or "breath" to the hud maximum dimensions - local current = player["get_" .. field](player) - local nominal = bar_definitions[field].item - local max_display = math.max(player:get_properties()[field .. "_max"], current) - return math.ceil(current / max_display * nominal) + if field == "hp" then + return player["get" .. field](player) + else + -- Scale "hp" or "breath" to the hud maximum dimensions + local current = player["get_" .. field](player) + local nominal = bar_definitions[field].item + local max_display = math.max(player:get_properties()[field .. "_max"], current) + return math.ceil(current / max_display * nominal) + end end local function update_builtin_statbars(player)