diff --git a/Content.Server/Nuke/NukeSystem.cs b/Content.Server/Nuke/NukeSystem.cs index 97c3b6c94f..ca0b0e0113 100644 --- a/Content.Server/Nuke/NukeSystem.cs +++ b/Content.Server/Nuke/NukeSystem.cs @@ -2,6 +2,7 @@ using Content.Server.AlertLevel; using Content.Server.Audio; using Content.Server.Chat.Systems; using Content.Server.Explosion.EntitySystems; +using Content.Server.Pinpointer; using Content.Server.Popups; using Content.Server.Station.Systems; using Content.Shared.Audio; @@ -29,6 +30,7 @@ public sealed class NukeSystem : EntitySystem [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly ITileDefinitionManager _tileDefManager = default!; [Dependency] private readonly ItemSlotsSystem _itemSlots = default!; + [Dependency] private readonly NavMapSystem _navMap = default!; [Dependency] private readonly PointLightSystem _pointLight = default!; [Dependency] private readonly PopupSystem _popups = default!; [Dependency] private readonly ServerGlobalSoundSystem _sound = default!; @@ -458,6 +460,8 @@ public sealed class NukeSystem : EntitySystem // turn on the spinny light _pointLight.SetEnabled(uid, true); + // enable the navmap beacon for people to find it + _navMap.SetBeaconEnabled(uid, true); _itemSlots.SetLock(uid, component.DiskSlot, true); if (!nukeXform.Anchored) @@ -500,6 +504,8 @@ public sealed class NukeSystem : EntitySystem // turn off the spinny light _pointLight.SetEnabled(uid, false); + // disable the navmap beacon now that its disarmed + _navMap.SetBeaconEnabled(uid, false); // start bomb cooldown _itemSlots.SetLock(uid, component.DiskSlot, false); diff --git a/Content.Server/Pinpointer/NavMapSystem.cs b/Content.Server/Pinpointer/NavMapSystem.cs index 140f016558..a62c515520 100644 --- a/Content.Server/Pinpointer/NavMapSystem.cs +++ b/Content.Server/Pinpointer/NavMapSystem.cs @@ -130,7 +130,7 @@ public sealed class NavMapSystem : SharedNavMapSystem while (beaconQuery.MoveNext(out var beaconUid, out var beacon, out var xform)) { - if (xform.GridUid != uid || !CanBeacon(beaconUid, xform)) + if (!beacon.Enabled || xform.GridUid != uid || !CanBeacon(beaconUid, xform)) continue; // TODO: Make warp points use metadata name instead. @@ -236,4 +236,28 @@ public sealed class NavMapSystem : SharedNavMapSystem Dirty(component); } + + /// + /// Sets the beacon's Enabled field and refreshes the grid. + /// + public void SetBeaconEnabled(EntityUid uid, bool enabled, NavMapBeaconComponent? comp = null) + { + if (!Resolve(uid, ref comp) || comp.Enabled == enabled) + return; + + comp.Enabled = enabled; + + RefreshNavGrid(uid); + } + + /// + /// Toggles the beacon's Enabled field and refreshes the grid. + /// + public void ToggleBeacon(EntityUid uid, NavMapBeaconComponent? comp = null) + { + if (!Resolve(uid, ref comp)) + return; + + SetBeaconEnabled(uid, !comp.Enabled, comp); + } } diff --git a/Content.Shared/Pinpointer/NavMapBeaconComponent.cs b/Content.Shared/Pinpointer/NavMapBeaconComponent.cs index dfe958d1d1..b9cb8d4488 100644 --- a/Content.Shared/Pinpointer/NavMapBeaconComponent.cs +++ b/Content.Shared/Pinpointer/NavMapBeaconComponent.cs @@ -5,15 +5,21 @@ namespace Content.Shared.Pinpointer; /// /// Will show a marker on a NavMap. /// -[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +[RegisterComponent, Access(typeof(SharedNavMapSystem))] public sealed partial class NavMapBeaconComponent : Component { /// /// Defaults to entity name if nothing found. /// - [ViewVariables(VVAccess.ReadWrite), DataField("text"), AutoNetworkedField] + [ViewVariables(VVAccess.ReadWrite), DataField] public string? Text; - [ViewVariables(VVAccess.ReadWrite), DataField("color"), AutoNetworkedField] + [ViewVariables(VVAccess.ReadWrite), DataField] public Color Color = Color.Orange; + + /// + /// Only enabled beacons can be seen on a station map. + /// + [ViewVariables(VVAccess.ReadWrite), DataField] + public bool Enabled = true; } diff --git a/Resources/Prototypes/Entities/Objects/Devices/nuke.yml b/Resources/Prototypes/Entities/Objects/Devices/nuke.yml index abb6ae1b9b..878353f80f 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/nuke.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/nuke.yml @@ -31,6 +31,10 @@ mask: /Textures/Effects/LightMasks/double_cone.png - type: RotatingLight speed: 120 + - type: NavMapBeacon + color: "#ff0000" + text: nuclear fission explosive + enabled: false - type: NukeLabel - type: Nuke explosionType: Default