diff --git a/Content.Server/Ame/Components/AmeControllerComponent.cs b/Content.Server/Ame/Components/AmeControllerComponent.cs index 1bf1ac2c92..abdb76c9e3 100644 --- a/Content.Server/Ame/Components/AmeControllerComponent.cs +++ b/Content.Server/Ame/Components/AmeControllerComponent.cs @@ -2,6 +2,7 @@ using Content.Server.Ame.EntitySystems; using Content.Shared.Ame; using Robust.Shared.Audio; using Robust.Shared.Containers; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Server.Ame.Components; @@ -89,4 +90,16 @@ public sealed partial class AmeControllerComponent : SharedAmeControllerComponen /// [ViewVariables] public TimeSpan UpdateUIPeriod = TimeSpan.FromSeconds(3.0); + + /// + /// Time at which the admin alarm sound effect can next be played. + /// + [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] + public TimeSpan EffectCooldown; + + /// + /// Time between admin alarm sound effects. Prevents spam + /// + [DataField] + public TimeSpan CooldownDuration = TimeSpan.FromSeconds(10f); } diff --git a/Content.Server/Ame/EntitySystems/AmeControllerSystem.cs b/Content.Server/Ame/EntitySystems/AmeControllerSystem.cs index 44140193d2..0dddff3637 100644 --- a/Content.Server/Ame/EntitySystems/AmeControllerSystem.cs +++ b/Content.Server/Ame/EntitySystems/AmeControllerSystem.cs @@ -1,6 +1,7 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; using Content.Server.Administration.Logs; +using Content.Server.Administration.Managers; using Content.Server.Ame.Components; using Content.Server.Chat.Managers; using Content.Server.NodeContainer; @@ -16,6 +17,7 @@ using Robust.Server.Containers; using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Containers; +using Robust.Shared.Player; using Robust.Shared.Timing; namespace Content.Server.Ame.EntitySystems; @@ -23,6 +25,7 @@ namespace Content.Server.Ame.EntitySystems; public sealed class AmeControllerSystem : EntitySystem { [Dependency] private readonly IAdminLogManager _adminLogger = default!; + [Dependency] private readonly IAdminManager _adminManager = default!; [Dependency] private readonly IChatManager _chatManager = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly AppearanceSystem _appearanceSystem = default!; @@ -233,7 +236,15 @@ public sealed class AmeControllerSystem : EntitySystem safeLimit = group.CoreCount * 2; if (oldValue <= safeLimit && value > safeLimit) - _chatManager.SendAdminAlert(user.Value, $"increased AME over safe limit to {controller.InjectionAmount}"); + { + if (_gameTiming.CurTime > controller.EffectCooldown) + { + _chatManager.SendAdminAlert(user.Value, $"increased AME over safe limit to {controller.InjectionAmount}"); + _audioSystem.PlayGlobal("/Audio/Misc/adminlarm.ogg", + Filter.Empty().AddPlayers(_adminManager.ActiveAdmins), false, AudioParams.Default.WithVolume(-8f)); + controller.EffectCooldown = _gameTiming.CurTime + controller.CooldownDuration; + } + } } public void AdjustInjectionAmount(EntityUid uid, int delta, int min = 0, int max = int.MaxValue, EntityUid? user = null, AmeControllerComponent? controller = null) diff --git a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs index 2adbbe05f7..b460e96acc 100644 --- a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs +++ b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs @@ -1,5 +1,6 @@ using Content.Server.ParticleAccelerator.Wires; using Content.Shared.Singularity.Components; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Server.ParticleAccelerator.Components; @@ -167,6 +168,18 @@ public sealed partial class ParticleAcceleratorControlBoxComponent : Component [ViewVariables] public bool StrengthLocked = false; + /// + /// Time at which the admin alarm sound effect can next be played. + /// + [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))] + public TimeSpan EffectCooldown; + + /// + /// Time between admin alarm sound effects. Prevents spam + /// + [DataField] + public TimeSpan CooldownDuration = TimeSpan.FromSeconds(10f); + /// /// Whether the PA can be turned on. /// Modified by . diff --git a/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.ControlBox.cs b/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.ControlBox.cs index f200c991d7..5900dc55b3 100644 --- a/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.ControlBox.cs +++ b/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.ControlBox.cs @@ -4,13 +4,19 @@ using Content.Shared.Database; using Content.Shared.Singularity.Components; using Robust.Shared.Utility; using System.Diagnostics; +using Content.Server.Administration.Managers; using Content.Shared.CCVar; +using Robust.Shared.Audio; +using Robust.Shared.Timing; using Robust.Shared.Player; namespace Content.Server.ParticleAccelerator.EntitySystems; public sealed partial class ParticleAcceleratorSystem { + [Dependency] private readonly IAdminManager _adminManager = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; + [Dependency] private readonly IGameTiming _timing = default!; private void InitializeControlBoxSystem() { SubscribeLocalEvent(OnComponentStartup); @@ -165,10 +171,17 @@ public sealed partial class ParticleAcceleratorSystem if (strength >= alertMinPowerState) { var pos = Transform(uid); - _chat.SendAdminAlert(player, Loc.GetString("particle-accelerator-admin-power-strength-warning", - ("machine", ToPrettyString(uid)), - ("powerState", strength), - ("coordinates", pos.Coordinates))); + if (_timing.CurTime > comp.EffectCooldown) + { + _chat.SendAdminAlert(player, Loc.GetString("particle-accelerator-admin-power-strength-warning", + ("machine", ToPrettyString(uid)), + ("powerState", strength), + ("coordinates", pos.Coordinates))); + _audio.PlayGlobal("/Audio/Misc/adminlarm.ogg", + Filter.Empty().AddPlayers(_adminManager.ActiveAdmins), false, + AudioParams.Default.WithVolume(-8f)); + comp.EffectCooldown = _timing.CurTime + comp.CooldownDuration; + } } } diff --git a/Resources/Audio/Misc/adminlarm.ogg b/Resources/Audio/Misc/adminlarm.ogg new file mode 100644 index 0000000000..7c75e20bdd Binary files /dev/null and b/Resources/Audio/Misc/adminlarm.ogg differ diff --git a/Resources/Changelog/Admin.yml b/Resources/Changelog/Admin.yml index 92641ad69e..6b7763d14d 100644 --- a/Resources/Changelog/Admin.yml +++ b/Resources/Changelog/Admin.yml @@ -61,3 +61,8 @@ Entries: in some cases.', type: Fix} id: 9 time: '2023-10-30T01:28:00.0000000+00:00' +- author: Vasilis + changes: + - {message: 'AME and PA make a sound effect when they are being overloaded. Similar to being sent a fax.', type: Add} + id: 10 + time: '2023-11-07T15:03:00.0000000+00:00'