Skip to content

Commit

Permalink
Shuttle map button tweaks (space-wizards#29757)
Browse files Browse the repository at this point in the history
- Avoids adding pending objects we can never show so the list should fill much faster.
  • Loading branch information
metalgearsloth authored Jul 6, 2024
1 parent 84ff5e3 commit 4c5c6a8
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions Content.Client/Shuttles/UI/MapScreen.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down Expand Up @@ -327,20 +327,28 @@ 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));
}
}

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));
}

Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 4c5c6a8

Please sign in to comment.