]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/mutator/gamemode_invasion.qc
improve descriptions, add missing cvar to config
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator / gamemode_invasion.qc
index b7aa99498557c6035d0b3ed0be46e79d5d1448e5..1b8b77ae078158e566fb34a87c754701436175d3 100644 (file)
@@ -76,6 +76,8 @@ spawnfunc(invasion_spawnpoint)
        IL_PUSH(g_invasion_spawns, this);
 }
 
+void ClearWinners();
+
 // Invasion stage mode winning condition: If the attackers triggered a round end (by fulfilling all objectives)
 // they win.
 int WinningCondition_Invasion()
@@ -344,7 +346,7 @@ bool Invasion_CheckWinner()
        else
        {
                FOREACH_CLIENT(IS_PLAYER(it), {
-                       float cs = PlayerScore_Add(it, SP_KILLS, 0);
+                       float cs = GameRules_scoring_add(it, KILLS, 0);
                        if(cs > winning_score)
                        {
                                winning_score = cs;
@@ -428,10 +430,10 @@ MUTATOR_HOOKFUNCTION(inv, MonsterDies)
 
                if(IS_PLAYER(frag_attacker))
                if(SAME_TEAM(frag_attacker, frag_target)) // in non-teamplay modes, same team = same player, so this works
-                       PlayerScore_Add(frag_attacker, SP_KILLS, -1);
+                       GameRules_scoring_add(frag_attacker, KILLS, -1);
                else
                {
-                       PlayerScore_Add(frag_attacker, SP_KILLS, +1);
+                       GameRules_scoring_add(frag_attacker, KILLS, +1);
                        if(teamplay)
                                TeamScore_AddToTeam(frag_attacker.team, ST_INV_KILLS, +1);
                }
@@ -558,10 +560,13 @@ MUTATOR_HOOKFUNCTION(inv, AllowMobButcher)
 void invasion_ScoreRules(int inv_teams)
 {
        if(inv_teams) { CheckAllowedTeams(NULL); }
-       ScoreRules_basics(inv_teams, 0, 0, false);
-       if(inv_teams) ScoreInfo_SetLabel_TeamScore(ST_INV_KILLS, "frags", SFL_SORT_PRIO_PRIMARY);
-       ScoreInfo_SetLabel_PlayerScore(SP_KILLS, "frags", ((inv_teams) ? SFL_SORT_PRIO_SECONDARY : SFL_SORT_PRIO_PRIMARY));
-       ScoreRules_basics_end();
+       GameRules_score_enabled(false);
+       GameRules_scoring(inv_teams, 0, 0, {
+           if (inv_teams) {
+            field_team(ST_INV_KILLS, "frags", SFL_SORT_PRIO_PRIMARY);
+           }
+           field(SP_KILLS, "frags", ((inv_teams) ? SFL_SORT_PRIO_SECONDARY : SFL_SORT_PRIO_PRIMARY));
+       });
 }
 
 void invasion_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up.
@@ -571,14 +576,7 @@ void invasion_DelayedInit(entity this) // Do this check with a delay so we can w
 
        if(autocvar_g_invasion_teams)
        {
-               invasion_teams = bound(2, autocvar_g_invasion_teams, 4);
-               int teams = 0;
-               if(invasion_teams >= 1) teams |= BIT(0);
-               if(invasion_teams >= 2) teams |= BIT(1);
-               if(invasion_teams >= 3) teams |= BIT(2);
-               if(invasion_teams >= 4) teams |= BIT(3);
-
-               invasion_teams = teams; // now set it?
+               invasion_teams = BITS(bound(2, autocvar_g_invasion_teams, 4));
        }
        else
                invasion_teams = 0;