Skip to content

Commit

Permalink
add real player checking, add warden passed sound
Browse files Browse the repository at this point in the history
  • Loading branch information
jithatsonei committed Mar 27, 2024
1 parent a299ff5 commit 9d5fc03
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 9 additions & 1 deletion mod/Jailbreak.Warden/Commands/WardenCommandsBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ public class WardenCommandsBehavior : IPluginBehavior
private readonly IWardenNotifications _notifications;
private readonly IWardenSelectionService _queue;
private readonly IWardenService _warden;
private readonly WardenConfig _config;

public WardenCommandsBehavior(IWardenSelectionService queue, IWardenService warden,
IWardenNotifications notifications)
IWardenNotifications notifications, WardenConfig config)
{
_config = config;
_queue = queue;
_warden = warden;
_notifications = notifications;
Expand All @@ -46,6 +48,12 @@ public void Command_Pass(CCSPlayerController? player, CommandInfo command)
.ToAllChat()
.ToAllCenter();

foreach (CCSPlayerController clients in Utilities.GetPlayers()) {
if (!clients.IsReal()) continue;
clients.ExecuteClientCommand(
$"play sounds/{_config.WardenPassedSoundName}");
}

_notifications.BECOME_NEXT_WARDEN.ToAllChat();

if (!_warden.TryRemoveWarden())
Expand Down
5 changes: 4 additions & 1 deletion mod/Jailbreak.Warden/Global/WardenBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class WardenBehavior : IPluginBehavior, IWardenService
private BasePlugin _parent;
private Timer? _unblueTimer;

private WardenConfig _config;
private readonly WardenConfig _config;

private bool _hasWarden;
private CCSPlayerController? _warden;
Expand Down Expand Up @@ -86,6 +86,7 @@ public bool TrySetWarden(CCSPlayerController controller)
.ToAllCenter();

foreach (CCSPlayerController player in Utilities.GetPlayers()) {
if (!player.IsReal()) continue;
player.ExecuteClientCommand(
$"play sounds/{_config.WardenNewSoundName}");
}
Expand Down Expand Up @@ -149,6 +150,7 @@ private void ProcessWardenDeath()
.ToAllCenter();

foreach (CCSPlayerController player in Utilities.GetPlayers()) {
if (!player.IsReal()) continue;
player.ExecuteClientCommand(
$"play sounds/{_config.WardenKilledSoundName}");
}
Expand Down Expand Up @@ -229,6 +231,7 @@ public HookResult OnPlayerDisconnect(EventPlayerDisconnect ev, GameEventInfo inf
.ToAllCenter();

foreach (CCSPlayerController player in Utilities.GetPlayers()) {
if (!player.IsReal()) continue;
player.ExecuteClientCommand(
$"play sounds/{_config.WardenPassedSoundName}");
}
Expand Down

0 comments on commit 9d5fc03

Please sign in to comment.