void assault_objective_reset();
void target_assault_roundend_reset();
+float next_round;
+float stopalivecheck;
+float redalive, bluealive, yellowalive, pinkalive;
+.float redalive_stat, bluealive_stat, yellowalive_stat, pinkalive_stat;
+float redspawned, bluespawned, yellowspawned, pinkspawned;
+
/**
* Resets the state of all clients, items, flags, runes, keys, weapons, waypoints, ... of the map.
* Sets the 'warmup' global variable.
if((!g_arena && !g_ca && !g_freezetag) || (g_arena && !arena_roundbased) || (time < game_starttime))
return;
+ if(g_freezetag &&
+ !((redspawned >= 1 && bluespawned >= 1)
+ || (redspawned >= 1 && yellowspawned >= 1)
+ || (redspawned >= 1 && pinkspawned >= 1)
+ || (bluespawned >= 1 && yellowspawned >= 1)
+ || (bluespawned >= 1 && pinkspawned >= 1)
+ || (yellowspawned >= 1 && pinkspawned >= 1)))
+ {
+ warmup = time + cvar("g_freezetag_warmup");
+ }
+
f = ceil(warmup - time);
if(f > 0)
champion = world; // this is done because a if(champion) will not execute if champion = world
if(self.classname == "player" && self.health > 0 && self.movetype == MOVETYPE_NONE)
self.movetype = MOVETYPE_WALK;
}
-
-float next_round;
-float stopalivecheck;
-float redalive, bluealive, yellowalive, pinkalive;
-.float redalive_stat, bluealive_stat, yellowalive_stat, pinkalive_stat;
/**
* This function finds out whether an arena round is over 1 player is left.
* It determines the last player who's still alive and saves it's entity reference
*/
void Spawnqueue_Check()
{
+ // check the amount of spawned players in each team
+ redspawned = bluespawned = yellowspawned = pinkspawned = 0;
+ FOR_EACH_PLAYER(self) {
+ if (self.team == COLOR_TEAM1) redspawned += 1;
+ else if (self.team == COLOR_TEAM2) bluespawned += 1;
+ else if (self.team == COLOR_TEAM3) yellowspawned += 1;
+ else if (self.team == COLOR_TEAM4) pinkspawned += 1;
+ }
+
if(g_ca) // we want to perform this before the return block below...
{
// this is STUPID to perform again, but has to be done so that we can give instant feedback when a round ends
}
else if(g_freezetag)
{
- redalive = 0; bluealive = 0;
+ redalive = bluealive = yellowalive = pinkalive = 0;
FOR_EACH_PLAYER(self) {
if (self.team == COLOR_TEAM1 && self.freezetag_frozen == 0 && self.health >= 1) redalive += 1;
else if (self.team == COLOR_TEAM2 && self.freezetag_frozen == 0 && self.health >= 1) bluealive += 1;
return;
if(g_ca) {
- // check the amount of spawned players in each team
- float redspawned, bluespawned;
- FOR_EACH_PLAYER(self) {
- if (self.team == COLOR_TEAM1) redspawned += 1;
- else if (self.team == COLOR_TEAM2) bluespawned += 1;
- }
-
required_ca_players = max(2, fabs(cvar("bot_vs_human") + 1));
if(ca_players < required_ca_players && (redspawned && bluespawned)) {
void freezetag_CheckWinner()
{
+ if(next_round)
+ return; // already waiting for next round to start
+
if((redalive >= 1 && bluealive >= 1) // counted in arena.qc
|| (redalive >= 1 && yellowalive >= 1)
|| (redalive >= 1 && pinkalive >= 1)
FOR_EACH_PLAYER(e)
{
- if(e.freezetag_frozen == 0) // here's one player from the winning team... good
+ if(e.freezetag_frozen == 0 && e.classname == "player" && e.health >= 1) // here's one player from the winning team... good
{
winner = e;
+ TeamScore_AddToTeam(winner.team, ST_SCORE, +1); // just in case a winner isn't found, we do this already here (causes crashes otherwise...)
break; // break, we found the winner
}
}
- TeamScore_AddToTeam(winner.team, ST_SCORE, +1);
-
if(winner.team == COLOR_TEAM1)
teamname = "^1Red Team";
else if(winner.team == COLOR_TEAM2)
{
self.freezetag_frozen = 0;
- self.movetype = MOVETYPE_WALK;
-
// remove the ice block
entity ice;
for(ice = world; (ice = find(ice, classname, "freezetag_ice")); ) if(ice.owner == self)
MUTATOR_HOOKFUNCTION(freezetag_RemovePlayer)
{
freezetag_CheckWinner();
+ freezetag_Unfreeze();
return 1;
}
MUTATOR_HOOKFUNCTION(freezetag_PlayerSpawn)
{
- if(redalive + bluealive + yellowalive + pinkalive == 1 && time > warmup)
- next_round = time; // start a new round immediately
-
if(time > warmup) // spawn too late, freeze player
{
centerprint(self, "^1You spawned after the round started, you'll spawn as frozen.\n");