Add logs to lattice cutting (#10956)
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using Content.Server.Administration.Logs;
|
||||||
using Content.Server.Tools.Components;
|
using Content.Server.Tools.Components;
|
||||||
|
using Content.Shared.Database;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
using Content.Shared.Tools.Components;
|
using Content.Shared.Tools.Components;
|
||||||
@@ -9,6 +11,8 @@ namespace Content.Server.Tools;
|
|||||||
|
|
||||||
public sealed partial class ToolSystem
|
public sealed partial class ToolSystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
|
|
||||||
private void InitializeLatticeCutting()
|
private void InitializeLatticeCutting()
|
||||||
{
|
{
|
||||||
SubscribeLocalEvent<LatticeCuttingComponent, AfterInteractEvent>(OnLatticeCuttingAfterInteract);
|
SubscribeLocalEvent<LatticeCuttingComponent, AfterInteractEvent>(OnLatticeCuttingAfterInteract);
|
||||||
@@ -37,6 +41,7 @@ public sealed partial class ToolSystem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
tile.CutTile(_mapManager, _tileDefinitionManager, EntityManager);
|
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,
|
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},
|
if (!UseTool(component.Owner, user, null, 0f, component.Delay, new[] {component.QualityNeeded},
|
||||||
new LatticeCuttingCompleteEvent
|
new LatticeCuttingCompleteEvent
|
||||||
{
|
{
|
||||||
Coordinates = clickLocation
|
Coordinates = clickLocation,
|
||||||
|
User = user
|
||||||
}, new LatticeCuttingCancelledEvent(), toolComponent: tool, doAfterEventTarget: component.Owner,
|
}, new LatticeCuttingCancelledEvent(), toolComponent: tool, doAfterEventTarget: component.Owner,
|
||||||
cancelToken: tokenSource.Token))
|
cancelToken: tokenSource.Token))
|
||||||
component.CancelTokenSource = null;
|
component.CancelTokenSource = null;
|
||||||
@@ -91,7 +97,8 @@ public sealed partial class ToolSystem
|
|||||||
|
|
||||||
private sealed class LatticeCuttingCompleteEvent : EntityEventArgs
|
private sealed class LatticeCuttingCompleteEvent : EntityEventArgs
|
||||||
{
|
{
|
||||||
public EntityCoordinates Coordinates { get; set; }
|
public EntityCoordinates Coordinates;
|
||||||
|
public EntityUid User;
|
||||||
}
|
}
|
||||||
|
|
||||||
private sealed class LatticeCuttingCancelledEvent : EntityEventArgs
|
private sealed class LatticeCuttingCancelledEvent : EntityEventArgs
|
||||||
|
|||||||
@@ -76,4 +76,5 @@ public enum LogType
|
|||||||
Identity = 71,
|
Identity = 71,
|
||||||
CableCut = 72,
|
CableCut = 72,
|
||||||
StorePurchase = 73,
|
StorePurchase = 73,
|
||||||
|
LatticeCut = 74,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user