Fix ghost actions disappearing when toggling visibility of other ghosts (#21033)

This commit is contained in:
DrSmugleaf
2023-10-20 00:05:33 -07:00
committed by GitHub
parent 5ae3a02ed5
commit 5734f02de5
2 changed files with 8 additions and 32 deletions

View File

@@ -6,7 +6,6 @@ using Content.Server.Mind;
using Content.Server.Roles.Jobs;
using Content.Server.Warps;
using Content.Shared.Actions;
using Content.Shared.Administration;
using Content.Shared.Examine;
using Content.Shared.Eye;
using Content.Shared.Follower;
@@ -16,11 +15,9 @@ using Content.Shared.Mind.Components;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Movement.Events;
using Content.Shared.Popups;
using Content.Shared.Storage.Components;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Timing;
@@ -357,28 +354,4 @@ namespace Content.Server.Ghost
return ghostBoo.Handled;
}
}
[AnyCommand]
public sealed class ToggleGhostVisibility : IConsoleCommand
{
public string Command => "toggleghosts";
public string Description => "Toggles ghost visibility";
public string Help => $"{Command}";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player == null)
shell.WriteLine("You can only toggle ghost visibility on a client.");
var entityManager = IoCManager.Resolve<IEntityManager>();
var uid = shell.Player?.AttachedEntity;
if (uid == null
|| !entityManager.HasComponent<GhostComponent>(uid)
|| !entityManager.TryGetComponent<EyeComponent>(uid, out var eyeComponent))
return;
entityManager.System<EyeSystem>().SetVisibilityMask(uid.Value, eyeComponent.VisibilityMask ^ (int) VisibilityFlags.Ghost, eyeComponent);
}
}
}