From 66948911cf86a1818634ec155dcc04015e06680e Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 15 Nov 2021 16:29:52 +0100 Subject: [PATCH] LMS: when leaders are visible notify players with a message and show a icon on the HUD --- notifications.cfg | 6 ++++-- qcsrc/common/gamemodes/gamemode/lms/cl_lms.qc | 3 +++ qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc | 21 +++++++++++++++---- qcsrc/common/notifications/all.inc | 2 ++ 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/notifications.cfg b/notifications.cfg index a23eb5539..131b3060c 100644 --- a/notifications.cfg +++ b/notifications.cfg @@ -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 diff --git a/qcsrc/common/gamemodes/gamemode/lms/cl_lms.qc b/qcsrc/common/gamemodes/gamemode/lms/cl_lms.qc index b0a792c33..91713eb47 100644 --- a/qcsrc/common/gamemodes/gamemode/lms/cl_lms.qc +++ b/qcsrc/common/gamemodes/gamemode/lms/cl_lms.qc @@ -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); } diff --git a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc index 629a2940f..e3a41c9f8 100644 --- a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc +++ b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc @@ -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); } diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc index f1b2af8e6..382fd367d 100644 --- a/qcsrc/common/notifications/all.inc +++ b/qcsrc/common/notifications/all.inc @@ -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..."), "") -- 2.39.2