Introducing minetest_wadsprint.HIDE_HUD_BARS config option to hide HUD UI bars.

master
aa6 2017-10-26 22:25:00 +03:00
parent 8d5b612596
commit f1fbfbe27b
5 changed files with 11 additions and 6 deletions

View File

@ -35,7 +35,7 @@ All dependencies are optional.
**Development**
- Run `bash util/git_hook_pre_commit.bash install` after repository cloning.
- Run `bash util/git_hook_pre_commit.bash install` after repository cloning. To increment minor version add " 2" to `./VERSION`.
- http://dev.minetest.net/Category:Methods
**Changelog**

View File

@ -1 +1 @@
0.4.39
0.5.0

View File

@ -1,4 +1,5 @@
-- Common config values.
minetest_wadsprint.HIDE_HUD_BARS = true
minetest_wadsprint.STAMINA_MAX_VALUE = 100
minetest_wadsprint.DYSPNEA_THRESHOLD_VALUE = 3
minetest_wadsprint.SAVE_PLAYERS_STATS_TO_FILE = true

View File

@ -1,4 +1,8 @@
if minetest.get_modpath("hudbars") ~= nil then
if minetest_wadsprint.HIDE_HUD_BARS == true then
function minetest_wadsprint.initialize_hudbar(player) end
function minetest_wadsprint.hudbar_update_stamina(player) end
function minetest_wadsprint.hudbar_update_ready_to_sprint(player) end
elseif minetest.get_modpath("hudbars") ~= nil then
-- @see http://repo.or.cz/minetest_hudbars.git/blob_plain/HEAD:/API.md
function minetest_wadsprint.register_hudbar()
-- This function registers a new custom HUD bar definition to the HUD bars mod, so it can be later used to be displayed, changed, hidden and unhidden on a per-player basis. Note this does not yet display the HUD bar.
@ -149,6 +153,9 @@ else
alignment = minetest_wadsprint.MINETESTHUD_ALIGNMENT, -- `alignment`: Specifies how the item will be aligned. It ranges from -1 to 1, with 0 being the center, -1 is moved to the left/up, and 1 is to the right/down. Fractional values can be used.
})
end
function minetest_wadsprint.hudbar_update_stamina(player)
player.obj:hud_change(player.hud, "number", math.ceil((player.stamina / minetest_wadsprint.STAMINA_MAX_VALUE) * minetest_wadsprint.MINETESTHUD_HALF_ICONS_NUMBER))
end
function minetest_wadsprint.hudbar_update_ready_to_sprint(player)
if player.is_sprinting or player.is_ready_to_sprint then
player.obj:hud_change(player.hud, "text", minetest_wadsprint.MINETESTHUD_IS_SPRINTING_ICON)
@ -156,7 +163,4 @@ else
player.obj:hud_change(player.hud, "text", minetest_wadsprint.MINETESTHUD_IS_NOT_SPRINTING_ICON)
end
end
function minetest_wadsprint.hudbar_update_stamina(player)
player.obj:hud_change(player.hud, "number", math.ceil((player.stamina / minetest_wadsprint.STAMINA_MAX_VALUE) * minetest_wadsprint.MINETESTHUD_HALF_ICONS_NUMBER))
end
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 463 B