From fe1880062bc9c4327325d7bfc67307806a1c42ff Mon Sep 17 00:00:00 2001 From: Jacob Tong <10494922+ShadowCommander@users.noreply.github.com> Date: Wed, 31 Aug 2022 23:52:24 -0700 Subject: [PATCH] Add logs to lattice cutting (#10956) --- Content.Server/Tools/ToolSystem.LatticeCutting.cs | 11 +++++++++-- Content.Shared.Database/LogType.cs | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Content.Server/Tools/ToolSystem.LatticeCutting.cs b/Content.Server/Tools/ToolSystem.LatticeCutting.cs index 4bf3577932..1e9b2d6b47 100644 --- a/Content.Server/Tools/ToolSystem.LatticeCutting.cs +++ b/Content.Server/Tools/ToolSystem.LatticeCutting.cs @@ -1,5 +1,7 @@ using System.Threading; +using Content.Server.Administration.Logs; using Content.Server.Tools.Components; +using Content.Shared.Database; using Content.Shared.Interaction; using Content.Shared.Maps; using Content.Shared.Tools.Components; @@ -9,6 +11,8 @@ namespace Content.Server.Tools; public sealed partial class ToolSystem { + [Dependency] private readonly IAdminLogManager _adminLogger = default!; + private void InitializeLatticeCutting() { SubscribeLocalEvent(OnLatticeCuttingAfterInteract); @@ -37,6 +41,7 @@ public sealed partial class ToolSystem return; tile.CutTile(_mapManager, _tileDefinitionManager, EntityManager); + _adminLogger.Add(LogType.LatticeCut, LogImpact.Medium, $"{ToPrettyString(args.User):user} cut the lattice at {args.Coordinates:target}"); } private void OnLatticeCuttingAfterInteract(EntityUid uid, LatticeCuttingComponent component, @@ -81,7 +86,8 @@ public sealed partial class ToolSystem if (!UseTool(component.Owner, user, null, 0f, component.Delay, new[] {component.QualityNeeded}, new LatticeCuttingCompleteEvent { - Coordinates = clickLocation + Coordinates = clickLocation, + User = user }, new LatticeCuttingCancelledEvent(), toolComponent: tool, doAfterEventTarget: component.Owner, cancelToken: tokenSource.Token)) component.CancelTokenSource = null; @@ -91,7 +97,8 @@ public sealed partial class ToolSystem private sealed class LatticeCuttingCompleteEvent : EntityEventArgs { - public EntityCoordinates Coordinates { get; set; } + public EntityCoordinates Coordinates; + public EntityUid User; } private sealed class LatticeCuttingCancelledEvent : EntityEventArgs diff --git a/Content.Shared.Database/LogType.cs b/Content.Shared.Database/LogType.cs index 2373126830..17bf016801 100644 --- a/Content.Shared.Database/LogType.cs +++ b/Content.Shared.Database/LogType.cs @@ -76,4 +76,5 @@ public enum LogType Identity = 71, CableCut = 72, StorePurchase = 73, + LatticeCut = 74, }