AME and PA make a warning sound to admins when overloaded along with the warning text (#21267)
* WOOP WOOP * i forgor to add this * I totally did not steal code * OH FUCK * Ok i'm done using webedit. * Reviews and AME anti spam * make sound shorter
This commit is contained in:
@@ -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
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public TimeSpan UpdateUIPeriod = TimeSpan.FromSeconds(3.0);
|
||||
|
||||
/// <summary>
|
||||
/// Time at which the admin alarm sound effect can next be played.
|
||||
/// </summary>
|
||||
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
|
||||
public TimeSpan EffectCooldown;
|
||||
|
||||
/// <summary>
|
||||
/// Time between admin alarm sound effects. Prevents spam
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public TimeSpan CooldownDuration = TimeSpan.FromSeconds(10f);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// Time at which the admin alarm sound effect can next be played.
|
||||
/// </summary>
|
||||
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
|
||||
public TimeSpan EffectCooldown;
|
||||
|
||||
/// <summary>
|
||||
/// Time between admin alarm sound effects. Prevents spam
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public TimeSpan CooldownDuration = TimeSpan.FromSeconds(10f);
|
||||
|
||||
/// <summary>
|
||||
/// Whether the PA can be turned on.
|
||||
/// Modified by <see cref="ParticleAcceleratorPowerWireAction"/>.
|
||||
|
||||
@@ -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<ParticleAcceleratorControlBoxComponent, ComponentStartup>(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BIN
Resources/Audio/Misc/adminlarm.ogg
Normal file
BIN
Resources/Audio/Misc/adminlarm.ogg
Normal file
Binary file not shown.
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user