]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make pickup timer disableable
authorz411 <z411@omaera.org>
Wed, 21 Apr 2021 23:49:32 +0000 (19:49 -0400)
committerz411 <z411@omaera.org>
Wed, 21 Apr 2021 23:49:32 +0000 (19:49 -0400)
qcsrc/client/hud/panel/chat.qc
qcsrc/common/constants.qh
qcsrc/server/world.qc

index 6f3e78b3866f23fc77a2119539f0f814a78e8236..c87afc36c01429db31a3a90147dca988c21a3486 100644 (file)
@@ -3,7 +3,8 @@
 #include <client/draw.qh>
 #include <common/items/inventory.qh>
 
-bool autocvar_hud_itempickupdisplay = true; //LegendGuard adds a bool to enable/disable item pickup display HUD 06-04-2021
+bool autocvar_hud_panel_itempickup = true; //LegendGuard adds a bool to enable/disable item pickup display HUD 06-04-2021
+bool autocvar_hud_panel_itempickup_timer = true;
 
 // Chat (#12)
 
@@ -105,7 +106,7 @@ void HUD_Chat()
        }
        
        // z411 items
-       if (autocvar_hud_itempickupdisplay)
+       if (autocvar_hud_panel_itempickup)
        {
                float stat_last_pickup = STAT(LAST_PICKUP);
                pos.y += mySize.y;
@@ -121,7 +122,6 @@ void HUD_Chat()
                        icon = strcat(hud_skin_path, "/", ((it.model2) ? it.model2 : it.m_icon));
                        sz = draw_getimagesize(icon);
                        sz2 = vec2(iconsize.y*(sz.x/sz.y), iconsize.y);
-                       str1 = seconds_tostring(last_pickup_timer);
                        str2 = ((last_pickup_times > 1) ? sprintf("%s (x%d)", it.m_name, last_pickup_times) : it.m_name);
                        y = (iconsize.y - pickupsize.y) / 2;
                        
@@ -130,8 +130,14 @@ void HUD_Chat()
                        else
                                a = (stat_last_pickup + 3 - time) / 0.5;
                        
-                       drawstring(pos + eY * y, str1, pickupsize, '1 1 1', a, DRAWFLAG_NORMAL);
-                       pos.x += stringwidth(str1, false, pickupsize) + pickupsize.x * 0.25;
+                       if(autocvar_hud_panel_itempickup_timer) {
+                               if(spectatee_status || !(serverflags & SERVERFLAG_FORBID_PICKUPTIMER)) {
+                                       str1 = seconds_tostring(last_pickup_timer);
+                                       drawstring(pos + eY * y, str1, pickupsize, '1 1 1', a, DRAWFLAG_NORMAL);
+                                       pos.x += stringwidth(str1, false, pickupsize) + pickupsize.x * 0.25;
+                               }
+                       }
+                       
                        drawpic(pos, icon, sz2, '1 1 1', a, DRAWFLAG_NORMAL);
                        pos.x += sz2.x + pickupsize.x * 0.25;
                        drawstring(pos + eY * y, str2, pickupsize, '1 1 1', a, DRAWFLAG_NORMAL);
index 2c43d12d98ec3a178ef470fa0d09b962938e078e..43236b2b8517c1263bdb3700610110c7fad1d84a 100644 (file)
@@ -15,6 +15,7 @@ const int CVAR_READONLY = 4;
 const int SERVERFLAG_ALLOW_FULLBRIGHT = 1;
 const int SERVERFLAG_TEAMPLAY = 2;
 const int SERVERFLAG_PLAYERSTATS = 4;
+const int SERVERFLAG_FORBID_PICKUPTIMER = 8;
 
 const int SPECIES_HUMAN = 0;
 const int SPECIES_ROBOT_SOLID = 1;
index 18dd29a8b2ac7ff110df1a59fcfb7a613c5e2520..232c7f3bdb10d5ebe21c90a9a6c5d596f3bf2681 100644 (file)
@@ -2150,6 +2150,8 @@ void readlevelcvars()
 {
        if(cvar("sv_allow_fullbright"))
                serverflags |= SERVERFLAG_ALLOW_FULLBRIGHT;
+       if(cvar("sv_forbid_pickuptimer"))
+               serverflags |= SERVERFLAG_FORBID_PICKUPTIMER;
 
        sv_ready_restart_after_countdown = cvar("sv_ready_restart_after_countdown");