diff --git a/mods/capturetheflag/ctf/core.lua b/mods/capturetheflag/ctf/core.lua index 44b4b2a..297a67f 100644 --- a/mods/capturetheflag/ctf/core.lua +++ b/mods/capturetheflag/ctf/core.lua @@ -53,9 +53,16 @@ end function ctf.setting(name) local set = minetest.setting_get("ctf_"..name) + local dset = ctf._defsettings[name] if set ~= nil then - return set - elseif ctf._defsettings[name] ~= nil then + if type(dset) == "number" then + return tonumber(set) + elseif type(dset) == "bool" then + return minetest.is_yes(set) + else + return set + end + elseif dset ~= nil then return ctf._defsettings[name] else print("[CaptureTheFlag] Setting "..name.." not found!") @@ -63,11 +70,6 @@ function ctf.setting(name) end end -function ctf.setting_bool(name) - local set = ctf.setting(name) - return minetest.is_yes(set) -end - function ctf.load() local file = io.open(minetest.get_worldpath().."/ctf.txt", "r") if file then @@ -167,7 +169,7 @@ function ctf.join(name, team, force) if ctf.add_user(team, player) == true then minetest.chat_send_all(name.." has joined team "..team) - if ctf.setting_bool("hud") then + if ctf.setting("hud") then ctf.hud.update(minetest.get_player_by_name(name)) end diff --git a/mods/capturetheflag/ctf/hud.lua b/mods/capturetheflag/ctf/hud.lua index 8ca39ec..e0909d4 100644 --- a/mods/capturetheflag/ctf/hud.lua +++ b/mods/capturetheflag/ctf/hud.lua @@ -93,7 +93,7 @@ local count = 0 function ctf.hud.updateAll() count = 0 - if not ctf.setting_bool("hud") then + if not ctf.setting("hud") then return end