]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Adding configurable timedown sound
authorz411 <z411@omaera.org>
Wed, 28 Jul 2021 22:17:53 +0000 (18:17 -0400)
committerz411 <z411@omaera.org>
Wed, 28 Jul 2021 22:23:57 +0000 (18:23 -0400)
qcsrc/client/hud/panel/timer.qc
qcsrc/client/main.qc
qcsrc/client/main.qh
qcsrc/server/client.qc
qcsrc/server/client.qh

index a4877660235a9526094e9e8f3e320b6b9664c6b3..08ff9e7360c46d61812e2d5f4ad8e6d3a3dff94d 100644 (file)
@@ -5,7 +5,7 @@
 
 // Timer (#5)
 float last_timeleft;
-bool autocvar_hud_panel_timer_count = true;
+int autocvar_cl_timer_countdown = 3; // 0 = disabled, 1 = always on, 2 = only spec, 3 = as dictated by server
 
 void HUD_Timer_Export(int fh)
 {
@@ -49,9 +49,18 @@ void HUD_Timer()
        timeleft = ceil(timeleft);
 
        // countdown sound
-       if(autocvar_hud_panel_timer_count && timeleft > 0 && timeleft != last_timeleft && timeleft <= 10)
+       // if 3 use server dictated option, otherwise the client's
+       int countdown_type;
+       if(autocvar_cl_timer_countdown == 3)
+               countdown_type = sv_timer_countdown;
+       else
+               countdown_type = autocvar_cl_timer_countdown;
+       
+       if(countdown_type && !warmup_stage && timeleft > 0 && timeleft != last_timeleft && timeleft <= 10)
        {
-               sound(NULL, CH_INFO, SND_ENDCOUNT, VOL_BASE, ATTN_NONE);
+               if(countdown_type == 1 || (countdown_type == 2 && spectatee_status))
+                       sound(NULL, CH_INFO, SND_ENDCOUNT, VOL_BASE, ATTN_NONE);
+               
                last_timeleft = timeleft;
        }
 
index 4d9f48ac511b546128bf96ddee31a823c75a230b..86b9c974f6022236eca9d948b50d35e0281fe512 100644 (file)
@@ -1063,6 +1063,8 @@ NET_HANDLE(ENT_CLIENT_INIT, bool isnew)
        
        strcpy(hostname_full, ReadString());
        strcpy(motd_permanent, ReadString());
+       
+       sv_timer_countdown = ReadByte();
 
        return = true;
 
index 1820fe369fe9841f61ef143c106720ef23d95fc7..9d0f6ef2d65353a7f0af704f7c3f671fce10f03e 100644 (file)
@@ -7,6 +7,7 @@
 // z411
 string hostname_full;
 string motd_permanent;
+int sv_timer_countdown;
 
 bool autocvar_cl_db_saveasdump;
 bool autocvar_cl_spawn_event_particles;
index d240077295d6f3cf50d7543ae530df5a6de8bdd5..4ac79f00ef73db66df82e77cd8519d730f13fa61 100644 (file)
@@ -898,6 +898,9 @@ void ClientInit_misc(entity this)
        // z411 send full hostname
        WriteString(channel, (autocvar_hostname_full != "" ? autocvar_hostname_full : autocvar_hostname));
        WriteString(channel, autocvar_sv_motd_permanent);
+       
+       // z411 send client countdown type
+       WriteByte(channel, autocvar_sv_timer_countdown);
 }
 
 void ClientInit_CheckUpdate(entity this)
index 4a358287a8be906de9a9506b8cad670096107b4a..ce2090e1184fde33c746cefca4cdcc4994cc5719 100644 (file)
@@ -65,6 +65,9 @@ string autocvar_g_teamnames_pink;
 // Medals
 float autocvar_g_medals_excellent_time = 2;
 
+// Timer
+int autocvar_sv_timer_countdown = 1; // 0 = disabled, 1 = enabled, 2 = spect only
+
 // WEAPONTODO
 .string weaponorder_byimpulse;