From cc3c090a1aae15d48c1f2de512f0c7c4e89bd3b5 Mon Sep 17 00:00:00 2001 From: terencehill Date: Wed, 31 Aug 2022 22:17:30 +0200 Subject: [PATCH] LMS: fix visible leaders message appearing even when there are no leaders --- qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc index e3ebfefd3..947111a08 100644 --- a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc +++ b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc @@ -451,14 +451,22 @@ MUTATOR_HOOKFUNCTION(lms, PlayerPreThink) MUTATOR_HOOKFUNCTION(lms, SV_StartFrame) { + if (intermission_running) + return; + + lms_leaders = 0; + FOREACH_CLIENT(true, { + if (IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME && it.lms_leader) + lms_leaders++; + }); + float leader_time = autocvar_g_lms_leader_wp_time; float leader_interval = leader_time + autocvar_g_lms_leader_wp_interval; lms_visible_leaders_prev = lms_visible_leaders; - lms_visible_leaders = (time > lms_visible_leaders_time && time < lms_visible_leaders_time + leader_time); - if (lms_visible_leaders_prev && !lms_visible_leaders) + lms_visible_leaders = (lms_leaders && time > lms_visible_leaders_time && time < lms_visible_leaders_time + leader_time); + if (!lms_leaders || (lms_visible_leaders_prev && !lms_visible_leaders)) lms_visible_leaders_time = time + leader_interval + random() * autocvar_g_lms_leader_wp_interval_jitter; - lms_leaders = 0; FOREACH_CLIENT(true, { STAT(OBJECTIVE_STATUS, it) = lms_visible_leaders; if (IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME) @@ -476,7 +484,6 @@ MUTATOR_HOOKFUNCTION(lms, SV_StartFrame) } 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 (!it.lms_leader) { -- 2.39.2