Skip to content

Commit

Permalink
Add delay between win and map reset
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Dec 3, 2015
1 parent da99f29 commit a77431f
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions mods/ctf_match/matches.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

1 comment on commit a77431f

@ClobberXD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this delay? Even if the players are checking their scores, it's better if the map blocks are sent right away, so that they can rush for the chests during buildtime as their map would've loaded by then...

Please sign in to comment.