]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Predict Nav Beacon Examine (#39408)
authorKyle Tyo <36606155+VerinSenpai@users.noreply.github.com>
Tue, 5 Aug 2025 21:20:43 +0000 (17:20 -0400)
committerGitHub <noreply@github.com>
Tue, 5 Aug 2025 21:20:43 +0000 (23:20 +0200)
* commit

* Update Content.Shared/Pinpointer/SharedNavMapSystem.cs

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Content.Server/Pinpointer/NavMapSystem.cs
Content.Shared/Pinpointer/ConfigurableNavMapBeaconComponent.cs
Content.Shared/Pinpointer/NavMapBeaconComponent.cs
Content.Shared/Pinpointer/SharedNavMapSystem.cs

index 9d0862ba47a1446f4cf1d053af8c7232b1f736ca..2a736b5d5050f1550a8c55d5553fc977c42165b7 100644 (file)
@@ -62,7 +62,6 @@ public sealed partial class NavMapSystem : SharedNavMapSystem
         SubscribeLocalEvent<NavMapBeaconComponent, AnchorStateChangedEvent>(OnNavMapBeaconAnchor);
         SubscribeLocalEvent<ConfigurableNavMapBeaconComponent, NavMapBeaconConfigureBuiMessage>(OnConfigureMessage);
         SubscribeLocalEvent<ConfigurableNavMapBeaconComponent, MapInitEvent>(OnConfigurableMapInit);
-        SubscribeLocalEvent<ConfigurableNavMapBeaconComponent, ExaminedEvent>(OnConfigurableExamined);
     }
 
     private void OnStationInit(StationGridAddedEvent ev)
@@ -223,17 +222,6 @@ public sealed partial class NavMapSystem : SharedNavMapSystem
         UpdateBeaconEnabledVisuals((ent, navMap));
     }
 
-    private void OnConfigurableExamined(Entity<ConfigurableNavMapBeaconComponent> ent, ref ExaminedEvent args)
-    {
-        if (!args.IsInDetailsRange || !TryComp<NavMapBeaconComponent>(ent, out var navMap))
-            return;
-
-        args.PushMarkup(Loc.GetString("nav-beacon-examine-text",
-            ("enabled", navMap.Enabled),
-            ("color", navMap.Color.ToHexNoAlpha()),
-            ("label", navMap.Text ?? string.Empty)));
-    }
-
     #endregion
 
     #region: Grid functions
index cd6744c87d8925e8fa5eb848579041f9338fd40b..8b678e0300ec4d5b18526808d32048d81713329a 100644 (file)
@@ -8,10 +8,7 @@ namespace Content.Shared.Pinpointer;
 /// </summary>
 [RegisterComponent, NetworkedComponent]
 [Access(typeof(SharedNavMapSystem))]
-public sealed partial class ConfigurableNavMapBeaconComponent : Component
-{
-
-}
+public sealed partial class ConfigurableNavMapBeaconComponent : Component;
 
 [Serializable, NetSerializable]
 public sealed class NavMapBeaconConfigureBuiMessage : BoundUserInterfaceMessage
@@ -31,11 +28,11 @@ public sealed class NavMapBeaconConfigureBuiMessage : BoundUserInterfaceMessage
 [Serializable, NetSerializable]
 public enum NavMapBeaconUiKey : byte
 {
-    Key
+    Key,
 }
 
 [Serializable, NetSerializable]
 public enum NavMapBeaconVisuals : byte
 {
-    Enabled
+    Enabled,
 }
index 0a86bdd9d2e4d0eea3129b3e96af1cba47657960..4bb6384fb938841432de4701dec84ef67b94ac25 100644 (file)
@@ -12,8 +12,7 @@ public sealed partial class NavMapBeaconComponent : Component
     /// <summary>
     /// Defaults to entity name if nothing found.
     /// </summary>
-    [ViewVariables(VVAccess.ReadWrite), DataField]
-    [AutoNetworkedField]
+    [DataField, AutoNetworkedField]
     public string? Text;
 
     /// <summary>
@@ -23,14 +22,12 @@ public sealed partial class NavMapBeaconComponent : Component
     [DataField]
     public LocId? DefaultText;
 
-    [ViewVariables(VVAccess.ReadWrite), DataField]
-    [AutoNetworkedField]
+    [DataField, AutoNetworkedField]
     public Color Color = Color.Orange;
 
     /// <summary>
     /// Only enabled beacons can be seen on a station map.
     /// </summary>
-    [ViewVariables(VVAccess.ReadWrite), DataField]
-    [AutoNetworkedField]
+    [DataField, AutoNetworkedField]
     public bool Enabled = true;
 }
index 37d60dec28a7ebde5ff39d0885a23282a0aee516..5d648032732b306584dbffffe498a265db57ab86 100644 (file)
@@ -1,6 +1,7 @@
 using System.Diagnostics.CodeAnalysis;
 using System.Numerics;
 using System.Runtime.CompilerServices;
+using Content.Shared.Examine;
 using Content.Shared.Tag;
 using Robust.Shared.GameStates;
 using Robust.Shared.Network;
@@ -34,6 +35,8 @@ public abstract class SharedNavMapSystem : EntitySystem
 
         // Data handling events
         SubscribeLocalEvent<NavMapComponent, ComponentGetState>(OnGetState);
+        SubscribeLocalEvent<ConfigurableNavMapBeaconComponent, ExaminedEvent>(OnConfigurableExamined);
+
         _doorQuery = GetEntityQuery<NavMapDoorComponent>();
     }
 
@@ -164,6 +167,17 @@ public abstract class SharedNavMapSystem : EntitySystem
         args.State = new NavMapDeltaState(chunks, component.Beacons, component.RegionProperties, new(component.Chunks.Keys));
     }
 
+    private void OnConfigurableExamined(Entity<ConfigurableNavMapBeaconComponent> ent, ref ExaminedEvent args)
+    {
+        if (!args.IsInDetailsRange || !TryComp<NavMapBeaconComponent>(ent, out var navMap))
+            return;
+
+        args.PushMarkup(Loc.GetString("nav-beacon-examine-text",
+            ("enabled", navMap.Enabled),
+            ("color", navMap.Color.ToHexNoAlpha()),
+            ("label", navMap.Text ?? string.Empty)));
+    }
+
     #endregion
 
     #region: System messages