From 4c5c6a84dce709d0bf623aff5edf90cff8bac29f Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Sat, 6 Jul 2024 13:51:55 +1000 Subject: [PATCH] Shuttle map button tweaks (#29757) - Avoids adding pending objects we can never show so the list should fill much faster. --- Content.Client/Shuttles/UI/MapScreen.xaml.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Content.Client/Shuttles/UI/MapScreen.xaml.cs b/Content.Client/Shuttles/UI/MapScreen.xaml.cs index 10800b8c5f780c..489dbc8c90c879 100644 --- a/Content.Client/Shuttles/UI/MapScreen.xaml.cs +++ b/Content.Client/Shuttles/UI/MapScreen.xaml.cs @@ -261,7 +261,7 @@ private void RebuildMapObjects() ourMap = shuttleXform.MapID; } - while (mapComps.MoveNext(out var mapComp, out var mapXform, out var mapMetadata)) + while (mapComps.MoveNext(out var mapUid, out var mapComp, out var mapXform, out var mapMetadata)) { if (_console != null && !_shuttles.CanFTLTo(_shuttleEntity.Value, mapComp.MapId, _console.Value)) { @@ -327,8 +327,10 @@ private void RebuildMapObjects() { AddMapObject(mapComp.MapId, gridObj); } - else if (!_shuttles.IsBeaconMap(_mapManager.GetMapEntityId(mapComp.MapId)) && (iffComp == null || - (iffComp.Flags & IFFFlags.Hide) == 0x0)) + // If we can show it then add it to pending. + else if (!_shuttles.IsBeaconMap(mapUid) && (iffComp == null || + (iffComp.Flags & IFFFlags.Hide) == 0x0) && + !gridObj.HideButton) { _pendingMapObjects.Add((mapComp.MapId, gridObj)); } @@ -336,11 +338,17 @@ private void RebuildMapObjects() foreach (var (beacon, _) in _shuttles.GetExclusions(mapComp.MapId, _exclusions)) { + if (beacon.HideButton) + continue; + _pendingMapObjects.Add((mapComp.MapId, beacon)); } foreach (var (beacon, _) in _shuttles.GetBeacons(mapComp.MapId, _beacons)) { + if (beacon.HideButton) + continue; + _pendingMapObjects.Add((mapComp.MapId, beacon)); } @@ -425,9 +433,6 @@ private void AddMapObject(MapId mapId, IMapObject mapObj) var existing = _mapObjects.GetOrNew(mapId); existing.Add(mapObj); - if (mapObj.HideButton) - return; - var gridContents = _mapHeadings[mapId]; var gridButton = new Button()