From aa8b2ae2d4770a1334259dd476c097229ceec36f Mon Sep 17 00:00:00 2001
From: SimpleStation14 <130339894+SimpleStation14@users.noreply.github.com>
Date: Sat, 4 May 2024 16:15:59 -0700
Subject: [PATCH] Mirror: Shuttle map IFF tweaks (#142)
## Mirror of PR #25897: [Shuttle map IFF
tweaks](https://github.com/space-wizards/space-station-14/pull/25897)
from
[space-wizards](https://github.com/space-wizards)/[space-station-14](https://github.com/space-wizards/space-station-14)
###### `a41772a006302bbe267793569b4b0d171eb82c87`
PR opened by
metalgearsloth at 2024-03-07 02:06:24 UTC
PR merged by web-flow at
2024-03-11 02:11:46 UTC
---
PR changed 7 files with 32 additions and 9 deletions.
The PR had the following labels:
- Changes: UI
---
Original Body
> - HideLabel just means it won't have its name / button drawn whereas
Hide will block it completely.
>
>
![image](https://github.com/space-wizards/space-station-14/assets/31366439/d582dbe2-90a1-43e9-b3bf-ad97807f43f6)
>
> :cl:
> - tweak: Remove the buttons for generated debris from shuttle maps.
>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
---
Content.Client/Shuttles/UI/MapScreen.xaml.cs | 14 +++++++++++---
.../Shuttles/UI/ShuttleMapControl.xaml.cs | 5 ++++-
.../Shuttles/Systems/SharedShuttleSystem.IFF.cs | 6 +++---
.../Shuttles/UI/MapObjects/GridMapObject.cs | 1 +
.../Shuttles/UI/MapObjects/IMapObject.cs | 5 +++++
.../Shuttles/UI/MapObjects/ShuttleBeaconObject.cs | 5 ++++-
.../UI/MapObjects/ShuttleExclusionObject.cs | 5 ++++-
7 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/Content.Client/Shuttles/UI/MapScreen.xaml.cs b/Content.Client/Shuttles/UI/MapScreen.xaml.cs
index 65a11d345d7..8430699bae1 100644
--- a/Content.Client/Shuttles/UI/MapScreen.xaml.cs
+++ b/Content.Client/Shuttles/UI/MapScreen.xaml.cs
@@ -318,10 +318,13 @@ private void RebuildMapObjects()
foreach (var grid in _mapManager.GetAllMapGrids(mapComp.MapId))
{
+ _entManager.TryGetComponent(grid.Owner, out IFFComponent? iffComp);
+
var gridObj = new GridMapObject()
{
Name = _entManager.GetComponent(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 @@ private void RebuildMapObjects()
{
AddMapObject(mapComp.MapId, gridObj);
}
- else
+ else if (iffComp == null ||
+ (iffComp.Flags & IFFFlags.Hide) == 0x0)
{
_pendingMapObjects.Add((mapComp.MapId, gridObj));
}
@@ -423,10 +427,14 @@ public void SetMap(MapId mapId, Vector2 position)
///
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,
diff --git a/Content.Client/Shuttles/UI/ShuttleMapControl.xaml.cs b/Content.Client/Shuttles/UI/ShuttleMapControl.xaml.cs
index 55ef55a6c77..2ce1906d3d2 100644
--- a/Content.Client/Shuttles/UI/ShuttleMapControl.xaml.cs
+++ b/Content.Client/Shuttles/UI/ShuttleMapControl.xaml.cs
@@ -345,7 +345,7 @@ protected override void Draw(DrawingHandleScreen handle)
// Rudimentary IFF for now, if IFF hiding on then we don't show on the map at all
if (grid.Owner != _shuttleEntity &&
EntManager.TryGetComponent(grid, out iffComp) &&
- (iffComp.Flags & (IFFFlags.Hide | IFFFlags.HideLabel)) != 0x0)
+ (iffComp.Flags & IFFFlags.Hide) != 0x0)
{
continue;
}
@@ -367,6 +367,9 @@ protected override void Draw(DrawingHandleScreen handle)
AddMapObject(existingEdges, existingVerts, mapObject);
// Text
+ if (iffComp != null && (iffComp.Flags & IFFFlags.HideLabel) != 0x0)
+ continue;
+
// Force drawing it at this point.
var iffText = _shuttles.GetIFFLabel(grid, self: true, component: iffComp);
diff --git a/Content.Shared/Shuttles/Systems/SharedShuttleSystem.IFF.cs b/Content.Shared/Shuttles/Systems/SharedShuttleSystem.IFF.cs
index 72068c71f8f..ed687d48f4b 100644
--- a/Content.Shared/Shuttles/Systems/SharedShuttleSystem.IFF.cs
+++ b/Content.Shared/Shuttles/Systems/SharedShuttleSystem.IFF.cs
@@ -60,7 +60,7 @@ public void SetIFFColor(EntityUid gridUid, Color color, IFFComponent? component
return;
component.Color = color;
- Dirty(component);
+ Dirty(gridUid, component);
UpdateIFFInterfaces(gridUid, component);
}
@@ -73,7 +73,7 @@ public void AddIFFFlag(EntityUid gridUid, IFFFlags flags, IFFComponent? componen
return;
component.Flags |= flags;
- Dirty(component);
+ Dirty(gridUid, component);
UpdateIFFInterfaces(gridUid, component);
}
@@ -87,7 +87,7 @@ public void RemoveIFFFlag(EntityUid gridUid, IFFFlags flags, IFFComponent? compo
return;
component.Flags &= ~flags;
- Dirty(component);
+ Dirty(gridUid, component);
UpdateIFFInterfaces(gridUid, component);
}
}
diff --git a/Content.Shared/Shuttles/UI/MapObjects/GridMapObject.cs b/Content.Shared/Shuttles/UI/MapObjects/GridMapObject.cs
index cb4194b7328..7bbd9ef64a8 100644
--- a/Content.Shared/Shuttles/UI/MapObjects/GridMapObject.cs
+++ b/Content.Shared/Shuttles/UI/MapObjects/GridMapObject.cs
@@ -3,5 +3,6 @@ namespace Content.Shared.Shuttles.UI.MapObjects;
public record struct GridMapObject : IMapObject
{
public string Name { get; set; }
+ public bool HideButton { get; init; }
public EntityUid Entity;
}
diff --git a/Content.Shared/Shuttles/UI/MapObjects/IMapObject.cs b/Content.Shared/Shuttles/UI/MapObjects/IMapObject.cs
index 80e165d0b0d..a2584fa223b 100644
--- a/Content.Shared/Shuttles/UI/MapObjects/IMapObject.cs
+++ b/Content.Shared/Shuttles/UI/MapObjects/IMapObject.cs
@@ -6,4 +6,9 @@ namespace Content.Shared.Shuttles.UI.MapObjects;
public interface IMapObject
{
string Name { get; }
+
+ ///
+ /// Should we hide the button from being shown (AKA just draw it).
+ ///
+ bool HideButton { get; }
}
diff --git a/Content.Shared/Shuttles/UI/MapObjects/ShuttleBeaconObject.cs b/Content.Shared/Shuttles/UI/MapObjects/ShuttleBeaconObject.cs
index 2be80f46a89..c5e13c414b0 100644
--- a/Content.Shared/Shuttles/UI/MapObjects/ShuttleBeaconObject.cs
+++ b/Content.Shared/Shuttles/UI/MapObjects/ShuttleBeaconObject.cs
@@ -4,4 +4,7 @@
namespace Content.Shared.Shuttles.UI.MapObjects;
[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;
+}
diff --git a/Content.Shared/Shuttles/UI/MapObjects/ShuttleExclusionObject.cs b/Content.Shared/Shuttles/UI/MapObjects/ShuttleExclusionObject.cs
index a5ac93c6581..7c7c927b4a3 100644
--- a/Content.Shared/Shuttles/UI/MapObjects/ShuttleExclusionObject.cs
+++ b/Content.Shared/Shuttles/UI/MapObjects/ShuttleExclusionObject.cs
@@ -4,4 +4,7 @@
namespace Content.Shared.Shuttles.UI.MapObjects;
[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;
+}