forked from mtcontrib/minetest_hbarmor
Use minetest.conf settings system
This commit is contained in:
parent
96a796cce7
commit
3d1b4b0a97
|
@ -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
|
15
init.lua
15
init.lua
|
@ -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
7
settingtypes.txt
Normal 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
|
Loading…
Reference in New Issue
Block a user