From 63a87da8be82094c6c14db660bd71f4cc7625c52 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 12 Mar 2016 10:41:33 +1000 Subject: [PATCH] Disable spawning near teammates if a team has only 1 player --- .../spawn_near_teammate/spawn_near_teammate.qc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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)) { -- 2.39.2