Adds detailed logging to AME and PA interactions (#10170)
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Content.Server.Administration.Logs;
|
||||||
|
using Content.Server.Mind.Components;
|
||||||
using Content.Server.NodeContainer;
|
using Content.Server.NodeContainer;
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
using Content.Shared.AME;
|
using Content.Shared.AME;
|
||||||
|
using Content.Shared.Database;
|
||||||
using Content.Shared.Hands.EntitySystems;
|
using Content.Shared.Hands.EntitySystems;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
@@ -16,6 +19,7 @@ namespace Content.Server.AME.Components
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entities = default!;
|
[Dependency] private readonly IEntityManager _entities = default!;
|
||||||
[Dependency] private readonly IEntitySystemManager _sysMan = default!;
|
[Dependency] private readonly IEntitySystemManager _sysMan = default!;
|
||||||
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
|
|
||||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(AMEControllerUiKey.Key);
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(AMEControllerUiKey.Key);
|
||||||
private bool _injecting;
|
private bool _injecting;
|
||||||
@@ -167,6 +171,19 @@ namespace Content.Server.AME.Components
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Logging
|
||||||
|
_entities.TryGetComponent(player, out MindComponent? mindComponent);
|
||||||
|
if (mindComponent != null)
|
||||||
|
{
|
||||||
|
var humanReadableState = _injecting ? "Inject" : "Not inject";
|
||||||
|
|
||||||
|
if (msg.Button == UiButton.IncreaseFuel || msg.Button == UiButton.DecreaseFuel)
|
||||||
|
_adminLogger.Add(LogType.Action, LogImpact.Extreme, $"{_entities.ToPrettyString(mindComponent.Owner):player} has set the AME to inject {InjectionAmount} while set to {humanReadableState}");
|
||||||
|
|
||||||
|
if (msg.Button == UiButton.ToggleInjection)
|
||||||
|
_adminLogger.Add(LogType.Action, LogImpact.Extreme, $"{_entities.ToPrettyString(mindComponent.Owner):player} has set the AME to {humanReadableState}");
|
||||||
|
}
|
||||||
|
|
||||||
GetAMENodeGroup()?.UpdateCoreVisuals();
|
GetAMENodeGroup()?.UpdateCoreVisuals();
|
||||||
|
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using Content.Server.Administration.Logs;
|
||||||
|
using Content.Server.Mind.Components;
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Server.Power.EntitySystems;
|
using Content.Server.Power.EntitySystems;
|
||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
|
using Content.Shared.Database;
|
||||||
// using Content.Server.WireHacking;
|
// using Content.Server.WireHacking;
|
||||||
using Content.Shared.Singularity.Components;
|
using Content.Shared.Singularity.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
// using static Content.Shared.Wires.SharedWiresComponent;
|
// using static Content.Shared.Wires.SharedWiresComponent;
|
||||||
@@ -25,6 +29,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private BoundUserInterface? UserInterface => Owner.GetUIOrNull(ParticleAcceleratorControlBoxUiKey.Key);
|
private BoundUserInterface? UserInterface => Owner.GetUIOrNull(ParticleAcceleratorControlBoxUiKey.Key);
|
||||||
@@ -143,7 +148,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ParticleAcceleratorSetPowerStateMessage stateMessage:
|
case ParticleAcceleratorSetPowerStateMessage stateMessage:
|
||||||
SetStrength(stateMessage.State);
|
SetStrength(stateMessage.State, obj.Session);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ParticleAcceleratorRescanPartsMessage _:
|
case ParticleAcceleratorRescanPartsMessage _:
|
||||||
@@ -501,7 +506,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
|||||||
UpdatePartVisualStates();
|
UpdatePartVisualStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetStrength(ParticleAcceleratorPowerState state)
|
public void SetStrength(ParticleAcceleratorPowerState state, IPlayerSession? playerSession = null)
|
||||||
{
|
{
|
||||||
if (_wireStrengthCut)
|
if (_wireStrengthCut)
|
||||||
{
|
{
|
||||||
@@ -517,6 +522,12 @@ namespace Content.Server.ParticleAccelerator.Components
|
|||||||
UpdateAppearance();
|
UpdateAppearance();
|
||||||
UpdatePartVisualStates();
|
UpdatePartVisualStates();
|
||||||
|
|
||||||
|
// Logging
|
||||||
|
_entMan.TryGetComponent(playerSession?.AttachedEntity, out MindComponent? mindComponent);
|
||||||
|
var humanReadableState = _isEnabled ? "Turned On" : "Turned Off";
|
||||||
|
if(mindComponent != null && state == MaxPower)
|
||||||
|
_adminLogger.Add(LogType.Action, LogImpact.Extreme, $"{_entMan.ToPrettyString(mindComponent.Owner):player} has set the strength of the Particle Accelerator to a dangerous level while the PA was {humanReadableState}");
|
||||||
|
|
||||||
if (_isEnabled)
|
if (_isEnabled)
|
||||||
{
|
{
|
||||||
UpdatePowerDraw();
|
UpdatePowerDraw();
|
||||||
|
|||||||
Reference in New Issue
Block a user