mirror of
https://github.com/space-wizards/space-station-14.git
synced 2026-02-15 03:31:30 +01:00
Admin log now shows APC power toggle interactions (#41839)
Added logging to the APC's toggle interaction
This commit is contained in:
@@ -2,7 +2,9 @@ using Content.Server.Popups;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.Pow3r;
|
||||
using Content.Shared.Access.Systems;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.APC;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Emag.Systems;
|
||||
using Content.Shared.Emp;
|
||||
using Content.Shared.Popups;
|
||||
@@ -18,6 +20,7 @@ namespace Content.Server.Power.EntitySystems;
|
||||
public sealed class ApcSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly AccessReaderSystem _accessReader = default!;
|
||||
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly EmagSystem _emag = default!;
|
||||
[Dependency] private readonly PopupSystem _popup = default!;
|
||||
@@ -112,7 +115,7 @@ public sealed class ApcSystem : EntitySystem
|
||||
|
||||
if (_accessReader.IsAllowed(args.Actor, uid))
|
||||
{
|
||||
ApcToggleBreaker(uid, component);
|
||||
ApcToggleBreaker(uid, component, user: args.Actor);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -121,7 +124,12 @@ public sealed class ApcSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
public void ApcToggleBreaker(EntityUid uid, ApcComponent? apc = null, PowerNetworkBatteryComponent? battery = null)
|
||||
/// <summary>Toggles the enabled state of the APC's main breaker.</summary>
|
||||
public void ApcToggleBreaker(
|
||||
EntityUid uid,
|
||||
ApcComponent? apc = null,
|
||||
PowerNetworkBatteryComponent? battery = null,
|
||||
EntityUid? user = null)
|
||||
{
|
||||
if (!Resolve(uid, ref apc, ref battery))
|
||||
return;
|
||||
@@ -134,6 +142,13 @@ public sealed class ApcSystem : EntitySystem
|
||||
|
||||
UpdateUIState(uid, apc);
|
||||
_audio.PlayPvs(apc.OnReceiveMessageSound, uid, AudioParams.Default.WithVolume(-2f));
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
var humanReadableState = apc.MainBreakerEnabled ? "Enabled" : "Disabled";
|
||||
_adminLogger.Add(LogType.ItemConfigure, LogImpact.Medium,
|
||||
$"{ToPrettyString(user):user} set the main breaker state of {ToPrettyString(uid):entity} to {humanReadableState:state}.");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEmagged(EntityUid uid, ApcComponent comp, ref GotEmaggedEvent args)
|
||||
|
||||
Reference in New Issue
Block a user