Update init.lua

This commit is contained in:
LoneWolfHT 2021-10-13 13:52:43 -07:00 committed by GitHub
parent a0f88d84c7
commit 7df078c937
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -12,7 +12,7 @@ end
-- as it's called on every step
local vector_distance = vector.distance
local max = {
breath = 11,
breath = 10,
hp = 20,
}
@ -36,7 +36,7 @@ local function scaleToDefault(player, field)
-- Scale "hp" or "breath" to supported amount
local current = player["get_" .. field](player)
local max_display = math.max(player:get_properties()[field .. "_max"], current)
return current / max_display * max[field]
return math.round(current / max_display * max[field])
end
minetest.register_entity("gauges:hp_bar", {