Fix ghost actions disappearing when toggling visibility of other ghosts (#21033)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using Content.Client.Movement.Systems;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
@@ -33,9 +32,10 @@ namespace Content.Client.Ghost
|
||||
|
||||
_ghostVisibility = value;
|
||||
|
||||
foreach (var ghost in EntityQuery<GhostComponent, SpriteComponent>(true))
|
||||
var query = AllEntityQuery<GhostComponent, SpriteComponent>();
|
||||
while (query.MoveNext(out var uid, out _, out var sprite))
|
||||
{
|
||||
ghost.Item2.Visible = true;
|
||||
sprite.Visible = value || uid == _playerManager.LocalPlayer?.ControlledEntity;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,10 @@ namespace Content.Client.Ghost
|
||||
return;
|
||||
|
||||
Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-ghost-visibility-popup"), args.Performer);
|
||||
ToggleGhostVisibility();
|
||||
|
||||
if (uid == _playerManager.LocalPlayer?.ControlledEntity)
|
||||
ToggleGhostVisibility();
|
||||
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
@@ -204,7 +207,7 @@ namespace Content.Client.Ghost
|
||||
|
||||
public void ToggleGhostVisibility()
|
||||
{
|
||||
_console.RemoteExecuteCommand(null, "toggleghosts");
|
||||
GhostVisibility = !GhostVisibility;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user