add forceghost admin command (#35518)

* add forceghost admin command

* sweep linq under the rug

* braces

* ûse LocalizedEntityCommands
This commit is contained in:
slarticodefast
2025-03-08 03:39:04 +01:00
committed by GitHub
parent cca537fb33
commit 531f5619be
4 changed files with 76 additions and 4 deletions

View File

@@ -499,7 +499,7 @@ namespace Content.Server.Ghost
return ghost;
}
public bool OnGhostAttempt(EntityUid mindId, bool canReturnGlobal, bool viaCommand = false, MindComponent? mind = null)
public bool OnGhostAttempt(EntityUid mindId, bool canReturnGlobal, bool viaCommand = false, bool forced = false, MindComponent? mind = null)
{
if (!Resolve(mindId, ref mind))
return false;
@@ -507,7 +507,12 @@ namespace Content.Server.Ghost
var playerEntity = mind.CurrentEntity;
if (playerEntity != null && viaCommand)
_adminLog.Add(LogType.Mind, $"{EntityManager.ToPrettyString(playerEntity.Value):player} is attempting to ghost via command");
{
if (forced)
_adminLog.Add(LogType.Mind, $"{EntityManager.ToPrettyString(playerEntity.Value):player} was forced to ghost via command");
else
_adminLog.Add(LogType.Mind, $"{EntityManager.ToPrettyString(playerEntity.Value):player} is attempting to ghost via command");
}
var handleEv = new GhostAttemptHandleEvent(mind, canReturnGlobal);
RaiseLocalEvent(handleEv);
@@ -516,7 +521,7 @@ namespace Content.Server.Ghost
if (handleEv.Handled)
return handleEv.Result;
if (mind.PreventGhosting)
if (mind.PreventGhosting && !forced)
{
if (mind.Session != null) // Logging is suppressed to prevent spam from ghost attempts caused by movement attempts
{