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:
@@ -318,10 +318,13 @@ public sealed partial class MapScreen : BoxContainer
|
|||||||
|
|
||||||
foreach (var grid in _mapManager.GetAllMapGrids(mapComp.MapId))
|
foreach (var grid in _mapManager.GetAllMapGrids(mapComp.MapId))
|
||||||
{
|
{
|
||||||
|
_entManager.TryGetComponent(grid.Owner, out IFFComponent? iffComp);
|
||||||
|
|
||||||
var gridObj = new GridMapObject()
|
var gridObj = new GridMapObject()
|
||||||
{
|
{
|
||||||
Name = _entManager.GetComponent<MetaDataComponent>(grid.Owner).EntityName,
|
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
|
// Always show our shuttle immediately
|
||||||
@@ -329,7 +332,8 @@ public sealed partial class MapScreen : BoxContainer
|
|||||||
{
|
{
|
||||||
AddMapObject(mapComp.MapId, gridObj);
|
AddMapObject(mapComp.MapId, gridObj);
|
||||||
}
|
}
|
||||||
else
|
else if (iffComp == null ||
|
||||||
|
(iffComp.Flags & IFFFlags.Hide) == 0x0)
|
||||||
{
|
{
|
||||||
_pendingMapObjects.Add((mapComp.MapId, gridObj));
|
_pendingMapObjects.Add((mapComp.MapId, gridObj));
|
||||||
}
|
}
|
||||||
@@ -423,10 +427,14 @@ public sealed partial class MapScreen : BoxContainer
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void AddMapObject(MapId mapId, IMapObject mapObj)
|
private void AddMapObject(MapId mapId, IMapObject mapObj)
|
||||||
{
|
{
|
||||||
var gridContents = _mapHeadings[mapId];
|
|
||||||
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 gridButton = new Button()
|
var gridButton = new Button()
|
||||||
{
|
{
|
||||||
Text = mapObj.Name,
|
Text = mapObj.Name,
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ public sealed partial class ShuttleMapControl : BaseShuttleControl
|
|||||||
// Rudimentary IFF for now, if IFF hiding on then we don't show on the map at all
|
// Rudimentary IFF for now, if IFF hiding on then we don't show on the map at all
|
||||||
if (grid.Owner != _shuttleEntity &&
|
if (grid.Owner != _shuttleEntity &&
|
||||||
EntManager.TryGetComponent(grid, out iffComp) &&
|
EntManager.TryGetComponent(grid, out iffComp) &&
|
||||||
(iffComp.Flags & (IFFFlags.Hide | IFFFlags.HideLabel)) != 0x0)
|
(iffComp.Flags & IFFFlags.Hide) != 0x0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -367,6 +367,9 @@ public sealed partial class ShuttleMapControl : BaseShuttleControl
|
|||||||
AddMapObject(existingEdges, existingVerts, mapObject);
|
AddMapObject(existingEdges, existingVerts, mapObject);
|
||||||
|
|
||||||
// Text
|
// Text
|
||||||
|
if (iffComp != null && (iffComp.Flags & IFFFlags.HideLabel) != 0x0)
|
||||||
|
continue;
|
||||||
|
|
||||||
// Force drawing it at this point.
|
// Force drawing it at this point.
|
||||||
var iffText = _shuttles.GetIFFLabel(grid, self: true, component: iffComp);
|
var iffText = _shuttles.GetIFFLabel(grid, self: true, component: iffComp);
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public abstract partial class SharedShuttleSystem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
component.Color = color;
|
component.Color = color;
|
||||||
Dirty(component);
|
Dirty(gridUid, component);
|
||||||
UpdateIFFInterfaces(gridUid, component);
|
UpdateIFFInterfaces(gridUid, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ public abstract partial class SharedShuttleSystem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
component.Flags |= flags;
|
component.Flags |= flags;
|
||||||
Dirty(component);
|
Dirty(gridUid, component);
|
||||||
UpdateIFFInterfaces(gridUid, component);
|
UpdateIFFInterfaces(gridUid, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ public abstract partial class SharedShuttleSystem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
component.Flags &= ~flags;
|
component.Flags &= ~flags;
|
||||||
Dirty(component);
|
Dirty(gridUid, component);
|
||||||
UpdateIFFInterfaces(gridUid, component);
|
UpdateIFFInterfaces(gridUid, component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,5 +3,6 @@ namespace Content.Shared.Shuttles.UI.MapObjects;
|
|||||||
public record struct GridMapObject : IMapObject
|
public record struct GridMapObject : IMapObject
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
public bool HideButton { get; init; }
|
||||||
public EntityUid Entity;
|
public EntityUid Entity;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,4 +6,9 @@ namespace Content.Shared.Shuttles.UI.MapObjects;
|
|||||||
public interface IMapObject
|
public interface IMapObject
|
||||||
{
|
{
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Should we hide the button from being shown (AKA just draw it).
|
||||||
|
/// </summary>
|
||||||
|
bool HideButton { get; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,4 +4,7 @@ using Robust.Shared.Serialization;
|
|||||||
namespace Content.Shared.Shuttles.UI.MapObjects;
|
namespace Content.Shared.Shuttles.UI.MapObjects;
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public readonly record struct ShuttleBeaconObject(NetEntity Entity, NetCoordinates Coordinates, string Name) : IMapObject;
|
public readonly record struct ShuttleBeaconObject(NetEntity Entity, NetCoordinates Coordinates, string Name) : IMapObject
|
||||||
|
{
|
||||||
|
public bool HideButton => false;
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,4 +4,7 @@ using Robust.Shared.Serialization;
|
|||||||
namespace Content.Shared.Shuttles.UI.MapObjects;
|
namespace Content.Shared.Shuttles.UI.MapObjects;
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public record struct ShuttleExclusionObject(NetCoordinates Coordinates, float Range, string Name = "") : IMapObject;
|
public record struct ShuttleExclusionObject(NetCoordinates Coordinates, float Range, string Name = "") : IMapObject
|
||||||
|
{
|
||||||
|
public bool HideButton => false;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user