Add ctf_pvp_engine mods directly in the repo

This commit is contained in:
rubenwardy 2019-08-28 16:50:33 +01:00
parent 1032a78a6c
commit a735266eb3
82 changed files with 3892 additions and 4 deletions

View file

@ -0,0 +1 @@
ctf

View file

@ -0,0 +1,28 @@
-- 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
return old_is_protected(pos, name)
end
if ctf.player(name).team == team then
return old_is_protected(pos, name)
else
minetest.chat_send_player(name, "You cannot dig on team "..team.."'s land")
return true
end
end