forked from mtcontrib/minetest_hbarmor
Make sure armor value is never outside of 0 or 100
This commit is contained in:
parent
878a351e9d
commit
a4408d010f
2
init.lua
2
init.lua
@ -93,7 +93,7 @@ function hbarmor.set_armor(player_name, ges_state, items)
|
|||||||
lvl = 0
|
lvl = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
hbarmor.armor[player_name] = math.min(lvl* (items * (100 / max_items)), 100)
|
hbarmor.armor[player_name] = math.max(0, math.min(lvl* (items * (100 / max_items)), 100))
|
||||||
end
|
end
|
||||||
|
|
||||||
-- update hud elemtens if value has changed
|
-- update hud elemtens if value has changed
|
||||||
|
Loading…
Reference in New Issue
Block a user