]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make best pings green, good pings yellow, medium pings orange and worst pings red...
authorz411 <z411@omaera.org>
Fri, 19 May 2023 14:04:52 +0000 (14:04 +0000)
committerLegendaryGuard <rootuser999@gmail.com>
Fri, 19 May 2023 14:04:52 +0000 (14:04 +0000)
_hud_common.cfg
qcsrc/client/hud/panel/scoreboard.qc

index da4be22b3ae1107a4dee71eecf1186327bcc840f..76d4480e5a7672a9e79e3c913030f91900b25f64 100644 (file)
@@ -143,6 +143,14 @@ seta hud_panel_scoreboard_spectators_aligned 0 "align spectators in columns"
 seta hud_panel_scoreboard_spectators_position 1 "spectator list position (0 = before accuracy and itemstats, 1 = before rankings, 2 = after rankings, 3 = after map stats)"
 seta hud_panel_scoreboard_minwidth 0.6 "minimum width of the scoreboard"
 seta hud_panel_scoreboard_team_size_position 0 "where to show the team size (0 = do not show, 1 = left of scoreboard, 2 = right of scoreboard), will move team scores to the other side if necessary"
+seta hud_panel_scoreboard_ping_best_milliseconds 0 "the value for the best ping value"
+seta hud_panel_scoreboard_ping_medium_milliseconds_milliseconds 70 "the value for medium ping value"
+seta hud_panel_scoreboard_ping_high_milliseconds 100 "the value for high ping value"
+seta hud_panel_scoreboard_ping_worst_milliseconds 150 "the value for worst ping value"
+seta hud_panel_scoreboard_ping_best_color "0 1 0" "the color for best possible ping values"
+seta hud_panel_scoreboard_ping_med_color "1 1 0" "the color for medium ping values"
+seta hud_panel_scoreboard_ping_high_color "1 0.5 0" "the color for high ping values"
+seta hud_panel_scoreboard_ping_worst_color "1 0 0" "the color for worst ping values"
 seta hud_panel_scoreboard_playerid 0 "show player id (server entity number) next to player's name"
 seta hud_panel_scoreboard_playerid_prefix "#" "player id prefix"
 seta hud_panel_scoreboard_playerid_suffix " " "player id suffix"
index 566f5a695635fe93419460c58ba81ec955162345..6b5795c3aec8f7a4d92e198200a087e4922375ef 100644 (file)
@@ -982,6 +982,22 @@ string Scoreboard_GetName(entity pl)
        return entcs_GetName(pl.sv_entnum);
 }
 
+int autocvar_hud_panel_scoreboard_ping_best_milliseconds = 0;
+int autocvar_hud_panel_scoreboard_ping_medium_milliseconds = 70;
+int autocvar_hud_panel_scoreboard_ping_high_milliseconds = 100;
+int autocvar_hud_panel_scoreboard_ping_worst_milliseconds = 150;
+vector autocvar_hud_panel_scoreboard_ping_best_color = '0 1 0';
+vector autocvar_hud_panel_scoreboard_ping_medium_color = '1 1 0';
+vector autocvar_hud_panel_scoreboard_ping_high_color = '1 0.5 0';
+vector autocvar_hud_panel_scoreboard_ping_worst_color = '1 0 0';
+#define PING_BEST autocvar_hud_panel_scoreboard_ping_best_milliseconds
+#define PING_MED autocvar_hud_panel_scoreboard_ping_medium_milliseconds
+#define PING_HIGH autocvar_hud_panel_scoreboard_ping_high_milliseconds
+#define PING_WORST autocvar_hud_panel_scoreboard_ping_worst_milliseconds
+#define COLOR_BEST autocvar_hud_panel_scoreboard_ping_best_color
+#define COLOR_MED autocvar_hud_panel_scoreboard_ping_medium_color
+#define COLOR_HIGH autocvar_hud_panel_scoreboard_ping_high_color
+#define COLOR_WORST autocvar_hud_panel_scoreboard_ping_worst_color
 string Scoreboard_GetField(entity pl, PlayerScoreField field, bool per_round)
 {
        float tmp, num, denom;
@@ -1006,8 +1022,16 @@ string Scoreboard_GetField(entity pl, PlayerScoreField field, bool per_round)
                        f = pl.ping;
                        if(f == 0)
                                return _("N/A");
-                       tmp = max(0, min(220, f-80)) / 220;
-                       sbt_field_rgb = '1 1 1' - '0 1 1' * tmp;
+                       if(f < PING_BEST)
+                               sbt_field_rgb = COLOR_BEST;
+                       else if(f < PING_MED)
+                               sbt_field_rgb = COLOR_BEST + (COLOR_MED - COLOR_BEST) * ((f - PING_BEST) / (PING_MED - PING_BEST));
+                       else if(f < PING_HIGH)
+                               sbt_field_rgb = COLOR_MED + (COLOR_HIGH - COLOR_MED) * ((f - PING_MED) / (PING_HIGH - PING_MED));
+                       else if(f < PING_WORST)
+                               sbt_field_rgb = COLOR_HIGH + (COLOR_WORST - COLOR_HIGH) * ((f - PING_HIGH) / (PING_WORST - PING_HIGH));
+                       else
+                               sbt_field_rgb = COLOR_WORST;
                        return ftos(f);
 
                case SP_PL: