Shuttle map button tweaks (#29757)

- Avoids adding pending objects we can never show so the list should fill much faster.
This commit is contained in:
metalgearsloth
2024-07-06 13:51:55 +10:00
committed by GitHub
parent 84ff5e334b
commit 4c5c6a84dc

View File

@@ -261,7 +261,7 @@ public sealed partial class MapScreen : BoxContainer
ourMap = shuttleXform.MapID; 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)) if (_console != null && !_shuttles.CanFTLTo(_shuttleEntity.Value, mapComp.MapId, _console.Value))
{ {
@@ -327,8 +327,10 @@ public sealed partial class MapScreen : BoxContainer
{ {
AddMapObject(mapComp.MapId, gridObj); AddMapObject(mapComp.MapId, gridObj);
} }
else if (!_shuttles.IsBeaconMap(_mapManager.GetMapEntityId(mapComp.MapId)) && (iffComp == null || // If we can show it then add it to pending.
(iffComp.Flags & IFFFlags.Hide) == 0x0)) else if (!_shuttles.IsBeaconMap(mapUid) && (iffComp == null ||
(iffComp.Flags & IFFFlags.Hide) == 0x0) &&
!gridObj.HideButton)
{ {
_pendingMapObjects.Add((mapComp.MapId, gridObj)); _pendingMapObjects.Add((mapComp.MapId, gridObj));
} }
@@ -336,11 +338,17 @@ public sealed partial class MapScreen : BoxContainer
foreach (var (beacon, _) in _shuttles.GetExclusions(mapComp.MapId, _exclusions)) foreach (var (beacon, _) in _shuttles.GetExclusions(mapComp.MapId, _exclusions))
{ {
if (beacon.HideButton)
continue;
_pendingMapObjects.Add((mapComp.MapId, beacon)); _pendingMapObjects.Add((mapComp.MapId, beacon));
} }
foreach (var (beacon, _) in _shuttles.GetBeacons(mapComp.MapId, _beacons)) foreach (var (beacon, _) in _shuttles.GetBeacons(mapComp.MapId, _beacons))
{ {
if (beacon.HideButton)
continue;
_pendingMapObjects.Add((mapComp.MapId, beacon)); _pendingMapObjects.Add((mapComp.MapId, beacon));
} }
@@ -425,9 +433,6 @@ public sealed partial class MapScreen : BoxContainer
var existing = _mapObjects.GetOrNew(mapId); var existing = _mapObjects.GetOrNew(mapId);
existing.Add(mapObj); existing.Add(mapObj);
if (mapObj.HideButton)
return;
var gridContents = _mapHeadings[mapId]; var gridContents = _mapHeadings[mapId];
var gridButton = new Button() var gridButton = new Button()