From: FruitieX Date: Tue, 16 Nov 2010 09:44:01 +0000 (+0200) Subject: some fixes X-Git-Tag: xonotic-v0.1.0preview~86^2~2^2~25 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=054c7bc8ea42db7175d9459e65d5d7f281e082f5;p=xonotic%2Fxonotic-data.pk3dir.git some fixes --- diff --git a/qcsrc/server/arena.qc b/qcsrc/server/arena.qc index dbd7e964b..b732c2f85 100644 --- a/qcsrc/server/arena.qc +++ b/qcsrc/server/arena.qc @@ -24,6 +24,12 @@ void func_breakable_reset(); 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. @@ -204,6 +210,17 @@ void Arena_Warmup() 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 @@ -268,11 +285,6 @@ void Arena_Warmup() 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 @@ -282,6 +294,15 @@ float redalive, bluealive, yellowalive, pinkalive; */ 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 @@ -300,7 +321,7 @@ void Spawnqueue_Check() } 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; @@ -318,13 +339,6 @@ void Spawnqueue_Check() 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)) { diff --git a/qcsrc/server/mutators/gamemode_freezetag.qc b/qcsrc/server/mutators/gamemode_freezetag.qc index ca8e78f7b..1e034b9ff 100644 --- a/qcsrc/server/mutators/gamemode_freezetag.qc +++ b/qcsrc/server/mutators/gamemode_freezetag.qc @@ -6,6 +6,9 @@ void freezetag_Initialize() 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) @@ -25,15 +28,14 @@ void freezetag_CheckWinner() 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) @@ -85,8 +87,6 @@ void freezetag_Unfreeze() { 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) @@ -103,6 +103,7 @@ void freezetag_Unfreeze() MUTATOR_HOOKFUNCTION(freezetag_RemovePlayer) { freezetag_CheckWinner(); + freezetag_Unfreeze(); return 1; } @@ -138,9 +139,6 @@ MUTATOR_HOOKFUNCTION(freezetag_PlayerDies) 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");