Fix being able to teleport with the ghost warp menu while alive (#3246)

This commit is contained in:
DrSmugleaf
2021-02-16 01:55:09 +01:00
committed by GitHub
parent 3703ae134b
commit 17a224ad2c
2 changed files with 32 additions and 11 deletions

View File

@@ -1,3 +1,4 @@
#nullable enable
using Content.Client.GameObjects.Components.Observer;
using Robust.Client.Console;
using Robust.Client.UserInterface;
@@ -16,17 +17,19 @@ namespace Content.Client.UserInterface
private readonly Button _ghostRoles = new() {Text = Loc.GetString("Ghost Roles")};
private readonly GhostComponent _owner;
public GhostTargetWindow? TargetWindow { get; private set; }
public GhostGui(GhostComponent owner)
{
IoCManager.InjectDependencies(this);
_owner = owner;
var targetMenu = new GhostTargetWindow(owner);
TargetWindow = new GhostTargetWindow(owner);
MouseFilter = MouseFilterMode.Ignore;
_ghostWarp.OnPressed += args => targetMenu.Populate();
_ghostWarp.OnPressed += args => TargetWindow.Populate();
_returnToBody.OnPressed += args => owner.SendReturnToBodyMessage();
_ghostRoles.OnPressed += _ => IoCManager.Resolve<IClientConsoleHost>().RemoteExecuteCommand(null, "ghostroles");
@@ -49,7 +52,7 @@ namespace Content.Client.UserInterface
}
}
internal class GhostTargetWindow : SS14Window
public class GhostTargetWindow : SS14Window
{
protected override Vector2? CustomSize => (300, 450);
private readonly GhostComponent _owner;