From 137e79ee4cd787d61312a45fb0678289db15616e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlio=20C=C3=A9sar=20Ueti?= <52474532+Mirino97@users.noreply.github.com> Date: Sun, 16 Oct 2022 03:32:00 -0300 Subject: [PATCH] Adds logging to stripping and construction starting (#11952) --- .../Construction/ConstructionSystem.Initial.cs | 4 +++- .../Construction/ConstructionSystem.Interactions.cs | 2 +- Content.Server/Strip/StrippableSystem.cs | 10 ++++++++++ Content.Shared.Database/LogType.cs | 1 + 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Content.Server/Construction/ConstructionSystem.Initial.cs b/Content.Server/Construction/ConstructionSystem.Initial.cs index 46699d20c8..543a4264c9 100644 --- a/Content.Server/Construction/ConstructionSystem.Initial.cs +++ b/Content.Server/Construction/ConstructionSystem.Initial.cs @@ -1,6 +1,7 @@ using System.IO; using System.Linq; using System.Threading.Tasks; +using Content.Server.Administration.Logs; using Content.Server.Construction.Components; using Content.Server.DoAfter; using Content.Server.Hands.Components; @@ -10,6 +11,7 @@ using Content.Shared.Construction; using Content.Shared.Construction.Prototypes; using Content.Shared.Construction.Steps; using Content.Shared.Coordinates; +using Content.Shared.Database; using Content.Shared.Hands.EntitySystems; using Content.Shared.Interaction; using Content.Shared.Inventory; @@ -481,7 +483,7 @@ namespace Content.Server.Construction EntityManager.GetComponent(structure).Anchored = wasAnchored; RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack)); - + _adminLogger.Add(LogType.Construction, LogImpact.Low, $"{ToPrettyString(user):player} has started construction on the ghost of a {ev.PrototypeName}"); Cleanup(); } } diff --git a/Content.Server/Construction/ConstructionSystem.Interactions.cs b/Content.Server/Construction/ConstructionSystem.Interactions.cs index 04f3c09ae7..ae3351234a 100644 --- a/Content.Server/Construction/ConstructionSystem.Interactions.cs +++ b/Content.Server/Construction/ConstructionSystem.Interactions.cs @@ -172,7 +172,7 @@ namespace Content.Server.Construction ChangeNode(uid, user, edge.Target, true, construction); if (ev is ConstructionDoAfterComplete event1 && event1.WrappedEvent is InteractUsingEvent event2) - _adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(event2.User):player} changed {ToPrettyString(uid):entity}'s node to {edge.Target}"); + _adminLogger.Add(LogType.Construction, LogImpact.Low, $"{ToPrettyString(event2.User):player} changed {ToPrettyString(uid):entity}'s node to {edge.Target}"); } return HandleResult.True; diff --git a/Content.Server/Strip/StrippableSystem.cs b/Content.Server/Strip/StrippableSystem.cs index 4660d4189f..1229e1c1bb 100644 --- a/Content.Server/Strip/StrippableSystem.cs +++ b/Content.Server/Strip/StrippableSystem.cs @@ -15,6 +15,8 @@ using Content.Shared.Verbs; using Robust.Server.GameObjects; using Robust.Shared.Player; using System.Threading; +using Content.Server.Administration.Logs; +using Content.Shared.Database; namespace Content.Server.Strip { @@ -26,6 +28,7 @@ namespace Content.Server.Strip [Dependency] private readonly SharedPopupSystem _popupSystem = default!; [Dependency] private readonly EnsnareableSystem _ensnaring = default!; [Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; // TODO: ECS popups. Not all of these have ECS equivalents yet. @@ -203,7 +206,11 @@ namespace Content.Server.Strip && _handsSystem.TryDrop(user, userHands.ActiveHand, handsComp: userHands)) { _inventorySystem.TryEquip(user, component.Owner, held, slot); + + _adminLogger.Add(LogType.Stripping, LogImpact.Medium, $"{ToPrettyString(user):user} has placed the item {ToPrettyString(held):item} in {ToPrettyString(component.Owner):target}'s {slot} slot"); } + + } /// @@ -265,6 +272,7 @@ namespace Content.Server.Strip _handsSystem.TryDrop(user, checkActionBlocker: false, handsComp: userHands); _handsSystem.TryPickup(component.Owner, held, handName, checkActionBlocker: false, animateUser: true, handsComp: hands); + _adminLogger.Add(LogType.Stripping, LogImpact.Medium, $"{ToPrettyString(user):user} has placed the item {ToPrettyString(held):item} in {ToPrettyString(component.Owner):target}'s hands"); // hand update will trigger strippable update } @@ -336,6 +344,7 @@ namespace Content.Server.Strip RaiseLocalEvent(item.Value, new DroppedEvent(user), true); _handsSystem.PickupOrDrop(user, item.Value); + _adminLogger.Add(LogType.Stripping, LogImpact.Medium, $"{ToPrettyString(user):user} has stripped the item {ToPrettyString(item.Value):item} from {ToPrettyString(component.Owner):target}"); } } @@ -399,6 +408,7 @@ namespace Content.Server.Strip _handsSystem.TryDrop(component.Owner, hand, checkActionBlocker: false, handsComp: hands); _handsSystem.PickupOrDrop(user, held, handsComp: userHands); // hand update will trigger strippable update + _adminLogger.Add(LogType.Stripping, LogImpact.Medium, $"{ToPrettyString(user):user} has stripped the item {ToPrettyString(held):item} from {ToPrettyString(component.Owner):target}"); } private sealed class OpenStrippingCompleteEvent diff --git a/Content.Shared.Database/LogType.cs b/Content.Shared.Database/LogType.cs index 17bf016801..e310e7d240 100644 --- a/Content.Shared.Database/LogType.cs +++ b/Content.Shared.Database/LogType.cs @@ -77,4 +77,5 @@ public enum LogType CableCut = 72, StorePurchase = 73, LatticeCut = 74, + Stripping = 75, }