Fix ghost warps (#20008)

This commit is contained in:
metalgearsloth
2023-09-11 15:43:24 +10:00
committed by GitHub
parent 7ce26e5ad2
commit 2a367af7ed
2 changed files with 7 additions and 7 deletions

View File

@@ -11,16 +11,16 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls
[GenerateTypedNameReferences] [GenerateTypedNameReferences]
public sealed partial class GhostTargetWindow : DefaultWindow public sealed partial class GhostTargetWindow : DefaultWindow
{ {
private List<(string, EntityUid)> _warps = new(); private List<(string, NetEntity)> _warps = new();
public event Action<EntityUid>? WarpClicked; public event Action<NetEntity>? WarpClicked;
public GhostTargetWindow() public GhostTargetWindow()
{ {
RobustXamlLoader.Load(this); RobustXamlLoader.Load(this);
} }
public void UpdateWarps(IEnumerable<GhostWarp> warps, IEntityManager entManager) public void UpdateWarps(IEnumerable<GhostWarp> warps)
{ {
// Server COULD send these sorted but how about we just use the client to do it instead // Server COULD send these sorted but how about we just use the client to do it instead
_warps = warps _warps = warps
@@ -33,7 +33,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls
? Loc.GetString("ghost-target-window-current-button", ("name", w.DisplayName)) ? Loc.GetString("ghost-target-window-current-button", ("name", w.DisplayName))
: w.DisplayName; : w.DisplayName;
return (name, entManager.GetEntity(w.Entity)); return (name, w.Entity);
}) })
.ToList(); .ToList();
} }

View File

@@ -96,7 +96,7 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
if (Gui?.TargetWindow is not { } window) if (Gui?.TargetWindow is not { } window)
return; return;
window.UpdateWarps(msg.Warps, EntityManager); window.UpdateWarps(msg.Warps);
window.Populate(); window.Populate();
} }
@@ -105,9 +105,9 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
UpdateGui(); UpdateGui();
} }
private void OnWarpClicked(EntityUid player) private void OnWarpClicked(NetEntity player)
{ {
var msg = new GhostWarpToTargetRequestEvent(EntityManager.GetNetEntity(player)); var msg = new GhostWarpToTargetRequestEvent(player);
_net.SendSystemNetworkMessage(msg); _net.SendSystemNetworkMessage(msg);
} }