Log GhostRole takeovers (#6089)

* Log GhostRole takeovers

* Remove entity word
This commit is contained in:
ShadowCommander
2022-01-09 17:54:36 -08:00
committed by GitHub
parent 2125f1dda9
commit 951a810fad
2 changed files with 8 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using Content.Server.Administration;
using Content.Server.Administration.Logs;
using Content.Server.EUI;
using Content.Server.Ghost.Components;
using Content.Server.Ghost.Roles.Components;
@@ -8,6 +9,7 @@ using Content.Server.Mind.Components;
using Content.Server.MobState.States;
using Content.Server.Players;
using Content.Shared.Administration;
using Content.Shared.Database;
using Content.Shared.GameTicking;
using Content.Shared.Ghost;
using Content.Shared.Ghost.Roles;
@@ -29,6 +31,7 @@ namespace Content.Server.Ghost.Roles
{
[Dependency] private readonly EuiManager _euiManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly AdminLogSystem _adminLogSystem = default!;
private uint _nextRoleIdentifier;
private bool _needsUpdateGhostRoleCount = true;
@@ -178,6 +181,10 @@ namespace Content.Server.Ghost.Roles
{
if (!_ghostRoles.TryGetValue(identifier, out var role)) return;
if (!role.Take(player)) return;
if (player.AttachedEntity != null)
_adminLogSystem.Add(LogType.GhostRoleTaken, LogImpact.Low, $"{player:player} took the {role.RoleName:roleName} ghost role {ToPrettyString(player.AttachedEntity.Value):entity}");
CloseEui(player);
}

View File

@@ -61,4 +61,5 @@ public enum LogType
AtmosFilterChanged = 57,
AtmosRatioChanged = 58,
Emitter = 59,
GhostRoleTaken = 60,
}