]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
LMS: when leaders are visible notify players with a message and show a icon on the HUD
authorterencehill <piuntn@gmail.com>
Mon, 15 Nov 2021 15:29:52 +0000 (16:29 +0100)
committerterencehill <piuntn@gmail.com>
Mon, 15 Nov 2021 15:29:52 +0000 (16:29 +0100)
notifications.cfg
qcsrc/common/gamemodes/gamemode/lms/cl_lms.qc
qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc
qcsrc/common/notifications/all.inc

index a23eb5539ae13833fdf6b94ee50762af6b30498e..131b3060cccd6ad49179734cde3c98d32a439496 100644 (file)
@@ -342,7 +342,7 @@ seta notification_INFO_WEAPON_TUBA_SUICIDE "1" "0 = off, 1 = print to console, 2
 seta notification_INFO_WEAPON_VAPORIZER_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_VORTEX_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 
-// MSG_CENTER notifications (count = 241):
+// MSG_CENTER notifications (count = 243):
 seta notification_CENTER_ALONE "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_ASSAULT_ATTACKING "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_ASSAULT_DEFENDING "1" "0 = off, 1 = centerprint"
@@ -480,6 +480,8 @@ seta notification_CENTER_KEYHUNT_ROUNDSTART "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_KEYHUNT_SCAN "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_KEYHUNT_START "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_LMS_NOLIVES "1" "0 = off, 1 = centerprint"
+seta notification_CENTER_LMS_VISIBLE_LEADER "1" "0 = off, 1 = centerprint"
+seta notification_CENTER_LMS_VISIBLE_OTHER "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_MISSING_PLAYERS "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_MISSING_TEAMS "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_MOTD "1" "0 = off, 1 = centerprint"
@@ -746,4 +748,4 @@ seta notification_show_sprees_info "3" "Show spree information in MSG_INFO messa
 seta notification_show_sprees_info_newline "1" "Show attacker spree information for MSG_INFO messages on a separate line than the death notification itself"
 seta notification_show_sprees_info_specialonly "1" "Don't show attacker spree information in MSG_INFO messages if it isn't an achievement"
 
-// Notification counts (total = 839): MSG_ANNCE = 80, MSG_INFO = 334, MSG_CENTER = 241, MSG_MULTI = 156, MSG_CHOICE = 28
+// Notification counts (total = 841): MSG_ANNCE = 80, MSG_INFO = 334, MSG_CENTER = 243, MSG_MULTI = 156, MSG_CHOICE = 28
index b0a792c33c336364b3dd9b09849f8f1c85067a07..91713eb47cd8c9ff9bae6c1f22244121d547c70c 100644 (file)
@@ -40,9 +40,12 @@ void HUD_Mod_LMS_Draw(vector myPos, vector mySize)
                return;
        }
 
+       bool visible_leaders = STAT(OBJECTIVE_STATUS);
        string pic = "player_neutral";
        vector color = '1 1 1';
 
