From: Mario Date: Sat, 12 Mar 2016 00:41:33 +0000 (+1000) Subject: Disable spawning near teammates if a team has only 1 player X-Git-Tag: xonotic-v0.8.2~1123 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=63a87da8be82094c6c14db660bd71f4cc7625c52;p=xonotic%2Fxonotic-data.pk3dir.git Disable spawning near teammates if a team has only 1 player --- diff --git a/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc b/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc index af42a487a..c08722d36 100644 --- a/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc +++ b/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc @@ -51,6 +51,22 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, Spawn_Score) MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn) {SELFPARAM(); if(!teamplay) { return false; } + + int num_red = 0, num_blue = 0, num_yellow = 0, num_pink = 0; + FOREACH_CLIENT(IS_PLAYER(it), + { + switch(it.team) + { + case NUM_TEAM_1: ++num_red; break; + case NUM_TEAM_2: ++num_blue; break; + case NUM_TEAM_3: ++num_yellow; break; + case NUM_TEAM_4: ++num_pink; break; + } + }); + + if(num_red == 1 || num_blue == 1 || num_yellow == 1 || num_pink == 1) + return false; // at least 1 team has only 1 player, let's not give the bigger team too much of an advantage! + // Note: when entering this, fixangle is already set. if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && self.cvar_cl_spawn_near_teammate)) {