Add welding logs (#13299)

This commit is contained in:
Chief-Engineer
2023-01-02 22:39:48 -06:00
committed by GitHub
parent 90f8db67fa
commit 1a0c3e8386

View File

@@ -1,4 +1,6 @@
using Content.Server.Administration.Logs;
using Content.Server.Tools.Components;
using Content.Shared.Database;
using Content.Shared.Examine;
using Content.Shared.Interaction;
using Content.Shared.Tools.Components;
@@ -7,6 +9,7 @@ namespace Content.Server.Tools.Systems;
public sealed class WeldableSystem : EntitySystem
{
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly ToolSystem _toolSystem = default!;
public override void Initialize()
@@ -64,6 +67,9 @@ public sealed class WeldableSystem : EntitySystem
component.WeldingTime.Seconds, component.WeldingQuality,
new WeldFinishedEvent(user, tool), new WeldCancelledEvent(), uid);
// Log attempt
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(user):user} is {(component.IsWelded ? "un" : "")}welding {ToPrettyString(uid):target} at {Transform(uid).Coordinates:targetlocation}");
return true;
}
@@ -79,6 +85,9 @@ public sealed class WeldableSystem : EntitySystem
RaiseLocalEvent(uid, new WeldableChangedEvent(component.IsWelded), true);
UpdateAppearance(uid, component);
// Log success
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(args.User):user} {(!component.IsWelded ? "un" : "")}welded {ToPrettyString(uid):target}");
}
private void OnWeldCanceled(EntityUid uid, WeldableComponent component, WeldCancelledEvent args)