mirror of
https://github.com/minetest-mods/hbsprint.git
synced 2024-12-22 21:32:24 +01:00
Fix stupid autohide bugs
This commit is contained in:
parent
0aa19f99c5
commit
7ff4f434c0
32
init.lua
32
init.lua
@ -3,20 +3,16 @@
|
|||||||
local speed = tonumber(minetest.settings:get("sprint_speed")) or 1.3
|
local speed = tonumber(minetest.settings:get("sprint_speed")) or 1.3
|
||||||
local jump = tonumber(minetest.settings:get("sprint_jump")) or 1.1
|
local jump = tonumber(minetest.settings:get("sprint_jump")) or 1.1
|
||||||
local key = minetest.settings:get("sprint_key") or "Use"
|
local key = minetest.settings:get("sprint_key") or "Use"
|
||||||
local dir = minetest.settings:get_bool("sprint_forward_only")
|
local dir = minetest.settings:get_bool("sprint_forward_only") ~= false
|
||||||
local particles = tonumber(minetest.settings:get("sprint_particles")) or 2
|
local particles = tonumber(minetest.settings:get("sprint_particles")) or 2
|
||||||
local stamina = minetest.settings:get_bool("sprint_stamina")
|
local stamina = minetest.settings:get_bool("sprint_stamina") ~= false
|
||||||
local stamina_drain = tonumber(minetest.settings:get("sprint_stamina_drain")) or 2
|
local stamina_drain = tonumber(minetest.settings:get("sprint_stamina_drain")) or 2
|
||||||
local replenish = tonumber(minetest.settings:get("sprint_stamina_replenish")) or 2
|
local replenish = tonumber(minetest.settings:get("sprint_stamina_replenish")) or 2
|
||||||
local starve = minetest.settings:get_bool("sprint_starve")
|
local starve = minetest.settings:get_bool("sprint_starve") ~= false
|
||||||
local starve_drain = tonumber(minetest.settings:get("sprint_starve_drain")) or 0.5
|
local starve_drain = tonumber(minetest.settings:get("sprint_starve_drain")) or 0.5
|
||||||
local breath = minetest.settings:get_bool("sprint_breath")
|
local breath = minetest.settings:get_bool("sprint_breath") ~= false
|
||||||
local breath_drain = tonumber(minetest.settings:get("sprint_breath_drain")) or 1
|
local breath_drain = tonumber(minetest.settings:get("sprint_breath_drain")) or 1
|
||||||
local autohide = minetest.settings:get_bool("hudbars_autohide_stamina") ~= false
|
local autohide = minetest.settings:get_bool("hudbars_autohide_stamina") ~= false
|
||||||
if dir ~= false then dir = true end
|
|
||||||
if stamina ~= false then stamina = true end
|
|
||||||
if starve ~= false then starve = true end
|
|
||||||
if breath ~= false then breath = true end
|
|
||||||
|
|
||||||
local sprint_timer_step = 0.5
|
local sprint_timer_step = 0.5
|
||||||
local sprint_timer = 0
|
local sprint_timer = 0
|
||||||
@ -113,20 +109,22 @@ end
|
|||||||
-- Registrations
|
-- Registrations
|
||||||
|
|
||||||
if minetest.get_modpath("hudbars") ~= nil and stamina then
|
if minetest.get_modpath("hudbars") ~= nil and stamina then
|
||||||
hb.register_hudbar("stamina",
|
hb.register_hudbar(
|
||||||
|
"stamina",
|
||||||
0xFFFFFF,
|
0xFFFFFF,
|
||||||
"Stamina",
|
"Stamina",
|
||||||
{ bar = "sprint_stamina_bar.png", icon = "sprint_stamina_icon.png", bgicon = "sprint_stamina_bgicon.png" },
|
{
|
||||||
20, 20,
|
bar = "sprint_stamina_bar.png",
|
||||||
false, "%s: %.1f/%.1f")
|
icon = "sprint_stamina_icon.png",
|
||||||
hudbars = true
|
bgicon = "sprint_stamina_bgicon.png"
|
||||||
if autohide then
|
},
|
||||||
hb.hide_hudbar(player, "stamina")
|
20,
|
||||||
end
|
20,
|
||||||
|
autohide)
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
if hudbars and stamina then hb.init_hudbar(player, "stamina") end
|
if hudbars and stamina then hb.init_hudbar(player, "stamina", 20, 20, autohide) end
|
||||||
player:set_attribute("stamina", 20)
|
player:set_attribute("stamina", 20)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user