accurate_statbar.patch 822 B

12345678910111213141516171819202122
  1. diff --git a/builtin/game/statbars.lua b/builtin/game/statbars.lua
  2. index 46c947b6..f4372843 100644
  3. --- builtin/game/statbars.lua
  4. +++ builtin/game/statbars.lua
  5. @@ -24,12 +24,14 @@ local breath_bar_definition = {
  6. local hud_ids = {}
  7. local function scaleToDefault(player, field)
  8. + if field == "health" then
  9. + return player["get_" .. field](player)
  10. + else
  11. -- Scale "hp" or "breath" to the default dimensions
  12. local current = player["get_" .. field](player)
  13. local nominal = core["PLAYER_MAX_".. field:upper() .. "_DEFAULT"]
  14. local max_display = math.max(nominal,
  15. math.max(player:get_properties()[field .. "_max"], current))
  16. return current / max_display * nominal
  17. + end
  18. end
  19. local function update_builtin_statbars(player)