summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2017-06-20 16:38:52 +0200
committerWuzzy <almikes@aol.com>2017-06-20 16:38:52 +0200
commite09eb8ab4f144c3f69de7734cf2f3f475c0e9a0d (patch)
tree829f35c4bf4e56fd8bd1b7f0f1ba60f422472b39
parentbd0641af52020a39adc885271d80fdbd66af9651 (diff)
Use 0.4.16 settings syntax
This breaks compability with Minetest 0.4.15, 0.4.14, 0.4.13 and 0.4.12
-rw-r--r--init.lua18
1 files changed, 9 insertions, 9 deletions
diff --git a/init.lua b/init.lua
index db9072a..0ecbe35 100644
--- a/init.lua
+++ b/init.lua
@@ -20,11 +20,11 @@ hb.settings = {}
function hb.load_setting(sname, stype, defaultval, valid_values)
local sval
if stype == "string" then
- sval = minetest.setting_get(sname)
+ sval = minetest.settings:get(sname)
elseif stype == "bool" then
- sval = minetest.setting_getbool(sname)
+ sval = minetest.settings:get_bool(sname)
elseif stype == "number" then
- sval = tonumber(minetest.setting_get(sname))
+ sval = tonumber(minetest.settings:get(sname))
end
if sval ~= nil then
if valid_values ~= nil then
@@ -83,7 +83,7 @@ hb.settings.forceload_default_hudbars = hb.load_setting("hudbars_forceload_defau
hb.settings.alignment_pattern = hb.load_setting("hudbars_alignment_pattern", "string", "zigzag", {"zigzag", "stack_up", "stack_down"})
hb.settings.autohide_breath = hb.load_setting("hudbars_autohide_breath", "bool", true)
-local sorting = minetest.setting_get("hudbars_sorting")
+local sorting = minetest.settings:get("hudbars_sorting")
if sorting ~= nil then
hb.settings.sorting = {}
hb.settings.sorting_reverse = {}
@@ -464,7 +464,7 @@ function hb.get_hudbar_state(player, identifier)
end
--register built-in HUD bars
-if minetest.setting_getbool("enable_damage") or hb.settings.forceload_default_hudbars then
+if minetest.settings:get_bool("enable_damage") or hb.settings.forceload_default_hudbars then
hb.register_hudbar("health", 0xFFFFFF, S("Health"), { bar = "hudbars_bar_health.png", icon = "hudbars_icon_health.png", bgicon = "hudbars_bgicon_health.png" }, 20, 20, false)
hb.register_hudbar("breath", 0xFFFFFF, S("Breath"), { bar = "hudbars_bar_breath.png", icon = "hudbars_icon_breath.png", bgicon = "hudbars_bgicon_breath.png" }, 10, 10, true)
end
@@ -478,9 +478,9 @@ end
local function custom_hud(player)
- if minetest.setting_getbool("enable_damage") or hb.settings.forceload_default_hudbars then
+ if minetest.settings:get_bool("enable_damage") or hb.settings.forceload_default_hudbars then
local hide
- if minetest.setting_getbool("enable_damage") then
+ if minetest.settings:get_bool("enable_damage") then
hide = false
else
hide = true
@@ -500,7 +500,7 @@ end
-- update built-in HUD bars
local function update_hud(player)
if not player_exists(player) then return end
- if minetest.setting_getbool("enable_damage") then
+ if minetest.settings:get_bool("enable_damage") then
if hb.settings.forceload_default_hudbars then
hb.unhide_hudbar(player, "health")
end
@@ -550,7 +550,7 @@ minetest.register_globalstep(function(dtime)
if main_timer > hb.settings.tick or timer > 4 then
if main_timer > hb.settings.tick then main_timer = 0 end
-- only proceed if damage is enabled
- if minetest.setting_getbool("enable_damage") or hb.settings.forceload_default_hudbars then
+ if minetest.settings:get_bool("enable_damage") or hb.settings.forceload_default_hudbars then
for _, player in pairs(hb.players) do
-- update all hud elements
update_hud(player)