From b58ed038c3f7e52bea45cb75d6a6f8a384c02006 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Tue, 14 Jul 2015 12:41:30 +0100 Subject: [PATCH] Fix node protection --- mods/capturetheflag/ctf/core.lua | 3 +-- mods/capturetheflag/ctf_protect/init.lua | 11 +++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/mods/capturetheflag/ctf/core.lua b/mods/capturetheflag/ctf/core.lua index e333241..7ab1824 100644 --- a/mods/capturetheflag/ctf/core.lua +++ b/mods/capturetheflag/ctf/core.lua @@ -99,7 +99,6 @@ function ctf.init() ctf._set("allocate_mode", 0) ctf._set("maximum_in_team", -1) ctf._set("default_diplo_state", "war") - ctf._set("node_ownership", true) ctf._set("hud", true) for i = 1, #ctf.registered_on_init do @@ -142,7 +141,7 @@ function ctf.setting(name) if set ~= nil then if type(dset) == "number" then return tonumber(set) - elseif type(dset) == "bool" then + elseif type(dset) == "boolean" then return minetest.is_yes(set) else return set diff --git a/mods/capturetheflag/ctf_protect/init.lua b/mods/capturetheflag/ctf_protect/init.lua index 746044b..25c3809 100644 --- a/mods/capturetheflag/ctf_protect/init.lua +++ b/mods/capturetheflag/ctf_protect/init.lua @@ -1,7 +1,18 @@ -- This mod is used to protect nodes in the capture the flag game +ctf.register_on_init(function() + ctf.log("chat", "Initialising...") + + -- Settings: Chat + ctf._set("node_ownership", true) +end) + local old_is_protected = minetest.is_protected function minetest.is_protected(pos, name) + if not ctf.setting("node_ownership") then + return old_is_protected(pos, name) + end + local team = ctf.get_territory_owner(pos) if not team or not ctf.team(team) then