]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add server control cvars for location and frag_verbose message information
authorSamual Lenks <samual@xonotic.org>
Tue, 5 Mar 2013 00:15:38 +0000 (19:15 -0500)
committerSamual Lenks <samual@xonotic.org>
Tue, 5 Mar 2013 00:15:38 +0000 (19:15 -0500)
qcsrc/common/notifications.qc
qcsrc/common/notifications.qh
qcsrc/server/command/common.qc
qcsrc/server/g_damage.qc

index d682f8d960d5e188afd7ea975c47c9d16c34d5b5..2c25d97ddc30cfb1f219f0c02505ca739e207ee3 100644 (file)
@@ -678,6 +678,16 @@ void Dump_Notifications(float fh, float alsoprint)
        // edit these to match whichever cvars are used for specific notification options
        NOTIF_WRITE("\n// HARD CODED notification variables:\n");
        NOTIF_WRITE_HARDCODED("allow_chatboxprint",              "1",    "Allow notifications to be printed to chat box by setting notification cvar to 2 (You can also set this cvar to 2 to force ALL notifications to be printed to the chatbox)");
+       NOTIF_WRITE_HARDCODED("ctf_capture_verbose",             "0",    "Show extra information when someone captures a flag");
+       NOTIF_WRITE_HARDCODED("ctf_pickup_enemy_verbose",        "0",    "Show extra information if an enemy picks up a flag");
+       NOTIF_WRITE_HARDCODED("ctf_pickup_team_verbose",         "0",    "Show extra information if a team mate picks up a flag");
+       NOTIF_WRITE_HARDCODED("errors_are_fatal",                "1",    "If a notification fails upon initialization, cause a Host_Error to stop the program");
+       NOTIF_WRITE_HARDCODED("frag_verbose",                    "1",    "Show extra information when you frag someone (or when you are fragged");
+       NOTIF_WRITE_HARDCODED("item_centerprinttime",            "1.5",  "How long to show item information centerprint messages (like 'You got the Electro' or such)");
+       NOTIF_WRITE_HARDCODED("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)");
+       NOTIF_WRITE_HARDCODED("lifetime_runtime",                "0.5",  "Amount of time that notification entities last on the server during runtime (In seconds)");
+       NOTIF_WRITE_HARDCODED("server_allows_frag_verbose",      "1",    "Server side cvar for showing extra information in frag messages... 0 = no extra frag information, 1 = frag information only in warmup, 2 = frag information allowed all the time");
+       NOTIF_WRITE_HARDCODED("server_allows_location",          "1",    "Server side cvar for allowing death messages to show location information too");
        NOTIF_WRITE_HARDCODED("show_location",                   "0",    "Append location information to MSG_INFO death/kill messages");
        NOTIF_WRITE_HARDCODED("show_location_string",            "",     "Replacement string piped into sprintf, so you can do different messages like this: ' at the %s' or ' (near %s)'");
        NOTIF_WRITE_HARDCODED("show_sprees",                     "1",    "Print information about sprees in death/kill messages");
@@ -686,14 +696,6 @@ void Dump_Notifications(float fh, float alsoprint)
        NOTIF_WRITE_HARDCODED("show_sprees_info",                "3",    "Show spree information in MSG_INFO messages... 0 = off, 1 = target only, 2 = attacker only, 3 = target and attacker");
        NOTIF_WRITE_HARDCODED("show_sprees_info_newline",        "1",    "Show attacker spree information for MSG_INFO messages on a separate line than the death notification itself");
        NOTIF_WRITE_HARDCODED("show_sprees_info_specialonly",    "1",    "Don't show attacker spree information in MSG_INFO messages if it isn't an achievement");
