From 5eadce16ecd9904e02c9950fe06f68248389f506 Mon Sep 17 00:00:00 2001 From: Chief-Engineer <119664036+Chief-Engineer@users.noreply.github.com> Date: Sat, 24 Dec 2022 18:59:49 -0600 Subject: [PATCH] Add present logs (#13144) * add logs for SpawnItemsOnUse * add logs for RandomGift * add and use EntitySpawn log type --- Content.Server/Holiday/Christmas/RandomGiftSystem.cs | 6 +++++- .../Storage/EntitySystems/SpawnItemsOnUseSystem.cs | 4 ++++ Content.Shared.Database/LogType.cs | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Content.Server/Holiday/Christmas/RandomGiftSystem.cs b/Content.Server/Holiday/Christmas/RandomGiftSystem.cs index a830b85721..29ec823aa7 100644 --- a/Content.Server/Holiday/Christmas/RandomGiftSystem.cs +++ b/Content.Server/Holiday/Christmas/RandomGiftSystem.cs @@ -1,4 +1,6 @@ -using Content.Server.Hands.Systems; +using Content.Server.Administration.Logs; +using Content.Server.Hands.Systems; +using Content.Shared.Database; using Content.Shared.Examine; using Content.Shared.Interaction.Events; using Content.Shared.Item; @@ -20,6 +22,7 @@ public sealed class RandomGiftSystem : EntitySystem [Dependency] private readonly IComponentFactory _componentFactory = default!; [Dependency] private readonly IPrototypeManager _prototype = default!; [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; private readonly List _possibleGiftsSafe = new(); private readonly List _possibleGiftsUnsafe = new(); @@ -54,6 +57,7 @@ public sealed class RandomGiftSystem : EntitySystem var coords = Transform(args.User).Coordinates; var handsEnt = Spawn(component.SelectedEntity, coords); + _adminLogger.Add(LogType.EntitySpawn, LogImpact.Low, $"{ToPrettyString(args.User)} used {ToPrettyString(component.Owner)} which spawned {ToPrettyString(handsEnt)}"); EnsureComp(handsEnt); // For insane mode. if (component.Wrapper is not null) Spawn(component.Wrapper, coords); diff --git a/Content.Server/Storage/EntitySystems/SpawnItemsOnUseSystem.cs b/Content.Server/Storage/EntitySystems/SpawnItemsOnUseSystem.cs index 3a8f67673b..35936fea5c 100644 --- a/Content.Server/Storage/EntitySystems/SpawnItemsOnUseSystem.cs +++ b/Content.Server/Storage/EntitySystems/SpawnItemsOnUseSystem.cs @@ -1,4 +1,6 @@ +using Content.Server.Administration.Logs; using Content.Server.Storage.Components; +using Content.Shared.Database; using Content.Shared.Hands.EntitySystems; using Content.Shared.Interaction.Events; using Content.Shared.Storage; @@ -11,6 +13,7 @@ namespace Content.Server.Storage.EntitySystems public sealed class SpawnItemsOnUseSystem : EntitySystem { [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!; public override void Initialize() @@ -32,6 +35,7 @@ namespace Content.Server.Storage.EntitySystems foreach (var proto in spawnEntities) { entityToPlaceInHands = Spawn(proto, coords); + _adminLogger.Add(LogType.EntitySpawn, LogImpact.Low, $"{ToPrettyString(args.User)} used {ToPrettyString(component.Owner)} which spawned {ToPrettyString(entityToPlaceInHands.Value)}"); } if (component.Sound != null) diff --git a/Content.Shared.Database/LogType.cs b/Content.Shared.Database/LogType.cs index 25b0f3a833..0a17fec264 100644 --- a/Content.Shared.Database/LogType.cs +++ b/Content.Shared.Database/LogType.cs @@ -79,4 +79,5 @@ public enum LogType LatticeCut = 74, Stripping = 75, Stamina = 76, + EntitySpawn = 77, }