]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add "captime" score field for CTF, revealing captime to xonstat
authorSamual Lenks <samual@xonotic.org>
Thu, 6 Sep 2012 03:14:28 +0000 (23:14 -0400)
committerSamual Lenks <samual@xonotic.org>
Thu, 6 Sep 2012 03:14:28 +0000 (23:14 -0400)
qcsrc/client/scoreboard.qc
qcsrc/server/mutators/gamemode_ctf.qc
qcsrc/server/scores_rules.qc

index 69a296796108022624ef2b5a7bb65c4fb9a9634d..48a7217fc703a08b3b7f7fdfab3bc58efea36c2e 100644 (file)
@@ -19,6 +19,7 @@ string TranslateScoresLabel(string l)
                case "bckills": return CTX(_("SCO^bckills"));
                case "bctime": return CTX(_("SCO^bctime"));
                case "caps": return CTX(_("SCO^caps"));
+               case "captime": return CTX(_("SCO^captime"));
                case "deaths": return CTX(_("SCO^deaths"));
                case "destroyed": return CTX(_("SCO^destroyed"));
                case "drops": return CTX(_("SCO^drops"));
@@ -254,6 +255,7 @@ void Cmd_HUD_Help()
        print(_("^3kd^7                       The kill-death ratio\n"));
        print(_("^3caps^7                     How often a flag (CTF) or a key (KeyHunt) was captured\n"));
        print(_("^3pickups^7                  How often a flag (CTF) or a key (KeyHunt) or a ball (Keepaway) was picked up\n"));
+       print(_("^3captime^7                  Time of fastest cap (CTF)\n"));
        print(_("^3fckills^7                  Number of flag carrier kills\n"));
        print(_("^3returns^7                  Number of flag returns\n"));
        print(_("^3drops^7                    Number of flag drops\n"));
index 6cd8f95b5a83e9ad853e10470fb52d32d490870d..a12b769f1ad6e0d1cee4fd85a11061c0baf5ab65 100644 (file)
@@ -353,6 +353,7 @@ void ctf_Handle_Capture(entity flag, entity toucher, float capturetype)
 {
        entity enemy_flag = ((capturetype == CAPTURE_NORMAL) ? toucher.flagcarried : toucher);
        entity player = ((capturetype == CAPTURE_NORMAL) ? toucher : enemy_flag.ctf_dropper);
+       float old_time, new_time; 
        
        if not(player) { return; } // without someone to give the reward to, we can't possibly cap
        
@@ -371,6 +372,11 @@ void ctf_Handle_Capture(entity flag, entity toucher, float capturetype)
        PlayerTeamScore_AddScore(player, ctf_ReadScore("score_capture"));
        PlayerTeamScore_Add(player, SP_CTF_CAPS, ST_CTF_CAPS, 1);
 
+       old_time = PlayerScore_Add(player, SP_CTF_CAPTIME, 0);
+       new_time = TIME_ENCODE(time - enemy_flag.ctf_pickuptime);
+       if(!old_time || new_time < old_time)
+               PlayerScore_Add(player, SP_CTF_CAPTIME, new_time - old_time);
+
        // effects
        if(autocvar_g_ctf_flag_capture_effects) 
        {
index 806e2450792d356ff0c1298bcbdc53fefd614780..8266d4e3c4b55cf158def74ded2a15f4c2c42d79 100644 (file)
@@ -47,16 +47,18 @@ void ScoreRules_generic()
 // g_ctf
 #define ST_CTF_CAPS 1
 #define SP_CTF_CAPS 4
-#define SP_CTF_PICKUPS 5
-#define SP_CTF_DROPS 6
-#define SP_CTF_FCKILLS 7
-#define SP_CTF_RETURNS 8
+#define SP_CTF_CAPTIME 5
+#define SP_CTF_PICKUPS 6
+#define SP_CTF_DROPS 7
+#define SP_CTF_FCKILLS 8
+#define SP_CTF_RETURNS 9
 void ScoreRules_ctf()
 {
        CheckAllowedTeams(world);
-       ScoreRules_basics(2 + (c3>=0), SFL_SORT_PRIO_PRIMARY, 0, TRUE); // NOTE this assumes that the rogue team is team 3
+       ScoreRules_basics(2, SFL_SORT_PRIO_PRIMARY, 0, TRUE);
        ScoreInfo_SetLabel_TeamScore  (ST_CTF_CAPS,     "caps",      SFL_SORT_PRIO_PRIMARY);
        ScoreInfo_SetLabel_PlayerScore(SP_CTF_CAPS,     "caps",      SFL_SORT_PRIO_SECONDARY);
+       ScoreInfo_SetLabel_PlayerScore(SP_CTF_CAPTIME,  "captime",   SFL_LOWER_IS_BETTER | SFL_TIME);
        ScoreInfo_SetLabel_PlayerScore(SP_CTF_PICKUPS,  "pickups",   0);
        ScoreInfo_SetLabel_PlayerScore(SP_CTF_FCKILLS,  "fckills",   0);
        ScoreInfo_SetLabel_PlayerScore(SP_CTF_RETURNS,  "returns",   0);