-       NOTIF_WRITE_HARDCODED("item_centerprinttime",            "1.5",  "How long to show item information centerprint messages (like 'You got the Electro' or such)");
-       NOTIF_WRITE_HARDCODED("errors_are_fatal",                "1",    "If a notification fails upon initialization, cause a Host_Error to stop the program");
-       NOTIF_WRITE_HARDCODED("ctf_pickup_team_verbose",         "0",    "Show extra information if a team mate picks up a flag");
-       NOTIF_WRITE_HARDCODED("ctf_pickup_enemy_verbose",        "0",    "Show extra information if an enemy picks up a flag");
-       NOTIF_WRITE_HARDCODED("ctf_capture_verbose",             "0",    "Show extra information when someone captures a flag");
-       NOTIF_WRITE_HARDCODED("frag_verbose",                    "1",    "Show extra information when you frag someone (or when you are fragged");
-       NOTIF_WRITE_HARDCODED("lifetime_runtime",                "0.5",  "Amount of time that notification entities last on the server during runtime (In seconds)");
-       NOTIF_WRITE_HARDCODED("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)");
 
        NOTIF_WRITE(sprintf(
                strcat(
index 0302193d1f591cac39031be1b29a8fdb074e1da0..7e2d645ce9a0b2a08c3aec0ee129ac627aa320d3 100644 (file)
@@ -621,6 +621,8 @@ var float autocvar_notification_lifetime_mapload = 10;
 #ifdef SVQC
 .float FRAG_VERBOSE;
 void Notification_GetCvars(void);
+var float autocvar_notification_server_allows_frag_verbose = 1; // 0 = no, 1 = warmup only, 2 = all the time
+var float autocvar_notification_server_allows_location = 1; // 0 = no, 1 = yes
 #else
 var float autocvar_notification_item_centerprinttime = 1.5;
 
@@ -703,8 +705,8 @@ string arg_slot[NOTIF_MAX_ARGS];
     ARG_CASE(ARG_CS_SV_HA,  "s2",            s2) \
     ARG_CASE(ARG_CS_SV_HA,  "s3",            s3) \
     ARG_CASE(ARG_CS_SV_HA,  "s4",            s4) \
-    ARG_CASE(ARG_CS_SV,     "s2loc",         (autocvar_notification_show_location ? sprintf(( ((tmp_s = autocvar_notification_show_location_string) != "") ? tmp_s : _(" (near %s)") ), s2) : "")) \
-    ARG_CASE(ARG_CS_SV,     "s3loc",         (autocvar_notification_show_location ? sprintf(( ((tmp_s = autocvar_notification_show_location_string) != "") ? tmp_s : _(" (near %s)") ), s3) : "")) \
+    ARG_CASE(ARG_CS_SV,     "s2loc",         ((autocvar_notification_show_location && (s2 != "")) ? sprintf(( ((tmp_s = autocvar_notification_show_location_string) != "") ? tmp_s : _(" (near %s)") ), s2) : "")) \
+    ARG_CASE(ARG_CS_SV,     "s3loc",         ((autocvar_notification_show_location && (s3 != "")) ? sprintf(( ((tmp_s = autocvar_notification_show_location_string) != "") ? tmp_s : _(" (near %s)") ), s3) : "")) \
     ARG_CASE(ARG_CS_SV_DC,  "f1",            ftos(f1)) \
     ARG_CASE(ARG_CS_SV_DC,  "f2",            ftos(f2)) \
     ARG_CASE(ARG_CS_SV,     "f3",            ftos(f3)) \
@@ -722,8 +724,8 @@ string arg_slot[NOTIF_MAX_ARGS];
     ARG_CASE(ARG_CS_SV,     "race_diff",     ((f2 > f3) ? sprintf(CCR("^1[+%s]"), mmssss(f2 - f3)) : sprintf(CCR("^2[-%s]"), mmssss(f3 - f2)))) \
     ARG_CASE(ARG_CS,        "kh_teams",      notif_arg_kh_teams(f1, f2, f3, f4)) \
     ARG_CASE(ARG_CS,        "pass_key",      ((((tmp_s = getcommandkey("pass", "+use")) != "pass") && !(strstrofs(tmp_s, "not bound", 0) >= 0)) ? sprintf(CCR(_(" ^F1(Press %s)")), tmp_s) : "")) \
-    ARG_CASE(ARG_CS,        "frag_ping",     ((f2 != NO_MSG) ? sprintf(CCR(_("\n(Ping ^2%d^BG)")), f2) : "")) \
-    ARG_CASE(ARG_CS,        "frag_stats",    sprintf(CCR(_("\n(Health ^1%d^BG / Armor ^2%d^BG)%s")), f2, f3, ((f4 != NO_MSG) ? sprintf(CCR(_(" (Ping ^2%d^BG)")), f4) : ""))) \
+    ARG_CASE(ARG_CS,        "frag_ping",     notif_arg_frag_ping(TRUE, f2)) \
+    ARG_CASE(ARG_CS,        "frag_stats",    notif_arg_frag_stats(f2, f3, f4)) \
     /*ARG_CASE(ARG_CS,      "frag_pos",      ((Should_Print_Score_Pos(f1)) ? sprintf("\n^BG%s", Read_Score_Pos(f1)) : ""))*/ \
     ARG_CASE(ARG_CS,        "spree_cen",     (autocvar_notification_show_sprees ? notif_arg_spree_cen(f1) : "")) \
     ARG_CASE(ARG_CS_SV,     "spree_inf",     (autocvar_notification_show_sprees ? notif_arg_spree_inf(1, input, s2, f2) : "")) \
@@ -748,6 +750,22 @@ string arg_slot[NOTIF_MAX_ARGS];
        SPREE_ITEM(30, 30, _("ARMAGEDDON! "), _("%s^K1 unleashes ARMAGEDDON! %s^BG"), _("%s^K1 made THIRTY SCORES IN A ROW! %s^BG"))
 
 #ifdef CSQC
+string notif_arg_frag_ping(float newline, float fping)
+{
+       if(fping == NO_MSG)
+               return sprintf(CCR(_("%s(^F1Bot^BG)")), (newline ? "\n" : " "));
+       else
+               return sprintf(CCR(_("%s(Ping ^F1%d^BG)")), (newline ? "\n" : " "), fping);
+}
+
+string notif_arg_frag_stats(float fhealth, float farmor, float fping)
+{
+       if not(fhealth < 1)
+               return sprintf(CCR(_("\n(Health ^1%d^BG / Armor ^2%d^BG)%s")), fhealth, farmor, notif_arg_frag_ping(FALSE, fping));
+       else
+               return sprintf(CCR(_("\n(^F4Dead^BG)%s")), notif_arg_frag_ping(FALSE, fping));
+}
+
 string notif_arg_kh_teams(float f1, float f2, float f3, float f4)
 {
        return sprintf("%s%s%s%s",
index 14e6dad62f468c7fe98017368511d0aa2789e5c2..e95cf4c6585ba07ec0aa45008bdaf747bb728f8f 100644 (file)
@@ -636,7 +636,7 @@ void CommonCommand_who(float request, entity caller, float argc)
                                        tmp_player.netname,
                                        tmp_player.ping, 
                                        tmp_player.ping_packetloss, 
-                                       process_time(2, time - tmp_player.jointime),
+                                       process_time(1, time - tmp_player.jointime),
                                        tmp_netaddress,
                                        tmp_crypto_idfp));
                                
index 54ab35abf8e056c1cded941ecb937ad4608eeb82..e86b148bcb0b170851e4ac934ba1917d6a3353c3 100644 (file)
@@ -379,7 +379,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype)
        // Set final information for the death
        targ.death_origin = targ.origin;
        if(targ != attacker) { targ.killer_origin = attacker.origin; }
-       string deathlocation = NearestLocation(targ.death_origin);
+       string deathlocation = (autocvar_notification_server_allows_location ? NearestLocation(targ.death_origin) : "");
 
        #ifdef NOTIFICATIONS_DEBUG
        dprint(
@@ -490,26 +490,27 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype)
                                kill_count_to_target = 0;
                        }
 
+                       float verbose_allowed = (autocvar_notification_server_allows_frag_verbose && ((autocvar_notification_server_allows_frag_verbose == 2) || inWarmupStage));
                        if(targ.istypefrag)
                        {
-                               if(attacker.FRAG_VERBOSE)
+                               if(attacker.FRAG_VERBOSE && verbose_allowed)
                                        Send_Notification(NOTIF_ONE, attacker, MSG_CENTER, CENTER_DEATH_MURDER_TYPEFRAG_VERBOSE, targ.netname, kill_count_to_attacker, (IS_BOT_CLIENT(targ) ? NO_MSG : targ.ping));
                                else
                                        Send_Notification(NOTIF_ONE, attacker, MSG_CENTER, CENTER_DEATH_MURDER_TYPEFRAG, targ.netname, kill_count_to_attacker);
 
-                               if(targ.FRAG_VERBOSE)
+                               if(targ.FRAG_VERBOSE && verbose_allowed)
                                        Send_Notification(NOTIF_ONE, targ, MSG_CENTER, CENTER_DEATH_MURDER_TYPEFRAGGED_VERBOSE, attacker.netname, kill_count_to_target, attacker.health, attacker.armorvalue, (IS_BOT_CLIENT(attacker) ? NO_MSG : attacker.ping));
                                else
                                        Send_Notification(NOTIF_ONE, targ, MSG_CENTER, CENTER_DEATH_MURDER_TYPEFRAGGED, attacker.netname, kill_count_to_target);
                        }
                        else
                        {
-                               if(attacker.FRAG_VERBOSE)
+                               if(attacker.FRAG_VERBOSE && verbose_allowed)
                                        Send_Notification(NOTIF_ONE, attacker, MSG_CENTER, CENTER_DEATH_MURDER_FRAG_VERBOSE, targ.netname, kill_count_to_attacker, (IS_BOT_CLIENT(targ) ? NO_MSG : targ.ping));
                                else
                                        Send_Notification(NOTIF_ONE, attacker, MSG_CENTER, CENTER_DEATH_MURDER_FRAG, targ.netname, kill_count_to_attacker);
 
-                               if(targ.FRAG_VERBOSE)
+                               if(targ.FRAG_VERBOSE && verbose_allowed)
                                        Send_Notification(NOTIF_ONE, targ, MSG_CENTER, CENTER_DEATH_MURDER_FRAGGED_VERBOSE, attacker.netname, kill_count_to_target, attacker.health, attacker.armorvalue, (IS_BOT_CLIENT(attacker) ? NO_MSG : attacker.ping));
                                else
                                        Send_Notification(NOTIF_ONE, targ, MSG_CENTER, CENTER_DEATH_MURDER_FRAGGED, attacker.netname, kill_count_to_target);