+       if (visible_leaders)
+               drawpic_aspect_skin(myPos, "flag_stalemate", vec2(0.5 * mySize.x, mySize.y), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
        drawpic_aspect_skin(myPos, pic, vec2(0.5 * mySize.x, mySize.y), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
        drawstring_aspect(myPos + eX * 0.5 * mySize.x, ftos(stat), vec2(0.5 * mySize.x, mySize.y), color, panel_fg_alpha, DRAWFLAG_NORMAL);
 }
index 629a2940f07a6b48c5eeadcf994f6b83c82bab2b..e3a41c9f8526cb759c6962522ba1b667efb2248e 100644 (file)
@@ -24,6 +24,9 @@ float autocvar_g_lms_dynamic_vampire_factor_max;
 int autocvar_g_lms_dynamic_vampire_min_lives_diff;
 
 .float lms_leader;
+int lms_leaders;
+bool lms_visible_leaders;
+bool lms_visible_leaders_prev;
 
 // main functions
 int LMS_NewPlayerLives()
@@ -135,9 +138,7 @@ bool lms_waypointsprite_visible_for_player(entity this, entity player, entity vi
                if(IS_SPEC(player))
                        return false; // we don't want spectators of leaders to see the attached waypoint on the top of their screen
 
-       float leader_time = autocvar_g_lms_leader_wp_time;
-       float leader_repeat_time = leader_time + autocvar_g_lms_leader_wp_time_repeat;
-       if (time % leader_repeat_time > leader_time)
+       if (!lms_visible_leaders)
                return false;
 
        return true;
@@ -407,7 +408,6 @@ MUTATOR_HOOKFUNCTION(lms, ClientConnect)
        player.frags = FRAGS_SPECTATOR;
 }
 
-int lms_leaders = 0;
 MUTATOR_HOOKFUNCTION(lms, PlayerPreThink)
 {
        entity player = M_ARGV(0, entity);
@@ -421,8 +421,14 @@ MUTATOR_HOOKFUNCTION(lms, PlayerPreThink)
 
 MUTATOR_HOOKFUNCTION(lms, SV_StartFrame)
 {
+       float leader_time = autocvar_g_lms_leader_wp_time;
+       float leader_repeat_time = leader_time + autocvar_g_lms_leader_wp_time_repeat;
+       lms_visible_leaders_prev = lms_visible_leaders;
+       lms_visible_leaders = (time % leader_repeat_time < leader_time);
+
        lms_leaders = 0;
        FOREACH_CLIENT(true, {
+               STAT(OBJECTIVE_STATUS, it) = lms_visible_leaders;
                if (IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME)
                {
                        if (it.lms_leader)
@@ -436,11 +442,18 @@ MUTATOR_HOOKFUNCTION(lms, SV_StartFrame)
                                        WaypointSprite_UpdateTeamRadar(it.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, pl_color);
                                        WaypointSprite_Ping(it.waypointsprite_attachedforcarrier);
                                }
+                               if (!lms_visible_leaders_prev && lms_visible_leaders && IS_REAL_CLIENT(it))
+                                       Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_LMS_VISIBLE_LEADER);
                                lms_leaders++;
                        }
                }
                else
                {
+                       if (IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME)
+                       {
+                               if (!lms_visible_leaders_prev && lms_visible_leaders && IS_REAL_CLIENT(it))
+                                       Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_LMS_VISIBLE_OTHER);
+                       }
                        if (it.waypointsprite_attachedforcarrier)
                                WaypointSprite_Kill(it.waypointsprite_attachedforcarrier);
                }
index f1b2af8e600164799b48c0922cd20db778d36fcb..382fd367dee48a1e70ffed26ca7aae14d8217db5 100644 (file)
@@ -703,6 +703,8 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input !=
     MULTITEAM_CENTER(KEYHUNT_START,                     N_ENABLE,    0, 0, "",               CPID_KEYHUNT,           "0 0",  _("^BGYou are starting with the ^TC^TT Key"), "", KEY)
 
     MSG_CENTER_NOTIF(LMS_NOLIVES,                       N_ENABLE,    0, 0, "",               CPID_LMS,               "0 0",  _("^BGYou have no lives left, you must wait until the next match"), "")
+    MSG_CENTER_NOTIF(LMS_VISIBLE_LEADER,                N_ENABLE,    0, 0, "",               CPID_LMS,               "0 0",  _("^BGEnemies can now see you on radar!"), "")
+    MSG_CENTER_NOTIF(LMS_VISIBLE_OTHER,                 N_ENABLE,    0, 0, "",               CPID_LMS,               "0 0",  _("^BGLeaders can now be seen by enemies on radar!"), "")
 
     MSG_CENTER_NOTIF(MISSING_TEAMS,                     N_ENABLE,    0, 1, "missing_teams",  CPID_MISSING_TEAMS,     "-1 0", _("^BGWaiting for players to join...\nNeed active players for: %s"), "")
     MSG_CENTER_NOTIF(MISSING_PLAYERS,                   N_ENABLE,    0, 1, "f1",             CPID_MISSING_PLAYERS,   "-1 0", _("^BGWaiting for %s player(s) to join..."), "")