From 554eb830f52fcc5f164e04bb11747cbd29a52ceb Mon Sep 17 00:00:00 2001 From: Chief-Engineer <119664036+Chief-Engineer@users.noreply.github.com> Date: Tue, 25 Apr 2023 08:19:14 -0500 Subject: [PATCH] improve SpecialRespawn logs and add admin alert (#15784) --- Content.Server/Respawn/SpecialRespawnSystem.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Content.Server/Respawn/SpecialRespawnSystem.cs b/Content.Server/Respawn/SpecialRespawnSystem.cs index ec3b3b8537..2d6ebeabf2 100644 --- a/Content.Server/Respawn/SpecialRespawnSystem.cs +++ b/Content.Server/Respawn/SpecialRespawnSystem.cs @@ -1,5 +1,6 @@ using Content.Server.Administration.Logs; using Content.Server.Atmos.EntitySystems; +using Content.Server.Chat.Managers; using Content.Server.GameTicking; using Content.Server.Station.Components; using Content.Server.Station.Systems; @@ -19,6 +20,7 @@ public sealed class SpecialRespawnSystem : SharedSpecialRespawnSystem [Dependency] private readonly AtmosphereSystem _atmosphere = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly StationSystem _stationSystem = default!; + [Dependency] private readonly IChatManager _chat = default!; public override void Initialize() { @@ -84,7 +86,7 @@ public sealed class SpecialRespawnSystem : SharedSpecialRespawnSystem return; if (TryFindRandomTile(entityGridUid.Value, entityMapUid.Value, 10, out var coords)) - Respawn(component.Prototype, coords); + Respawn(uid, component.Prototype, coords); //If the above fails, spawn at the center of the grid on the station else @@ -108,20 +110,21 @@ public sealed class SpecialRespawnSystem : SharedSpecialRespawnSystem break; } - Respawn(component.Prototype, pos); + Respawn(uid, component.Prototype, pos); } } /// /// Respawn the entity and log it. /// + /// The entity being deleted /// The prototype being spawned /// The place where it will be spawned - private void Respawn(string prototype, EntityCoordinates coords) + private void Respawn(EntityUid oldEntity, string prototype, EntityCoordinates coords) { var entity = Spawn(prototype, coords); - var name = MetaData(entity).EntityName; - _adminLog.Add(LogType.Respawn, LogImpact.High, $"{name} was deleted and was respawned at {coords.ToMap(EntityManager)}"); + _adminLog.Add(LogType.Respawn, LogImpact.High, $"{ToPrettyString(oldEntity)} was deleted and was respawned at {coords.ToMap(EntityManager)} as {ToPrettyString(entity)}"); + _chat.SendAdminAlert($"{MetaData(oldEntity).EntityName} was deleted and was respawned as {ToPrettyString(entity)}"); } /// -- 2.51.2