Adds detailed logging to AME and PA interactions (#10170)

This commit is contained in:
Júlio César Ueti
2022-07-30 23:47:42 -03:00
committed by GitHub
parent da1969b5b8
commit d30c3b0bbc
2 changed files with 30 additions and 2 deletions

View File

@@ -1,8 +1,11 @@
using System.Linq;
using Content.Server.Administration.Logs;
using Content.Server.Mind.Components;
using Content.Server.NodeContainer;
using Content.Server.Power.Components;
using Content.Server.UserInterface;
using Content.Shared.AME;
using Content.Shared.Database;
using Content.Shared.Hands.EntitySystems;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
@@ -16,6 +19,7 @@ namespace Content.Server.AME.Components
{
[Dependency] private readonly IEntityManager _entities = default!;
[Dependency] private readonly IEntitySystemManager _sysMan = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(AMEControllerUiKey.Key);
private bool _injecting;
@@ -167,6 +171,19 @@ namespace Content.Server.AME.Components
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();
UpdateUserInterface();