From a77431fba1f7cbafa8f58313dc3ed8c1db323143 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Thu, 3 Dec 2015 22:27:22 +0000 Subject: [PATCH] Add delay between win and map reset --- mods/ctf_match/matches.lua | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/mods/ctf_match/matches.lua b/mods/ctf_match/matches.lua index 93419a7..74d9d60 100644 --- a/mods/ctf_match/matches.lua +++ b/mods/ctf_match/matches.lua @@ -34,6 +34,7 @@ function ctf_match.next() end -- Check for winner +local game_won = false function ctf_match.check_for_winner() local winner for name, team in pairs(ctf.teams) do @@ -44,13 +45,19 @@ function ctf_match.check_for_winner() end -- There is a winner! - ctf.action("match", winner .. " won!") - minetest.chat_send_all("Team " .. winner .. " won!") - for i = 1, #ctf_match.registered_on_winner do - ctf_match.registered_on_winner[i](winner) - end - if ctf.setting("match") then - ctf_match.next() + if not game_won then + game_won = true + ctf.action("match", winner .. " won!") + minetest.chat_send_all("Team " .. winner .. " won!") + for i = 1, #ctf_match.registered_on_winner do + ctf_match.registered_on_winner[i](winner) + end + minetest.after(2, function() + game_won = false + if ctf.setting("match") then + ctf_match.next() + end + end) end end