Add present logs (#13144)
* add logs for SpawnItemsOnUse * add logs for RandomGift * add and use EntitySpawn log type
This commit is contained in:
@@ -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.Examine;
|
||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
using Content.Shared.Item;
|
using Content.Shared.Item;
|
||||||
@@ -20,6 +22,7 @@ public sealed class RandomGiftSystem : EntitySystem
|
|||||||
[Dependency] private readonly IComponentFactory _componentFactory = default!;
|
[Dependency] private readonly IComponentFactory _componentFactory = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
|
|
||||||
private readonly List<string> _possibleGiftsSafe = new();
|
private readonly List<string> _possibleGiftsSafe = new();
|
||||||
private readonly List<string> _possibleGiftsUnsafe = new();
|
private readonly List<string> _possibleGiftsUnsafe = new();
|
||||||
@@ -54,6 +57,7 @@ public sealed class RandomGiftSystem : EntitySystem
|
|||||||
|
|
||||||
var coords = Transform(args.User).Coordinates;
|
var coords = Transform(args.User).Coordinates;
|
||||||
var handsEnt = Spawn(component.SelectedEntity, coords);
|
var handsEnt = Spawn(component.SelectedEntity, coords);
|
||||||
|
_adminLogger.Add(LogType.EntitySpawn, LogImpact.Low, $"{ToPrettyString(args.User)} used {ToPrettyString(component.Owner)} which spawned {ToPrettyString(handsEnt)}");
|
||||||
EnsureComp<ItemComponent>(handsEnt); // For insane mode.
|
EnsureComp<ItemComponent>(handsEnt); // For insane mode.
|
||||||
if (component.Wrapper is not null)
|
if (component.Wrapper is not null)
|
||||||
Spawn(component.Wrapper, coords);
|
Spawn(component.Wrapper, coords);
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
|
using Content.Server.Administration.Logs;
|
||||||
using Content.Server.Storage.Components;
|
using Content.Server.Storage.Components;
|
||||||
|
using Content.Shared.Database;
|
||||||
using Content.Shared.Hands.EntitySystems;
|
using Content.Shared.Hands.EntitySystems;
|
||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
using Content.Shared.Storage;
|
using Content.Shared.Storage;
|
||||||
@@ -11,6 +13,7 @@ namespace Content.Server.Storage.EntitySystems
|
|||||||
public sealed class SpawnItemsOnUseSystem : EntitySystem
|
public sealed class SpawnItemsOnUseSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -32,6 +35,7 @@ namespace Content.Server.Storage.EntitySystems
|
|||||||
foreach (var proto in spawnEntities)
|
foreach (var proto in spawnEntities)
|
||||||
{
|
{
|
||||||
entityToPlaceInHands = Spawn(proto, coords);
|
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)
|
if (component.Sound != null)
|
||||||
|
|||||||
@@ -79,4 +79,5 @@ public enum LogType
|
|||||||
LatticeCut = 74,
|
LatticeCut = 74,
|
||||||
Stripping = 75,
|
Stripping = 75,
|
||||||
Stamina = 76,
|
Stamina = 76,
|
||||||
|
EntitySpawn = 77,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user