]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Implement mapload specific lifetime of notification entities (plus cvar
authorSamual Lenks <samual@xonotic.org>
Wed, 27 Feb 2013 02:14:08 +0000 (21:14 -0500)
committerSamual Lenks <samual@xonotic.org>
Wed, 27 Feb 2013 02:14:08 +0000 (21:14 -0500)
it)

qcsrc/common/notifications.qc
qcsrc/common/notifications.qh

index 88c2d71b18267dd78fad7c9ff74bce3e76e4293f..1fc3a052147027085ff0db9f5af0efb9203a86a3 100644 (file)
@@ -190,6 +190,8 @@ void Dump_Notifications(float fh, float alsoprint)
        NOTIF_WRITE("seta notification_ctf_pickup_enemy_verbose 1 \"Show extra information if an enemy picks up a flag\"\n");
        NOTIF_WRITE("seta notification_ctf_capture_verbose 1 \"Show extra information when someone captures a flag\"\n");
        NOTIF_WRITE("seta notification_frag_verbose 1 \"Show extra information when you frag someone (or when you are fragged\"\n");
+       NOTIF_WRITE("seta notification_lifetime_runtime 0.5 \"Amount of time that notification entities last on the server during runtime (In seconds)\"\n");
+       NOTIF_WRITE("seta notification_lifetime_mapload 10 \"Amount of time that notification entities last immediately at mapload (in seconds) to help prevent notifications from being lost on early init (like gamestart countdown)\"\n");
 
        NOTIF_WRITE(sprintf("\n// Notification counts (total = %d): MSG_INFO = %d, MSG_CENTER = %d, MSG_WEAPON = %d, MSG_DEATH = %d\n",
                (NOTIF_INFO_COUNT + NOTIF_CENTER_COUNT + NOTIF_WEAPON_COUNT + NOTIF_DEATH_COUNT), 
@@ -616,7 +618,7 @@ void Kill_Notification(float broadcast, entity client, float net_type, float net
                notif.nent_client = client;
                notif.nent_net_type = MSG_CENTER_KILL;
                notif.nent_net_name = net_name;
-               Net_LinkEntity(notif, FALSE, 0.5, Net_Write_Notification);
+               Net_LinkEntity(notif, FALSE, autocvar_notification_lifetime_runtime, Net_Write_Notification);
        }
 
        for(notif = world; (notif = find(notif, classname, "net_notification"));)
@@ -697,9 +699,11 @@ void Send_Notification(float broadcast, entity client,
        float i;
        for(i = 0; i < net_notif.nent_stringcount; ++i) { net_notif.nent_strings[i] = strzone(...(i, string)); }
        for(i = 0; i < net_notif.nent_floatcount; ++i) { net_notif.nent_floats[i] = ...((net_notif.nent_stringcount + i), float); }
-       
+
        net_notif.think = Net_Notification_Remove;
-       net_notif.nextthink = (time + 0.5); 
+       net_notif.nextthink = ((time > autocvar_notification_lifetime_mapload) ?
+                       (time + autocvar_notification_lifetime_runtime) :
+                       autocvar_notification_lifetime_mapload); 
 
        Net_LinkEntity(net_notif, FALSE, 0, Net_Write_Notification);
 
index c9db63c1520ae475527353e058df95376f2768b2..9529720028d9981198d5f0f85f7225de76f6d22e 100644 (file)
@@ -7,7 +7,7 @@
 #define MSG_INFO 1 // "Global" information messages (sent to console, and notify panel if it has an icon)
 #define MSG_CENTER 2 // "Personal" centerprint messages
 #define MSG_CENTER_KILL 3 // Kill centerprint message
-#define MSG_WEAPON 4 // "Personal" weapon messages (like "You got the Nex", sent to weapon notify panel)
+#define MSG_WEAPON 4 // "Global" weapon messages 
 #define MSG_DEATH 5 // "Personal" AND "Global" death messages 
 
 #define NO_MSG -12345 
@@ -556,6 +556,8 @@ var float autocvar_notification_show_sprees_info = 3; // 0 = off, 1 = target onl
 var float autocvar_notification_show_sprees_info_newline = FALSE;
 var float autocvar_notification_show_sprees_info_specialonly = TRUE;
 var float autocvar_notification_errors_are_fatal = TRUE;
+var float autocvar_notification_lifetime_runtime = 0.5;
+var float autocvar_notification_lifetime_mapload = 10;
 
 #ifdef SVQC
 .float FRAG_VERBOSE;