added basic admin logs for PDA notekeeper notes (#34118)

* added basic admin logs for PDA notekeeper notes

* formatting

* added new LogType 'PdaInteract' and changed PDA notekeeper logs to it

---------

Co-authored-by: dylanhunter <dylan2.whittingham@live.uwe.ac.uk>
This commit is contained in:
Dylan Hunter Whittingham
2025-01-02 16:16:44 +00:00
committed by GitHub
parent 083d812e69
commit 9af4e63a3b
2 changed files with 12 additions and 1 deletions

View File

@@ -1,11 +1,14 @@
using Content.Server.Administration.Logs;
using Content.Shared.CartridgeLoader;
using Content.Shared.CartridgeLoader.Cartridges;
using Content.Shared.Database;
namespace Content.Server.CartridgeLoader.Cartridges;
public sealed class NotekeeperCartridgeSystem : EntitySystem
{
[Dependency] private readonly CartridgeLoaderSystem? _cartridgeLoaderSystem = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
public override void Initialize()
{
@@ -36,16 +39,19 @@ public sealed class NotekeeperCartridgeSystem : EntitySystem
if (message.Action == NotekeeperUiAction.Add)
{
component.Notes.Add(message.Note);
_adminLogger.Add(LogType.PdaInteract, LogImpact.Low,
$"{ToPrettyString(args.Actor)} added a note to PDA: '{message.Note}' contained on: {ToPrettyString(uid)}");
}
else
{
component.Notes.Remove(message.Note);
_adminLogger.Add(LogType.PdaInteract, LogImpact.Low,
$"{ToPrettyString(args.Actor)} removed a note from PDA: '{message.Note}' was contained on: {ToPrettyString(uid)}");
}
UpdateUiState(uid, GetEntity(args.LoaderUid), component);
}
private void UpdateUiState(EntityUid uid, EntityUid loaderUid, NotekeeperCartridgeComponent? component)
{
if (!Resolve(uid, ref component))

View File

@@ -439,4 +439,9 @@ public enum LogType
/// A ghost warped to an entity through the ghost warp menu.
/// </summary>
GhostWarp = 95,
/// <summary>
/// A player interacted with a PDA or its cartridge component
/// </summary>
PdaInteract = 96,
}