Shuttle map IFF tweaks (#25897)

- HideLabel just means it won't have its name / button drawn whereas Hide will block it completely.
This commit is contained in:
metalgearsloth
2024-03-11 13:11:46 +11:00
committed by GitHub
parent 37ece88d09
commit a41772a006
7 changed files with 32 additions and 9 deletions

View File

@@ -318,10 +318,13 @@ public sealed partial class MapScreen : BoxContainer
foreach (var grid in _mapManager.GetAllMapGrids(mapComp.MapId))
{
_entManager.TryGetComponent(grid.Owner, out IFFComponent? iffComp);
var gridObj = new GridMapObject()
{
Name = _entManager.GetComponent<MetaDataComponent>(grid.Owner).EntityName,
Entity = grid.Owner
Entity = grid.Owner,
HideButton = iffComp != null && (iffComp.Flags & IFFFlags.HideLabel) != 0x0,
};
// Always show our shuttle immediately
@@ -329,7 +332,8 @@ public sealed partial class MapScreen : BoxContainer
{
AddMapObject(mapComp.MapId, gridObj);
}
else
else if (iffComp == null ||
(iffComp.Flags & IFFFlags.Hide) == 0x0)
{
_pendingMapObjects.Add((mapComp.MapId, gridObj));
}
@@ -423,10 +427,14 @@ public sealed partial class MapScreen : BoxContainer
/// </summary>
private void AddMapObject(MapId mapId, IMapObject mapObj)
{
var gridContents = _mapHeadings[mapId];
var existing = _mapObjects.GetOrNew(mapId);
existing.Add(mapObj);
if (mapObj.HideButton)
return;
var gridContents = _mapHeadings[mapId];
var gridButton = new Button()
{
Text = mapObj.Name,