Adds logging to stripping and construction starting (#11952)

This commit is contained in:
Júlio César Ueti
2022-10-16 03:32:00 -03:00
committed by GitHub
parent bd44887a87
commit 137e79ee4c
4 changed files with 15 additions and 2 deletions

View File

@@ -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<TransformComponent>(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();
}
}

View File

@@ -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;

View File

@@ -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");
}
}
/// <summary>
@@ -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

View File

@@ -77,4 +77,5 @@ public enum LogType
CableCut = 72,
StorePurchase = 73,
LatticeCut = 74,
Stripping = 75,
}