Add delay between win and map reset

This commit is contained in:
rubenwardy 2015-12-03 22:27:22 +00:00
parent da99f29b2b
commit a77431fba1

View file

@ -34,6 +34,7 @@ function ctf_match.next()
end end
-- Check for winner -- Check for winner
local game_won = false
function ctf_match.check_for_winner() function ctf_match.check_for_winner()
local winner local winner
for name, team in pairs(ctf.teams) do for name, team in pairs(ctf.teams) do
@ -44,14 +45,20 @@ function ctf_match.check_for_winner()
end end
-- There is a winner! -- There is a winner!
if not game_won then
game_won = true
ctf.action("match", winner .. " won!") ctf.action("match", winner .. " won!")
minetest.chat_send_all("Team " .. winner .. " won!") minetest.chat_send_all("Team " .. winner .. " won!")
for i = 1, #ctf_match.registered_on_winner do for i = 1, #ctf_match.registered_on_winner do
ctf_match.registered_on_winner[i](winner) ctf_match.registered_on_winner[i](winner)
end end
minetest.after(2, function()
game_won = false
if ctf.setting("match") then if ctf.setting("match") then
ctf_match.next() ctf_match.next()
end end
end)
end
end end
ctf.register_on_new_game(function() ctf.register_on_new_game(function()