Fix node protection
This commit is contained in:
parent
613334fcd4
commit
b58ed038c3
@ -99,7 +99,6 @@ function ctf.init()
|
|||||||
ctf._set("allocate_mode", 0)
|
ctf._set("allocate_mode", 0)
|
||||||
ctf._set("maximum_in_team", -1)
|
ctf._set("maximum_in_team", -1)
|
||||||
ctf._set("default_diplo_state", "war")
|
ctf._set("default_diplo_state", "war")
|
||||||
ctf._set("node_ownership", true)
|
|
||||||
ctf._set("hud", true)
|
ctf._set("hud", true)
|
||||||
|
|
||||||
for i = 1, #ctf.registered_on_init do
|
for i = 1, #ctf.registered_on_init do
|
||||||
@ -142,7 +141,7 @@ function ctf.setting(name)
|
|||||||
if set ~= nil then
|
if set ~= nil then
|
||||||
if type(dset) == "number" then
|
if type(dset) == "number" then
|
||||||
return tonumber(set)
|
return tonumber(set)
|
||||||
elseif type(dset) == "bool" then
|
elseif type(dset) == "boolean" then
|
||||||
return minetest.is_yes(set)
|
return minetest.is_yes(set)
|
||||||
else
|
else
|
||||||
return set
|
return set
|
||||||
|
@ -1,7 +1,18 @@
|
|||||||
-- This mod is used to protect nodes in the capture the flag game
|
-- 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
|
local old_is_protected = minetest.is_protected
|
||||||
|
|
||||||
function minetest.is_protected(pos, name)
|
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)
|
local team = ctf.get_territory_owner(pos)
|
||||||
|
|
||||||
if not team or not ctf.team(team) then
|
if not team or not ctf.team(team) then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user