From: terencehill Date: Wed, 31 Aug 2022 20:17:30 +0000 (+0200) Subject: LMS: fix visible leaders message appearing even when there are no leaders X-Git-Tag: xonotic-v0.8.6~371 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cc3c090a1aae15d48c1f2de512f0c7c4e89bd3b5;p=xonotic%2Fxonotic-data.pk3dir.git LMS: fix visible leaders message appearing even when there are no leaders --- 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) {