From 49f011457424398f822ab643411e7d8aac17c58f Mon Sep 17 00:00:00 2001 From: rhailrake <49613070+rhailrake@users.noreply.github.com> Date: Thu, 27 Apr 2023 06:10:06 +0600 Subject: [PATCH] [add] spawn logs --- .../CommunicationsConsoleSystem.cs | 2 +- Content.Server/Sandbox/SandboxSystem.cs | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/Content.Server/Communications/CommunicationsConsoleSystem.cs b/Content.Server/Communications/CommunicationsConsoleSystem.cs index 017a539f32..f441578340 100644 --- a/Content.Server/Communications/CommunicationsConsoleSystem.cs +++ b/Content.Server/Communications/CommunicationsConsoleSystem.cs @@ -293,7 +293,7 @@ namespace Content.Server.Communications if (message.Session.AttachedEntity is not {Valid: true} mob) return; - + //WD-EDIT if (!OnStationCallOrRecall(uid)) { diff --git a/Content.Server/Sandbox/SandboxSystem.cs b/Content.Server/Sandbox/SandboxSystem.cs index 194cf59843..9dfab919ff 100644 --- a/Content.Server/Sandbox/SandboxSystem.cs +++ b/Content.Server/Sandbox/SandboxSystem.cs @@ -3,7 +3,9 @@ using Content.Server.GameTicking; using Content.Shared.Access; using Content.Shared.Access.Components; using Content.Shared.Access.Systems; +using Content.Shared.Administration.Logs; using Content.Shared.Containers.ItemSlots; +using Content.Shared.Database; using Content.Shared.Hands.Components; using Content.Shared.Hands.EntitySystems; using Content.Shared.Inventory; @@ -29,6 +31,10 @@ namespace Content.Server.Sandbox [Dependency] private readonly GameTicker _ticker = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!; + //WD-EDIT + [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; + //WD-EDIT + private bool _isSandboxEnabled; [ViewVariables(VVAccess.ReadWrite)] @@ -56,6 +62,33 @@ namespace Content.Server.Sandbox _placementManager.AllowPlacementFunc = placement => { + //WD-EDIT + + //Logger.Info($"{placement.MsgChannel.UserName} spawned {placement.EntityTemplateName} on position {placement.EntityCoordinates}"); + var data = _playerManager.GetSessionByUserId(placement.MsgChannel.UserId); + var playerUid = data.AttachedEntity.GetValueOrDefault(); + var coordinates = placement.EntityCoordinates; + switch (placement.PlaceType) + { + case PlacementManagerMessage.StartPlacement: + break; + case PlacementManagerMessage.CancelPlacement: + break; + case PlacementManagerMessage.RequestPlacement: + _adminLogger.Add(LogType.EntitySpawn, LogImpact.High, $"{placement.EntityTemplateName} was spawned by" + + $" {ToPrettyString(playerUid):player} at " + + $"{ToPrettyString(coordinates.EntityId):entity} X={coordinates.X}, Y={coordinates.Y}"); + break; + case PlacementManagerMessage.RequestEntRemove: + _adminLogger.Add(LogType.EntitySpawn, LogImpact.High, $"{ToPrettyString(placement.EntityUid):entity} was deleted by {ToPrettyString(playerUid):player}"); + break; + case PlacementManagerMessage.RequestRectRemove: + break; + } + _adminLogger.Add(LogType.EntitySpawn, $"{ToPrettyString(placement.EntityUid):entity} spawned"); + + //WD-EDIT + if (IsSandboxEnabled) { return true;