]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/scores.qc
add number of free player slots to the statusResponse
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / scores.qc
index 2c5e2b14490498ef2f8190f3530c92e77e450796..b2b0a138f1d964782c45731c157e7bda15e9a695 100644 (file)
@@ -150,6 +150,11 @@ void ScoreInfo_SetLabel_PlayerScore(float i, string label, float scoreflags)
                scores_primary = scores[i];
                scores_flags_primary = scoreflags;
        }
+       if(label != "")
+       {
+               PlayerStats_AddEvent(strcat(PLAYERSTATS_TOTAL, label));
+               PlayerStats_AddEvent(strcat(PLAYERSTATS_SCOREBOARD, label));
+       }
 }
 
 void ScoreInfo_SetLabel_TeamScore(float i, string label, float scoreflags)
@@ -245,6 +250,7 @@ void PlayerScore_Clear(entity player)
 
        if(teamscores_entities_count)
                return;
+
        if(g_lms) return;
        if(g_arena || g_ca) return;
        if(g_race && !g_race_qualifying) return;
@@ -330,6 +336,8 @@ float PlayerScore_Add(entity player, float scorefield, float score)
        if(score)
                if(scores_label[scorefield] != "")
                        s.SendFlags |= pow(2, scorefield);
+       PlayerStats_Event(s.owner, strcat(PLAYERSTATS_TOTAL, scores_label[scorefield]), score);
+       s.(scores_accumulated[scorefield]) += score;
        return (s.(scores[scorefield]) += score);
 }
 
@@ -366,10 +374,18 @@ void WinningConditionHelper()
        entity winnerscorekeeper;
        entity secondscorekeeper;
        entity sk;
+       float slots;
+
+       // format:
+       // gametype:P<pure>:S<slots>::plabel,plabel:tlabel,tlabel:teamid:tscore,tscore:teamid:tscore,tscore
+       // score labels always start with a symbol or with lower case
+       // so to match pure, match for :P0:
+       // to match full, match for :S0:
 
        s = GetGametype();
        s = strcat(s, ":", autocvar_g_xonoticversion);
        s = strcat(s, ":P", ftos(cvar_purechanges_count));
+       s = strcat(s, ":S", ftos(nJoinAllowed(0)));
        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;
@@ -864,3 +880,14 @@ void Score_NicePrint(entity to)
        }
 }
 
+void PlayerScore_PlayerStats(entity p)
+{
+       entity s;
+       float i;
+       s = p.scorekeeper;
+
+       for(i = 0; i < MAX_SCORE; ++i)
+               if(s.(scores[i]) != 0)
+                       if(scores_label[i] != "")
+                               PlayerStats_Event(s.owner, strcat(PLAYERSTATS_SCOREBOARD, scores_label[i]), s.(scores[i]));
+}