]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/scores.qc
Remove individual weapon.qh files, make it compile
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / scores.qc
index eb305e72203d48462e505a7a9261622660a5f2f1..0769a4f038021e85b09ebabb757090c482de98a6 100644 (file)
@@ -171,6 +171,11 @@ void ScoreInfo_SetLabel_TeamScore(float i, string label, float scoreflags)
                teamscores_primary = teamscores[i];
                teamscores_flags_primary = scoreflags;
        }
+       if(label != "")
+       {
+               PlayerStats_AddEvent(strcat(PLAYERSTATS_TOTAL, label));
+               PlayerStats_AddEvent(strcat(PLAYERSTATS_SCOREBOARD, label));
+       }
 }
 
 float ScoreInfo_SendEntity(entity to, float sf)
@@ -256,8 +261,8 @@ float PlayerScore_Clear(entity player)
        if(teamscores_entities_count)
                return 0;
 
-       if(g_lms) return 0;
-       if(g_arena || g_ca) return 0;
+       if(MUTATOR_CALLHOOK(ForbidPlayerScore_Clear)) return 0;
+
        if(g_cts) return 0; // in CTS, you don't lose score by observing
        if(g_race && g_race_qualifying) return 0; // in qualifying, you don't lose score by observing
 
@@ -393,15 +398,15 @@ void WinningConditionHelper()
        // so to match pure, match for :P0:
        // to match full, match for :S0:
 
+       fullstatus = autocvar_g_full_getstatus_responses;
+
        s = GetGametype();
        s = strcat(s, ":", autocvar_g_xonoticversion);
        s = strcat(s, ":P", ftos(cvar_purechanges_count));
        s = strcat(s, ":S", ftos(nJoinAllowed(world)));
        s = strcat(s, ":F", ftos(serverflags));
        s = strcat(s, ":M", modname);
-       s = strcat(s, "::", GetPlayerScoreString(world, 1)); // make this 1 once we can, note: this doesn't contain any :<letter>
-
-       fullstatus = autocvar_g_full_getstatus_responses;
+       s = strcat(s, "::", GetPlayerScoreString(world, (fullstatus ? 1 : 2)));
 
        if(teamscores_entities_count)
        {
@@ -523,16 +528,16 @@ void WinningConditionHelper()
                if(fullstatus)
                {
                        s = GetPlayerScoreString(p, 1);
-                       if(clienttype(p) == CLIENTTYPE_REAL)
+                       if(IS_REAL_CLIENT(p))
                                s = strcat(s, ":human");
                        else
                                s = strcat(s, ":bot");
-                       if(p.classname != "player" && !g_arena && !g_ca && !g_lms)
+                       if(!IS_PLAYER(p) && !g_arena && p.caplayer != 1 && !g_lms)
                                s = strcat(s, ":spectator");
                }
                else
                {
-                       if(p.classname == "player" || g_arena || g_ca || g_lms)
+                       if(IS_PLAYER(p) || g_arena || p.caplayer == 1 || g_lms)
                                s = GetPlayerScoreString(p, 2);
                        else
                                s = "-666";
@@ -622,7 +627,7 @@ string GetTeamScoreString(float tm, float shortString)
        if(tm == 0)
        {
                // label
-               for(i = 0; i < MAX_SCORE; ++i)
+               for(i = 0; i < MAX_TEAMSCORE; ++i)
                        if(teamscores_flags[i] & SFL_SORT_PRIO_MASK == SFL_SORT_PRIO_PRIMARY)
                        {
                                f = teamscores_flags[i];
@@ -630,7 +635,7 @@ string GetTeamScoreString(float tm, float shortString)
                                out = strcat(out, GetScoreLogLabel(l, f), ",");
                        }
                if(shortString < 2)
-               for(i = 0; i < MAX_SCORE; ++i)
+               for(i = 0; i < MAX_TEAMSCORE; ++i)
                        if(teamscores_flags[i] & SFL_SORT_PRIO_MASK == SFL_SORT_PRIO_SECONDARY)
                        {
                                f = teamscores_flags[i];
@@ -638,7 +643,7 @@ string GetTeamScoreString(float tm, float shortString)
                                out = strcat(out, GetScoreLogLabel(l, f), ",");
                        }
                if(shortString < 1)
-               for(i = 0; i < MAX_SCORE; ++i)
+               for(i = 0; i < MAX_TEAMSCORE; ++i)
                        if(teamscores_flags[i] & SFL_SORT_PRIO_MASK != SFL_SORT_PRIO_PRIMARY)
                        if(teamscores_flags[i] & SFL_SORT_PRIO_MASK != SFL_SORT_PRIO_SECONDARY)
                        {
@@ -894,7 +899,7 @@ void Score_NicePrint(entity to)
        
        t = 0;
        FOR_EACH_CLIENT(p)
-       if(p.classname != "player")
+       if not(IS_PLAYER(p))
        {
                if not(t)
                        Score_NicePrint_Spectators(to);
@@ -927,6 +932,7 @@ void PlayerScore_TeamStats(void)
                for(i = 0; i < MAX_TEAMSCORE; ++i)
                        if(sk.(teamscores[i]) != 0)
                                if(teamscores_label[i] != "")
-                                       PlayerStats_TeamScore(t, strcat(PLAYERSTATS_SCOREBOARD, teamscores_label[i]), sk.(teamscores[i]));
+                                       // the +1 is important here!
+                                       PlayerStats_TeamScore(t+1, strcat(PLAYERSTATS_SCOREBOARD, teamscores_label[i]), sk.(teamscores[i]));
        }
 }