]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Survival: Switched to new FindBestTeams event.
authorLyberta <lyberta@lyberta.net>
Thu, 15 Jun 2017 01:01:56 +0000 (04:01 +0300)
committerLyberta <lyberta@lyberta.net>
Thu, 15 Jun 2017 01:01:56 +0000 (04:01 +0300)
qcsrc/server/mutators/mutator/gamemode_survival.qc

index 18dd43b52b7e87248d8bf8374ab8ef9ba2b15449..e78e9e5cf3cfc18afdbfbf1e81f1d2bcfad3bfb8 100644 (file)
@@ -1760,17 +1760,17 @@ MUTATOR_HOOKFUNCTION(surv, GetTeamCount, CBC_ORDER_EXCLUSIVE)
        return true;
 }
 
-/// \brief Hook that determines the best team for the player to join.
-MUTATOR_HOOKFUNCTION(surv, JoinBestTeam, CBC_ORDER_EXCLUSIVE)
+/// \brief Hook that determines the best teams for the player to join.
+MUTATOR_HOOKFUNCTION(surv, FindBestTeams, CBC_ORDER_EXCLUSIVE)
 {
        if (surv_type == SURVIVAL_TYPE_COOP)
        {
-               return;
+               return false;
        }
        entity player = M_ARGV(0, entity);
        if (IS_BOT_CLIENT(player))
        {
-               return;
+               return false;
        }
        int numattackerhumans = surv_numattackerhumans;
        int numdefenderhumans = surv_numdefenderhumans;
@@ -1784,15 +1784,16 @@ MUTATOR_HOOKFUNCTION(surv, JoinBestTeam, CBC_ORDER_EXCLUSIVE)
        }
        if (numattackerhumans < numdefenderhumans)
        {
-               M_ARGV(1, float) = Team_TeamToNumber(surv_attackerteam);
-               return;
+               M_ARGV(1, float) = BIT(Team_TeamToNumber(surv_attackerteam) - 1);
+               return true;
        }
        if (numattackerhumans > numdefenderhumans)
        {
-               M_ARGV(1, float) = Team_TeamToNumber(surv_defenderteam);
-               return;
+               M_ARGV(1, float) = BIT(Team_TeamToNumber(surv_defenderteam) - 1);
+               return true;
        }
-       M_ARGV(1, float) = floor(random() * 2) + 1;
+       M_ARGV(1, float) = SURVIVAL_TEAM_BITS;
+       return true;
 }
 
 /// \brief Hook that is called when player has changed the team.