mirror of
https://github.com/minetest-mods/hbsprint.git
synced 2024-12-22 13:22:24 +01:00
Fix bug not checking for hudbars properly
This commit is contained in:
parent
775a7d33ff
commit
d45b439a5a
8
init.lua
8
init.lua
@ -70,7 +70,7 @@ local function drain_stamina(player)
|
|||||||
if player_stamina > 0 then
|
if player_stamina > 0 then
|
||||||
player:get_meta():set_float("hbsprint:stamina", player_stamina - stamina_drain)
|
player:get_meta():set_float("hbsprint:stamina", player_stamina - stamina_drain)
|
||||||
end
|
end
|
||||||
if hudbars then
|
if mod_hudbars then
|
||||||
if autohide and player_stamina < 20 then hb.unhide_hudbar(player, "stamina") end
|
if autohide and player_stamina < 20 then hb.unhide_hudbar(player, "stamina") end
|
||||||
hb.change_hudbar(player, "stamina", player_stamina)
|
hb.change_hudbar(player, "stamina", player_stamina)
|
||||||
end
|
end
|
||||||
@ -81,7 +81,7 @@ local function replenish_stamina(player)
|
|||||||
if player_stamina < 20 then
|
if player_stamina < 20 then
|
||||||
player:get_meta():set_float("hbsprint:stamina", player_stamina + stamina_drain)
|
player:get_meta():set_float("hbsprint:stamina", player_stamina + stamina_drain)
|
||||||
end
|
end
|
||||||
if hudbars then
|
if mod_hudbars then
|
||||||
hb.change_hudbar(player, "stamina", player_stamina)
|
hb.change_hudbar(player, "stamina", player_stamina)
|
||||||
if autohide and player_stamina == 20 then hb.hide_hudbar(player, "stamina") end
|
if autohide and player_stamina == 20 then hb.hide_hudbar(player, "stamina") end
|
||||||
end
|
end
|
||||||
@ -131,7 +131,7 @@ end
|
|||||||
|
|
||||||
-- Registrations
|
-- Registrations
|
||||||
|
|
||||||
if minetest.get_modpath("hudbars") ~= nil and stamina then
|
if mod_hudbars and stamina then
|
||||||
hb.register_hudbar(
|
hb.register_hudbar(
|
||||||
"stamina",
|
"stamina",
|
||||||
0xFFFFFF,
|
0xFFFFFF,
|
||||||
@ -147,7 +147,7 @@ if minetest.get_modpath("hudbars") ~= nil and stamina then
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
if hudbars and stamina then hb.init_hudbar(player, "stamina", 20, 20, autohide) end
|
if mod_hudbars and stamina then hb.init_hudbar(player, "stamina", 20, 20, autohide) end
|
||||||
player:get_meta():set_float("hbsprint:stamina", 20)
|
player:get_meta():set_float("hbsprint:stamina", 20)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user