Use minetest.conf settings system

This commit is contained in:
Wuzzy 2016-12-04 01:41:47 +01:00
parent 96a796cce7
commit 3d1b4b0a97
3 changed files with 18 additions and 13 deletions

View File

@ -1,9 +0,0 @@
-- If true, automatically hides the armor when the player wears no armor.
-- Otherwise, the armor bar shows “0%”.
--hbarmor.autohide = true
-- Time difference in seconds between updates to the HUD armor bar.
-- Increase this number for slow servers.
-- hbarmor.tick = 0.1

View File

@ -16,18 +16,25 @@ hbarmor.player_active = {}
-- HUD item ids
local armor_hud = {}
-- Time difference in seconds between updates to the HUD armor bar.
-- Increase this number for slow servers.
hbarmor.tick = 0.1
-- If true, the armor bar is hidden when the player does not wear any armor
hbarmor.autohide = true
--load custom settings
local set = io.open(minetest.get_modpath("hbarmor").."/hbarmor.conf", "r")
if set then
dofile(minetest.get_modpath("hbarmor").."/hbarmor.conf")
set:close()
local set = minetest.setting_getbool("hbarmor_autohide")
if set ~= nil then
hbarmor.autohide = set
end
set = minetest.setting_get("hbarmor_tick")
if tonumber(set) ~= nil then
hbarmor.tick = tonumber(set)
end
local must_hide = function(playername, arm)
return ((not armor.def[playername].count or armor.def[playername].count == 0) and arm == 0)
end

7
settingtypes.txt Normal file
View File

@ -0,0 +1,7 @@
#If true, automatically hides the armor HUD bar when the player wears no
#armor. Otherwise, the armor bar shows “0%”.
hbarmor_autohide (Automatically hide armor HUD bar) bool true
#Time difference in seconds between updates to the armor HUD bar.
#Increase this number for slow servers.
hbarmor_tick (Armor HUD bar update frequency) float 0.1 0.0