Fix node protection

master
rubenwardy 2015-07-14 12:41:30 +01:00
parent 613334fcd4
commit b58ed038c3
2 changed files with 12 additions and 2 deletions

View File

@ -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

View File

@ -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