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:
committed by
GitHub
parent
083d812e69
commit
9af4e63a3b
@@ -1,11 +1,14 @@
|
|||||||
|
using Content.Server.Administration.Logs;
|
||||||
using Content.Shared.CartridgeLoader;
|
using Content.Shared.CartridgeLoader;
|
||||||
using Content.Shared.CartridgeLoader.Cartridges;
|
using Content.Shared.CartridgeLoader.Cartridges;
|
||||||
|
using Content.Shared.Database;
|
||||||
|
|
||||||
namespace Content.Server.CartridgeLoader.Cartridges;
|
namespace Content.Server.CartridgeLoader.Cartridges;
|
||||||
|
|
||||||
public sealed class NotekeeperCartridgeSystem : EntitySystem
|
public sealed class NotekeeperCartridgeSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly CartridgeLoaderSystem? _cartridgeLoaderSystem = default!;
|
[Dependency] private readonly CartridgeLoaderSystem? _cartridgeLoaderSystem = default!;
|
||||||
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -36,16 +39,19 @@ public sealed class NotekeeperCartridgeSystem : EntitySystem
|
|||||||
if (message.Action == NotekeeperUiAction.Add)
|
if (message.Action == NotekeeperUiAction.Add)
|
||||||
{
|
{
|
||||||
component.Notes.Add(message.Note);
|
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
|
else
|
||||||
{
|
{
|
||||||
component.Notes.Remove(message.Note);
|
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);
|
UpdateUiState(uid, GetEntity(args.LoaderUid), component);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void UpdateUiState(EntityUid uid, EntityUid loaderUid, NotekeeperCartridgeComponent? component)
|
private void UpdateUiState(EntityUid uid, EntityUid loaderUid, NotekeeperCartridgeComponent? component)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref component))
|
if (!Resolve(uid, ref component))
|
||||||
|
|||||||
@@ -439,4 +439,9 @@ public enum LogType
|
|||||||
/// A ghost warped to an entity through the ghost warp menu.
|
/// A ghost warped to an entity through the ghost warp menu.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
GhostWarp = 95,
|
GhostWarp = 95,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A player interacted with a PDA or its cartridge component
|
||||||
|
/// </summary>
|
||||||
|
PdaInteract = 96,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user