Use new Minetest settings API syntax

This commit is contained in:
Wuzzy 2017-08-09 16:25:59 +02:00
parent ceb313e9ff
commit 2063945d5c
1 changed files with 4 additions and 4 deletions

View File

@ -25,12 +25,12 @@ hbarmor.tick = 0.1
hbarmor.autohide = true hbarmor.autohide = true
--load custom settings --load custom settings
local set = minetest.setting_getbool("hbarmor_autohide") local set = minetest.settings:get_bool("hbarmor_autohide")
if set ~= nil then if set ~= nil then
hbarmor.autohide = set hbarmor.autohide = set
end end
set = minetest.setting_get("hbarmor_tick") set = minetest.settings:get("hbarmor_tick")
if tonumber(set) ~= nil then if tonumber(set) ~= nil then
hbarmor.tick = tonumber(set) hbarmor.tick = tonumber(set)
end end
@ -47,7 +47,7 @@ end
local function custom_hud(player) local function custom_hud(player)
local name = player:get_player_name() local name = player:get_player_name()
if minetest.setting_getbool("enable_damage") then if minetest.settings:get_bool("enable_damage") then
local ret = hbarmor.get_armor(player) local ret = hbarmor.get_armor(player)
if ret == false then if ret == false then
minetest.log("error", "[hbarmor] Call to hbarmor.get_armor in custom_hud returned with false!") minetest.log("error", "[hbarmor] Call to hbarmor.get_armor in custom_hud returned with false!")
@ -135,7 +135,7 @@ minetest.register_globalstep(function(dtime)
main_timer = main_timer + dtime main_timer = main_timer + dtime
timer = timer + dtime timer = timer + dtime
if main_timer > hbarmor.tick or timer > 4 then if main_timer > hbarmor.tick or timer > 4 then
if minetest.setting_getbool("enable_damage") then if minetest.settings:get_bool("enable_damage") then
if main_timer > hbarmor.tick then main_timer = 0 end if main_timer > hbarmor.tick then main_timer = 0 end
for _,player in ipairs(minetest.get_connected_players()) do for _,player in ipairs(minetest.get_connected_players()) do
local name = player:get_player_name() local name = player:get_player_name()