From fb3cab7d7ff555883cb2d5e35a2ff79b4922c0dc Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 29 Mar 2024 10:31:15 +0100 Subject: [PATCH 01/14] Add weapon drops to logs --- .../Listeners/LogEntityListeners.cs | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/mod/Jailbreak.Logs/Listeners/LogEntityListeners.cs b/mod/Jailbreak.Logs/Listeners/LogEntityListeners.cs index 22f51286..26725792 100644 --- a/mod/Jailbreak.Logs/Listeners/LogEntityListeners.cs +++ b/mod/Jailbreak.Logs/Listeners/LogEntityListeners.cs @@ -1,7 +1,9 @@ using CounterStrikeSharp.API; using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core.Attributes.Registration; - +using CounterStrikeSharp.API.Modules.Memory; +using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions; +using CounterStrikeSharp.API.Modules.Utils; using Jailbreak.Formatting.Views; using Jailbreak.Public.Behaviors; using Jailbreak.Public.Extensions; @@ -16,6 +18,23 @@ public LogEntityListeners(IRichLogService logs) { _logs = logs; } + + private static MemoryFunctionVoid WeaponDrop = new( "\\x55\\x48\\x89\\xE5\\x41\\x56\\x41\\x55\\x49\\x89\\xD5\\x41\\x54\\x49\\x89\\xFC\\x53\\x48\\x89\\xF3\\xE8\\x2A\\x2A\\x2A\\x2A" ); + + public void OnDropGun() + { + WeaponDrop.Hook(hook => + { + var player = hook.GetParam(0); + var weapon = hook.GetParam(1); + + if (!player.IsValid) return HookResult.Continue; + if (player.TeamNum != (byte)CsTeam.CounterTerrorist) return HookResult.Changed; + + _logs.Append(_logs.Player((CCSPlayerController)player.Controller.Value), $"dropped weapon: {weapon.DesignerName}"); + return HookResult.Continue; + }, HookMode.Pre); + } [EntityOutputHook("func_button", "OnPressed")] public HookResult OnButtonPressed(CEntityIOOutput output, string name, CEntityInstance activator, From a5d0ae6a600143f9b77cb1b438aac0e3245704cd Mon Sep 17 00:00:00 2001 From: jithatsonei Date: Sun, 28 Apr 2024 10:23:03 -0500 Subject: [PATCH 02/14] unmute and kill timers before creating new peace timers --- mod/Jailbreak.Mute/MuteSystem.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mod/Jailbreak.Mute/MuteSystem.cs b/mod/Jailbreak.Mute/MuteSystem.cs index 52dfe993..59768964 100644 --- a/mod/Jailbreak.Mute/MuteSystem.cs +++ b/mod/Jailbreak.Mute/MuteSystem.cs @@ -43,6 +43,8 @@ public void Dispose() public void PeaceMute(MuteReason reason) { + guardTimer?.Kill(); + prisonerTimer?.Kill(); var duration = GetPeaceDuration(reason); var ctDuration = Math.Min(10, duration); foreach (var player in Utilities.GetPlayers().Where(player => player.IsReal())) @@ -69,9 +71,6 @@ public void PeaceMute(MuteReason reason) this.ctPeaceEnd = DateTime.Now.AddSeconds(ctDuration); this.lastPeace = DateTime.Now; - guardTimer?.Kill(); - prisonerTimer?.Kill(); - guardTimer = parent.AddTimer(ctDuration, () => { foreach (var player in Utilities.GetPlayers() @@ -186,4 +185,4 @@ private bool bypassMute(CCSPlayerController player) { return player.IsReal() && AdminManager.PlayerHasPermissions(player, "@css/chat"); } -} \ No newline at end of file +} From 296bd4be40ab54c6df2068a0ca8f8a17ff94a3b7 Mon Sep 17 00:00:00 2001 From: jii Date: Sun, 28 Apr 2024 10:38:13 -0500 Subject: [PATCH 03/14] add a check that unmutes players before muting in peace --- mod/Jailbreak.Mute/MuteSystem.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mod/Jailbreak.Mute/MuteSystem.cs b/mod/Jailbreak.Mute/MuteSystem.cs index 59768964..72540ead 100644 --- a/mod/Jailbreak.Mute/MuteSystem.cs +++ b/mod/Jailbreak.Mute/MuteSystem.cs @@ -43,10 +43,14 @@ public void Dispose() public void PeaceMute(MuteReason reason) { - guardTimer?.Kill(); - prisonerTimer?.Kill(); var duration = GetPeaceDuration(reason); var ctDuration = Math.Min(10, duration); + + if (IsPeaceEnabled()) + { + foreach (var player in Utilities.GetPlayers().Where(player => player.IsReal() && (player.VoiceFlags & VoiceFlags.Muted) != 0)) + unmute(player); + } foreach (var player in Utilities.GetPlayers().Where(player => player.IsReal())) if (!warden.IsWarden(player)) mute(player); @@ -70,6 +74,9 @@ public void PeaceMute(MuteReason reason) this.peaceEnd = DateTime.Now.AddSeconds(duration); this.ctPeaceEnd = DateTime.Now.AddSeconds(ctDuration); this.lastPeace = DateTime.Now; + + guardTimer?.Kill(); + prisonerTimer?.Kill(); guardTimer = parent.AddTimer(ctDuration, () => { From 8462ae283dab39e9270b79a906beb4cfee54be54 Mon Sep 17 00:00:00 2001 From: jithatsonei Date: Sun, 28 Apr 2024 10:53:54 -0500 Subject: [PATCH 04/14] adjust base time to test for conflicts --- mod/Jailbreak.Mute/MuteSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/Jailbreak.Mute/MuteSystem.cs b/mod/Jailbreak.Mute/MuteSystem.cs index 72540ead..9b49021a 100644 --- a/mod/Jailbreak.Mute/MuteSystem.cs +++ b/mod/Jailbreak.Mute/MuteSystem.cs @@ -104,7 +104,7 @@ private int GetPeaceDuration(MuteReason reason) var prisoners = Utilities.GetPlayers() .Count(c => c.IsReal() && c is { Team: CsTeam.Terrorist, PawnIsAlive: true }); // https://www.desmos.com/calculator/gwd9cqw4yq - var baseTime = (int)Math.Floor((prisoners + 30) / 5.0) * 5; + var baseTime = (int)Math.Floor((prisoners + 45) / 5.0) * 5; return reason switch { From b68439b6a1a70845048e460b62505c95ecb9210d Mon Sep 17 00:00:00 2001 From: jithatsonei Date: Sun, 28 Apr 2024 11:03:15 -0500 Subject: [PATCH 05/14] revert --- mod/Jailbreak.Mute/MuteSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/Jailbreak.Mute/MuteSystem.cs b/mod/Jailbreak.Mute/MuteSystem.cs index 9b49021a..72540ead 100644 --- a/mod/Jailbreak.Mute/MuteSystem.cs +++ b/mod/Jailbreak.Mute/MuteSystem.cs @@ -104,7 +104,7 @@ private int GetPeaceDuration(MuteReason reason) var prisoners = Utilities.GetPlayers() .Count(c => c.IsReal() && c is { Team: CsTeam.Terrorist, PawnIsAlive: true }); // https://www.desmos.com/calculator/gwd9cqw4yq - var baseTime = (int)Math.Floor((prisoners + 45) / 5.0) * 5; + var baseTime = (int)Math.Floor((prisoners + 30) / 5.0) * 5; return reason switch { From 8a5a942c92985c7083a55afc0aec2d53c5de93a6 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 28 Apr 2024 19:50:24 +0200 Subject: [PATCH 06/14] Potenial peace mute fix --- mod/Jailbreak.Mute/MuteSystem.cs | 97 ++++++++++++++++++++------------ 1 file changed, 61 insertions(+), 36 deletions(-) diff --git a/mod/Jailbreak.Mute/MuteSystem.cs b/mod/Jailbreak.Mute/MuteSystem.cs index 52dfe993..da270476 100644 --- a/mod/Jailbreak.Mute/MuteSystem.cs +++ b/mod/Jailbreak.Mute/MuteSystem.cs @@ -23,6 +23,9 @@ public class MuteSystem(IServiceProvider provider) : IPluginBehavior, IMuteServi private IPeaceMessages messages; private IWardenService warden; + private Queue ctScheduledMutes = new(); + private Queue tScheduledMutes = new(); + private Timer? prisonerTimer, guardTimer; @@ -30,8 +33,8 @@ public void Start(BasePlugin parent) { this.parent = parent; - this.messages = provider.GetRequiredService(); - this.warden = provider.GetRequiredService(); + messages = provider.GetRequiredService(); + warden = provider.GetRequiredService(); parent.RegisterListener(OnPlayerSpeak); } @@ -41,13 +44,49 @@ public void Dispose() parent.RemoveListener("OnClientVoice", OnPlayerSpeak); } + private void TickTerroristMutes() + { + if (tScheduledMutes.Count == 0) + return; + + var muteDuration = tScheduledMutes.Dequeue(); + + prisonerTimer = parent.AddTimer(muteDuration, () => + { + foreach (var player in Utilities.GetPlayers().Where(player => player.IsReal() && player.Team == CsTeam.Terrorist)) + { + UnMute(player); + } + if (tScheduledMutes.Count != 0) TickCounterTerroristMutes(); + prisonerTimer?.Kill(); + }); + } + + private void TickCounterTerroristMutes() + { + if (tScheduledMutes.Count == 0) + return; + + var muteDuration = tScheduledMutes.Dequeue(); + + guardTimer = parent.AddTimer(muteDuration, () => + { + foreach (var player in Utilities.GetPlayers().Where(player => player.IsReal() && player.Team == CsTeam.CounterTerrorist)) + { + UnMute(player); + } + if (ctScheduledMutes.Count != 0) TickCounterTerroristMutes(); + guardTimer?.Kill(); + }); + } + public void PeaceMute(MuteReason reason) { var duration = GetPeaceDuration(reason); var ctDuration = Math.Min(10, duration); foreach (var player in Utilities.GetPlayers().Where(player => player.IsReal())) if (!warden.IsWarden(player)) - mute(player); + Mute(player); switch (reason) { @@ -65,32 +104,18 @@ public void PeaceMute(MuteReason reason) break; } - this.peaceEnd = DateTime.Now.AddSeconds(duration); - this.ctPeaceEnd = DateTime.Now.AddSeconds(ctDuration); - this.lastPeace = DateTime.Now; + peaceEnd = DateTime.Now.AddSeconds(duration); + ctPeaceEnd = DateTime.Now.AddSeconds(ctDuration); + lastPeace = DateTime.Now; guardTimer?.Kill(); prisonerTimer?.Kill(); - - guardTimer = parent.AddTimer(ctDuration, () => - { - foreach (var player in Utilities.GetPlayers() - .Where(player => - player.IsReal() && player is { Team: CsTeam.CounterTerrorist, PawnIsAlive: true })) - unmute(player); - - messages.UNMUTED_GUARDS.ToAllChat(); - }); - - prisonerTimer = parent.AddTimer(duration, () => - { - foreach (var player in Utilities.GetPlayers() - .Where(player => - player.IsReal() && player is { Team: CsTeam.Terrorist, PawnIsAlive: true })) - unmute(player); - - messages.UNMUTED_PRISONERS.ToAllChat(); - }); + + ctScheduledMutes.Enqueue(ctDuration); + tScheduledMutes.Enqueue(duration); + + if (tScheduledMutes.Count == 0) TickTerroristMutes(); + if (ctScheduledMutes.Count == 0) TickCounterTerroristMutes(); } private int GetPeaceDuration(MuteReason reason) @@ -110,14 +135,14 @@ private int GetPeaceDuration(MuteReason reason) }; } - private void mute(CCSPlayerController player) + private void Mute(CCSPlayerController player) { - if (bypassMute(player)) + if (BypassMute(player)) return; player.VoiceFlags |= VoiceFlags.Muted; } - private void unmute(CCSPlayerController player) + private void UnMute(CCSPlayerController player) { player.VoiceFlags &= ~VoiceFlags.Muted; } @@ -141,26 +166,26 @@ private void OnPlayerSpeak(int playerSlot) if (warden.IsWarden(player)) { // Always let the warden speak - unmute(player); + UnMute(player); return; } - if (!player.PawnIsAlive && !bypassMute(player)) + if (!player.PawnIsAlive && !BypassMute(player)) { // Normal players can't speak when dead messages.DEAD_REMINDER.ToPlayerCenter(player); - mute(player); + Mute(player); return; } - if (isMuted(player)) + if (IsMuted(player)) { // Remind any muted players they're muted messages.MUTE_REMINDER.ToPlayerCenter(player); return; } - if (bypassMute(player)) + if (BypassMute(player)) { // Warn admins if they're not muted if (IsPeaceEnabled()) @@ -175,14 +200,14 @@ private void OnPlayerSpeak(int playerSlot) } } - private bool isMuted(CCSPlayerController player) + private bool IsMuted(CCSPlayerController player) { if (!player.IsReal()) return false; return (player.VoiceFlags & VoiceFlags.Muted) != 0; } - private bool bypassMute(CCSPlayerController player) + private bool BypassMute(CCSPlayerController player) { return player.IsReal() && AdminManager.PlayerHasPermissions(player, "@css/chat"); } From 251a965922ca7c2edcba4966bc44729100c1c50b Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 28 Apr 2024 19:51:19 +0200 Subject: [PATCH 07/14] Potenial peace mute fix --- mod/Jailbreak.Mute/MuteSystem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mod/Jailbreak.Mute/MuteSystem.cs b/mod/Jailbreak.Mute/MuteSystem.cs index da270476..d359afb9 100644 --- a/mod/Jailbreak.Mute/MuteSystem.cs +++ b/mod/Jailbreak.Mute/MuteSystem.cs @@ -64,10 +64,10 @@ private void TickTerroristMutes() private void TickCounterTerroristMutes() { - if (tScheduledMutes.Count == 0) + if (ctScheduledMutes.Count == 0) return; - var muteDuration = tScheduledMutes.Dequeue(); + var muteDuration = ctScheduledMutes.Dequeue(); guardTimer = parent.AddTimer(muteDuration, () => { From 25c77ba61cdaa73aaab901447247cda0ca4ca6c3 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 28 Apr 2024 19:59:36 +0200 Subject: [PATCH 08/14] Cleanup --- .../Listeners/LogEntityListeners.cs | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/mod/Jailbreak.Logs/Listeners/LogEntityListeners.cs b/mod/Jailbreak.Logs/Listeners/LogEntityListeners.cs index 26725792..3aeef6ca 100644 --- a/mod/Jailbreak.Logs/Listeners/LogEntityListeners.cs +++ b/mod/Jailbreak.Logs/Listeners/LogEntityListeners.cs @@ -18,23 +18,6 @@ public LogEntityListeners(IRichLogService logs) { _logs = logs; } - - private static MemoryFunctionVoid WeaponDrop = new( "\\x55\\x48\\x89\\xE5\\x41\\x56\\x41\\x55\\x49\\x89\\xD5\\x41\\x54\\x49\\x89\\xFC\\x53\\x48\\x89\\xF3\\xE8\\x2A\\x2A\\x2A\\x2A" ); - - public void OnDropGun() - { - WeaponDrop.Hook(hook => - { - var player = hook.GetParam(0); - var weapon = hook.GetParam(1); - - if (!player.IsValid) return HookResult.Continue; - if (player.TeamNum != (byte)CsTeam.CounterTerrorist) return HookResult.Changed; - - _logs.Append(_logs.Player((CCSPlayerController)player.Controller.Value), $"dropped weapon: {weapon.DesignerName}"); - return HookResult.Continue; - }, HookMode.Pre); - } [EntityOutputHook("func_button", "OnPressed")] public HookResult OnButtonPressed(CEntityIOOutput output, string name, CEntityInstance activator, From e7115c291211ed1d8607cf933dd377f4ea59f1ef Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 28 Apr 2024 20:04:28 +0200 Subject: [PATCH 09/14] Fix queue --- mod/Jailbreak.Mute/MuteSystem.cs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/mod/Jailbreak.Mute/MuteSystem.cs b/mod/Jailbreak.Mute/MuteSystem.cs index d359afb9..59023a42 100644 --- a/mod/Jailbreak.Mute/MuteSystem.cs +++ b/mod/Jailbreak.Mute/MuteSystem.cs @@ -57,8 +57,13 @@ private void TickTerroristMutes() { UnMute(player); } - if (tScheduledMutes.Count != 0) TickCounterTerroristMutes(); - prisonerTimer?.Kill(); + if (ctScheduledMutes.Count != 0) + { + TickTerroristMutes(); + return; + } + guardTimer?.Kill(); + guardTimer = null; }); } @@ -75,8 +80,14 @@ private void TickCounterTerroristMutes() { UnMute(player); } - if (ctScheduledMutes.Count != 0) TickCounterTerroristMutes(); + + if (ctScheduledMutes.Count != 0) + { + TickCounterTerroristMutes(); + return; + } guardTimer?.Kill(); + guardTimer = null; }); } @@ -114,8 +125,8 @@ public void PeaceMute(MuteReason reason) ctScheduledMutes.Enqueue(ctDuration); tScheduledMutes.Enqueue(duration); - if (tScheduledMutes.Count == 0) TickTerroristMutes(); - if (ctScheduledMutes.Count == 0) TickCounterTerroristMutes(); + if (tScheduledMutes.Count == 1 || prisonerTimer == null) TickTerroristMutes(); + if (ctScheduledMutes.Count == 1 || guardTimer == null) TickCounterTerroristMutes(); } private int GetPeaceDuration(MuteReason reason) From 11c9c03723f321757f1ec18024913a140484b08b Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 28 Apr 2024 20:06:43 +0200 Subject: [PATCH 10/14] Actually fix it --- mod/Jailbreak.Mute/MuteSystem.cs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/mod/Jailbreak.Mute/MuteSystem.cs b/mod/Jailbreak.Mute/MuteSystem.cs index 59023a42..23a962b1 100644 --- a/mod/Jailbreak.Mute/MuteSystem.cs +++ b/mod/Jailbreak.Mute/MuteSystem.cs @@ -53,17 +53,18 @@ private void TickTerroristMutes() prisonerTimer = parent.AddTimer(muteDuration, () => { - foreach (var player in Utilities.GetPlayers().Where(player => player.IsReal() && player.Team == CsTeam.Terrorist)) - { - UnMute(player); - } - if (ctScheduledMutes.Count != 0) + if (tScheduledMutes.Count != 0) { TickTerroristMutes(); return; } - guardTimer?.Kill(); - guardTimer = null; + foreach (var player in Utilities.GetPlayers().Where(player => player.IsReal() && player.Team == CsTeam.Terrorist)) + { + UnMute(player); + } + + prisonerTimer?.Kill(); + prisonerTimer = null; }); } @@ -76,16 +77,18 @@ private void TickCounterTerroristMutes() guardTimer = parent.AddTimer(muteDuration, () => { - foreach (var player in Utilities.GetPlayers().Where(player => player.IsReal() && player.Team == CsTeam.CounterTerrorist)) - { - UnMute(player); - } - if (ctScheduledMutes.Count != 0) { TickCounterTerroristMutes(); return; } + + foreach (var player in Utilities.GetPlayers().Where(player => player.IsReal() && player.Team == CsTeam.CounterTerrorist)) + { + UnMute(player); + } + + guardTimer?.Kill(); guardTimer = null; }); From 1b22eae6f111921949c6f6d5f27f519689a35d15 Mon Sep 17 00:00:00 2001 From: jithatsonei Date: Sun, 28 Apr 2024 13:22:10 -0500 Subject: [PATCH 11/14] fix context --- mod/Jailbreak.Mute/MuteSystem.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mod/Jailbreak.Mute/MuteSystem.cs b/mod/Jailbreak.Mute/MuteSystem.cs index 596ac1e1..c6d95d53 100644 --- a/mod/Jailbreak.Mute/MuteSystem.cs +++ b/mod/Jailbreak.Mute/MuteSystem.cs @@ -124,9 +124,9 @@ public void PeaceMute(MuteReason reason) break; } - peaceEnd = DateTime.Now.AddSeconds(duration); - ctPeaceEnd = DateTime.Now.AddSeconds(ctDuration); - lastPeace = DateTime.Now; + this.peaceEnd = DateTime.Now.AddSeconds(duration); + this.ctPeaceEnd = DateTime.Now.AddSeconds(ctDuration); + this.lastPeace = DateTime.Now; guardTimer?.Kill(); prisonerTimer?.Kill(); From 70ffa2ec47ba73a91a9f3d1e1c2bb3ca037b4d47 Mon Sep 17 00:00:00 2001 From: jithatsonei Date: Sun, 28 Apr 2024 13:24:25 -0500 Subject: [PATCH 12/14] fix unmute method call --- mod/Jailbreak.Mute/MuteSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/Jailbreak.Mute/MuteSystem.cs b/mod/Jailbreak.Mute/MuteSystem.cs index c6d95d53..738d90c2 100644 --- a/mod/Jailbreak.Mute/MuteSystem.cs +++ b/mod/Jailbreak.Mute/MuteSystem.cs @@ -102,7 +102,7 @@ public void PeaceMute(MuteReason reason) if (IsPeaceEnabled()) { foreach (var player in Utilities.GetPlayers().Where(player => player.IsReal() && (player.VoiceFlags & VoiceFlags.Muted) != 0)) - unmute(player); + UnMute(player); } foreach (var player in Utilities.GetPlayers().Where(player => player.IsReal())) if (!warden.IsWarden(player)) From 2233a034e5e46d6513736665e6c64e2ba9947949 Mon Sep 17 00:00:00 2001 From: jii Date: Mon, 29 Apr 2024 21:21:05 -0500 Subject: [PATCH 13/14] testing warden fixes --- mod/Jailbreak.Mute/MuteSystem.cs | 19 ++++++++++++++++++- mod/Jailbreak.Warden/Global/WardenBehavior.cs | 2 ++ .../Jailbreak.Public/Mod/Mute/IMuteService.cs | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/mod/Jailbreak.Mute/MuteSystem.cs b/mod/Jailbreak.Mute/MuteSystem.cs index 738d90c2..8c3d87ac 100644 --- a/mod/Jailbreak.Mute/MuteSystem.cs +++ b/mod/Jailbreak.Mute/MuteSystem.cs @@ -43,7 +43,7 @@ public void Dispose() { parent.RemoveListener("OnClientVoice", OnPlayerSpeak); } - + private void TickTerroristMutes() { if (tScheduledMutes.Count == 0) @@ -137,6 +137,23 @@ public void PeaceMute(MuteReason reason) if (tScheduledMutes.Count == 1 || prisonerTimer == null) TickTerroristMutes(); if (ctScheduledMutes.Count == 1 || guardTimer == null) TickCounterTerroristMutes(); } + + public void UnPeaceMute() + { + foreach (var player in Utilities.GetPlayers().Where(player => player.IsReal() && player.Team == CsTeam.Terrorist)) + { + UnMute(player); + } + foreach (var player in Utilities.GetPlayers().Where(player => player.IsReal() && player.Team == CsTeam.CounterTerrorist)) + { + UnMute(player); + } + prisonerTimer?.Kill(); + prisonerTimer = null; + guardTimer?.Kill(); + guardTimer = null; + } + private int GetPeaceDuration(MuteReason reason) { diff --git a/mod/Jailbreak.Warden/Global/WardenBehavior.cs b/mod/Jailbreak.Warden/Global/WardenBehavior.cs index 52132b52..0f9d9bfa 100644 --- a/mod/Jailbreak.Warden/Global/WardenBehavior.cs +++ b/mod/Jailbreak.Warden/Global/WardenBehavior.cs @@ -61,6 +61,8 @@ public bool TrySetWarden(CCSPlayerController controller) if (!controller.PawnIsAlive) return false; + mute.UnPeaceMute(); + _hasWarden = true; _warden = controller; diff --git a/public/Jailbreak.Public/Mod/Mute/IMuteService.cs b/public/Jailbreak.Public/Mod/Mute/IMuteService.cs index dbfa31b3..f47099dc 100644 --- a/public/Jailbreak.Public/Mod/Mute/IMuteService.cs +++ b/public/Jailbreak.Public/Mod/Mute/IMuteService.cs @@ -6,6 +6,8 @@ public interface IMuteService { void PeaceMute(MuteReason reason); + void UnPeaceMute(); + bool IsPeaceEnabled(); DateTime GetLastPeace(); From fb62ccdc888c93ef8e5a8e72db41148d8d125d6f Mon Sep 17 00:00:00 2001 From: jii Date: Mon, 29 Apr 2024 21:31:36 -0500 Subject: [PATCH 14/14] try killing the timer when round ends --- mod/Jailbreak.Warden/Global/WardenBehavior.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mod/Jailbreak.Warden/Global/WardenBehavior.cs b/mod/Jailbreak.Warden/Global/WardenBehavior.cs index 0f9d9bfa..dcc1f564 100644 --- a/mod/Jailbreak.Warden/Global/WardenBehavior.cs +++ b/mod/Jailbreak.Warden/Global/WardenBehavior.cs @@ -98,6 +98,8 @@ public bool TryRemoveWarden() { if (!_hasWarden) return false; + + mute.UnPeaceMute(); _hasWarden = false; @@ -121,6 +123,7 @@ public HookResult OnDeath(EventPlayerDeath ev, GameEventInfo info) if(!((IWardenService)this).IsWarden(ev.Userid)) return HookResult.Continue; + mute.UnPeaceMute(); ProcessWardenDeath(); return HookResult.Continue; } @@ -132,6 +135,7 @@ public HookResult OnChangeTeam(EventPlayerTeam @event, GameEventInfo info) if (!((IWardenService)this).IsWarden(player)) return HookResult.Continue; + mute.UnPeaceMute(); ProcessWardenDeath(); return HookResult.Continue; } @@ -209,7 +213,7 @@ private bool IgnoreColor(CCSPlayerController player) public HookResult OnRoundEnd(EventRoundEnd ev, GameEventInfo info) { this.TryRemoveWarden(); - + mute.UnPeaceMute(); return HookResult.Continue; }