Add admin log for ghost warping (#33636)

This commit is contained in:
DrSmugleaf
2024-11-29 01:46:24 -08:00
committed by GitHub
parent 422d1a9d32
commit 3ad227a904
2 changed files with 10 additions and 3 deletions

View File

@@ -1,3 +1,5 @@
using System.Linq;
using System.Numerics;
using Content.Server.Administration.Logs; using Content.Server.Administration.Logs;
using Content.Server.Chat.Managers; using Content.Server.Chat.Managers;
using Content.Server.GameTicking; using Content.Server.GameTicking;
@@ -32,14 +34,13 @@ using Robust.Shared.Physics.Systems;
using Robust.Shared.Player; using Robust.Shared.Player;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Timing; using Robust.Shared.Timing;
using System.Linq;
using System.Numerics;
namespace Content.Server.Ghost namespace Content.Server.Ghost
{ {
public sealed class GhostSystem : SharedGhostSystem public sealed class GhostSystem : SharedGhostSystem
{ {
[Dependency] private readonly SharedActionsSystem _actions = default!; [Dependency] private readonly SharedActionsSystem _actions = default!;
[Dependency] private readonly IAdminLogManager _adminLog = default!;
[Dependency] private readonly SharedEyeSystem _eye = default!; [Dependency] private readonly SharedEyeSystem _eye = default!;
[Dependency] private readonly FollowerSystem _followerSystem = default!; [Dependency] private readonly FollowerSystem _followerSystem = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;
@@ -323,6 +324,8 @@ namespace Content.Server.Ghost
private void WarpTo(EntityUid uid, EntityUid target) private void WarpTo(EntityUid uid, EntityUid target)
{ {
_adminLog.Add(LogType.GhostWarp, $"{ToPrettyString(uid)} ghost warped to {ToPrettyString(target)}");
if ((TryComp(target, out WarpPointComponent? warp) && warp.Follow) || HasComp<MobStateComponent>(target)) if ((TryComp(target, out WarpPointComponent? warp) && warp.Follow) || HasComp<MobStateComponent>(target))
{ {
_followerSystem.StartFollowingEntity(uid, target); _followerSystem.StartFollowingEntity(uid, target);

View File

@@ -121,4 +121,8 @@ public enum LogType
/// </summary> /// </summary>
ExplosionHit = 94, ExplosionHit = 94,
/// <summary>
/// A ghost warped to an entity through the ghost warp menu.
/// </summary>
GhostWarp = 95,
} }