]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Shuttle map IFF tweaks (#25897)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Mon, 11 Mar 2024 02:11:46 +0000 (13:11 +1100)
committerGitHub <noreply@github.com>
Mon, 11 Mar 2024 02:11:46 +0000 (13:11 +1100)
- HideLabel just means it won't have its name / button drawn whereas Hide will block it completely.

Content.Client/Shuttles/UI/MapScreen.xaml.cs
Content.Client/Shuttles/UI/ShuttleMapControl.xaml.cs
Content.Shared/Shuttles/Systems/SharedShuttleSystem.IFF.cs
Content.Shared/Shuttles/UI/MapObjects/GridMapObject.cs
Content.Shared/Shuttles/UI/MapObjects/IMapObject.cs
Content.Shared/Shuttles/UI/MapObjects/ShuttleBeaconObject.cs
Content.Shared/Shuttles/UI/MapObjects/ShuttleExclusionObject.cs

index 65a11d345d71f1f4c078c2839c915d0ff160f5bc..8430699bae17952a042039e9ee0eb81ac8321761 100644 (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,
index 55ef55a6c77d86b68695dfde0a7ca6a58d73e22d..2ce1906d3d28e10d08e396371bfe133aa7ce193d 100644 (file)
@@ -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
             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 @@ public sealed partial class ShuttleMapControl : BaseShuttleControl
             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);
 
index 72068c71f8fcabb73f5d6b551c3e059f4d1c97c7..ed687d48f4b463ae92ffdf091e1413c5b1939943 100644 (file)
@@ -60,7 +60,7 @@ public abstract partial class SharedShuttleSystem
             return;
 
         component.Color = color;
-        Dirty(component);
+        Dirty(gridUid, component);
         UpdateIFFInterfaces(gridUid, component);
     }
 
@@ -73,7 +73,7 @@ public abstract partial class SharedShuttleSystem
             return;
 
         component.Flags |= flags;
-        Dirty(component);
+        Dirty(gridUid, component);
         UpdateIFFInterfaces(gridUid, component);
     }
 
@@ -87,7 +87,7 @@ public abstract partial class SharedShuttleSystem
             return;
 
         component.Flags &= ~flags;
-        Dirty(component);
+        Dirty(gridUid, component);
         UpdateIFFInterfaces(gridUid, component);
     }
 }
index cb4194b7328fe784aa96a888e95a8ec52718bc64..7bbd9ef64a8f1ef623c742e4ba4903bc31dac8fa 100644 (file)
@@ -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;
 }
index 80e165d0b0ddbbba249dea51be253a0a4256c71c..a2584fa223bac6e1eaae74367d9a666a63d2a358 100644 (file)
@@ -6,4 +6,9 @@ namespace Content.Shared.Shuttles.UI.MapObjects;
 public interface IMapObject
 {
     string Name { get; }
+
+    /// <summary>
+    /// Should we hide the button from being shown (AKA just draw it).
+    /// </summary>
+    bool HideButton { get; }
 }
index 2be80f46a895da8e40f0cb7bd70970bdc1aefa6a..c5e13c414b0a609ff8afb0879a37535ae07dae66 100644 (file)
@@ -4,4 +4,7 @@ using Robust.Shared.Serialization;
 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;
+}
index a5ac93c6581a7583463a300aaa11c739df769a60..7c7c927b4a320f75e192032e03ea587bddc5df1d 100644 (file)
@@ -4,4 +4,7 @@ using Robust.Shared.Serialization;
 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;
+}