]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Display the number of rounds won as hunter or survivor in the scoreboard
authorMario <mario.mario@y7mail.com>
Mon, 13 Jul 2020 19:16:01 +0000 (05:16 +1000)
committerMario <mario.mario@y7mail.com>
Mon, 13 Jul 2020 19:16:01 +0000 (05:16 +1000)
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/common/gamemodes/gamemode/survival/sv_survival.qc
qcsrc/common/gamemodes/gamemode/survival/sv_survival.qh
qcsrc/common/scores.qh

index 9999680200584e8374fee0bd66ddd78de3537148..abd91c5895a1548d2e489a4c77dfc09fa096ad2c 100644 (file)
@@ -118,6 +118,7 @@ string Label_getInfo(string label, int mode)
                case "fps":          if (!mode) return CTX(_("SCO^fps"));          else LOG_HELP(strcat("^3", "fps", "                ^7", _("FPS")));
                case "frags":        if (!mode) return CTX(_("SCO^frags"));        else LOG_HELP(strcat("^3", "frags", "              ^7", _("Number of kills minus suicides")));
                case "goals":        if (!mode) return CTX(_("SCO^goals"));        else LOG_HELP(strcat("^3", "goals", "              ^7", _("Number of goals scored")));
+               case "hunts":        if (!mode) return CTX(_("SCO^hunts"));        else LOG_HELP(strcat("^3", "hunts", "              ^7", _("Number of successful hunter rounds (Survival)")));
                case "kckills":      if (!mode) return CTX(_("SCO^kckills"));      else LOG_HELP(strcat("^3", "kckills", "            ^7", _("Number of keys carrier kills")));
                case "kd":           if (!mode) return CTX(_("SCO^k/d"));          else LOG_HELP(strcat("^3", "kd", "                 ^7", _("The kill-death ratio")));
                case "kdr":          if (!mode) return CTX(_("SCO^kdr"));          else LOG_HELP(strcat("^3", "kdr", "                ^7", _("The kill-death ratio")));
@@ -140,6 +141,7 @@ string Label_getInfo(string label, int mode)
                case "score":        if (!mode) return CTX(_("SCO^score"));        else LOG_HELP(strcat("^3", "score", "              ^7", _("Total score")));
                case "suicides":     if (!mode) return CTX(_("SCO^suicides"));     else LOG_HELP(strcat("^3", "suicides", "           ^7", _("Number of suicides")));
                case "sum":          if (!mode) return CTX(_("SCO^sum"));          else LOG_HELP(strcat("^3", "sum", "                ^7", _("Number of kills minus deaths")));
+               case "survivals":    if (!mode) return CTX(_("SCO^survivals"));    else LOG_HELP(strcat("^3", "survivals", "          ^7", _("Number of rounds survived (Survival)")));
                case "takes":        if (!mode) return CTX(_("SCO^takes"));        else LOG_HELP(strcat("^3", "takes", "              ^7", _("Number of domination points taken (Domination)")));
                case "teamkills":    if (!mode) return CTX(_("SCO^teamkills"));    else LOG_HELP(strcat("^3", "teamkills", "          ^7", _("Number of teamkills")));
                case "ticks":        if (!mode) return CTX(_("SCO^ticks"));        else LOG_HELP(strcat("^3", "ticks", "              ^7", _("Number of ticks (Domination)")));
@@ -378,6 +380,7 @@ void Cmd_Scoreboard_Help()
 " +as/objectives +nb/faults +nb/goals" \
 " +ka/pickups +ka/bckills +ka/bctime +ft/revivals" \
 " +dom/ticks +dom/takes" \
+" +surv/survivals +surv/hunts" \
 " -lms,rc,cts,inv,nb/score"
 
 void Cmd_Scoreboard_SetFields(int argc)
index f29c6b72a57c14a6bc46fcb97e5f873e03952793..b7516d8d27ec661f5a24783f30ecfbafea2f97ac 100644 (file)
@@ -30,8 +30,16 @@ void Surv_UpdateScores(bool timed_out)
                if(it.survival_validkills)
                        GameRules_scoring_add(it, SCORE, it.survival_validkills);
                it.survival_validkills = 0;
-               if(autocvar_g_survival_reward_survival && timed_out && IS_PLAYER(it) && !IS_DEAD(it) && it.survival_status == SURV_STATUS_PREY)
-                       GameRules_scoring_add(it, SCORE, 1); // reward survivors who make it to the end of the round time limit
+               // player survived the round
+               if(IS_PLAYER(it) && !IS_DEAD(it))
+               {
+                       if(autocvar_g_survival_reward_survival && timed_out && it.survival_status == SURV_STATUS_PREY)
+                               GameRules_scoring_add(it, SCORE, 1); // reward survivors who make it to the end of the round time limit
+                       if(it.survival_status == SURV_STATUS_PREY)
+                               GameRules_scoring_add(it, SURV_SURVIVALS, 1);
+                       else if(it.survival_status == SURV_STATUS_HUNTER)
+                               GameRules_scoring_add(it, SURV_HUNTS, 1);
+               }
        });
 }
 
@@ -181,6 +189,11 @@ bool surv_isEliminated(entity e)
 
 void surv_Initialize() // run at the start of a match, initiates game mode
 {
+       GameRules_scoring(0, SFL_SORT_PRIO_PRIMARY, 0, {
+               field(SP_SURV_SURVIVALS, "survivals", 0);
+               field(SP_SURV_HUNTS, "hunts", SFL_SORT_PRIO_SECONDARY);
+       });
+
        allowed_to_spawn = true;
        round_handler_Spawn(Surv_CheckPlayers, Surv_CheckWinner, Surv_RoundStart);
        round_handler_Init(5, autocvar_g_survival_warmup, autocvar_g_survival_round_timelimit);
index ad68f02bf922812fb00ed076b09017803caf4206..129410a5af77345887bad7d769d740c8b136f44b 100644 (file)
@@ -9,9 +9,6 @@ REGISTER_MUTATOR(surv, false)
     MUTATOR_STATIC();
        MUTATOR_ONADD
        {
-           GameRules_scoring(0, SFL_SORT_PRIO_PRIMARY, 0, {
-        });
-
                surv_Initialize();
        }
        return false;
index 3bc6c55636c65fa4e3875d0bf2b328e0f3a0aa02..5e339e4caa75aea1a3627e962813f417b8389fbd 100644 (file)
@@ -85,6 +85,9 @@ REGISTER_SP(NEXBALL_FAULTS);
 
 REGISTER_SP(ONS_TAKES);
 REGISTER_SP(ONS_CAPS);
+
+REGISTER_SP(SURV_SURVIVALS);
+REGISTER_SP(SURV_HUNTS);
 #endif