2015-07-17 17:10:17 +00:00
|
|
|
ctf_match = {}
|
|
|
|
|
|
|
|
local claimed = ctf_flag.collect_claimed()
|
|
|
|
for i, flag in pairs(claimed) do
|
|
|
|
flag.claimed = nil
|
|
|
|
end
|
|
|
|
|
2015-11-22 20:07:41 +00:00
|
|
|
dofile(minetest.get_modpath("ctf_match") .. "/matches.lua")
|
2015-11-28 00:56:10 +00:00
|
|
|
dofile(minetest.get_modpath("ctf_match") .. "/buildtime.lua")
|
2015-11-22 20:07:41 +00:00
|
|
|
dofile(minetest.get_modpath("ctf_match") .. "/reset.lua")
|
2015-07-17 17:10:17 +00:00
|
|
|
dofile(minetest.get_modpath("ctf_match") .. "/chat.lua")
|
|
|
|
dofile(minetest.get_modpath("ctf_match") .. "/vote.lua")
|
2015-11-22 20:07:41 +00:00
|
|
|
|
|
|
|
ctf.register_on_init(function()
|
|
|
|
ctf._set("match.remove_player_on_leave", false)
|
|
|
|
end)
|
|
|
|
|
2018-01-09 03:15:44 +00:00
|
|
|
ctf_match.register_on_build_time_end(function()
|
|
|
|
minetest.sound_play({name="ctf_match_attack"}, { gain = 1.0 })
|
|
|
|
end)
|
|
|
|
|
2015-11-22 20:07:41 +00:00
|
|
|
minetest.register_on_leaveplayer(function(player)
|
|
|
|
if ctf.setting("match.remove_player_on_leave") then
|
|
|
|
ctf.remove_player(player:get_player_name())
|
|
|
|
end
|
|
|
|
end)
|
2016-04-04 21:26:47 +00:00
|
|
|
|
|
|
|
if minetest.global_exists("irc") then
|
|
|
|
ctf_match.register_on_winner(function(winner)
|
|
|
|
if not irc.connected then return end
|
|
|
|
irc:say("Team " .. winner .. " won!")
|
|
|
|
end)
|
|
|
|
|
|
|
|
ctf.register_on_new_game(function()
|
|
|
|
if not irc.connected then return end
|
|
|
|
irc:say("Next round!")
|
|
|
|
end)
|
|
|
|
end
|
2017-10-12 18:28:36 +00:00
|
|
|
|
|
|
|
minetest.after(5, function()
|
|
|
|
ctf_match.next()
|
|
|
|
end)
|