Predict Nav Beacon Examine (#39408)
* 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>
This commit is contained in:
@@ -62,7 +62,6 @@ public sealed partial class NavMapSystem : SharedNavMapSystem
|
|||||||
SubscribeLocalEvent<NavMapBeaconComponent, AnchorStateChangedEvent>(OnNavMapBeaconAnchor);
|
SubscribeLocalEvent<NavMapBeaconComponent, AnchorStateChangedEvent>(OnNavMapBeaconAnchor);
|
||||||
SubscribeLocalEvent<ConfigurableNavMapBeaconComponent, NavMapBeaconConfigureBuiMessage>(OnConfigureMessage);
|
SubscribeLocalEvent<ConfigurableNavMapBeaconComponent, NavMapBeaconConfigureBuiMessage>(OnConfigureMessage);
|
||||||
SubscribeLocalEvent<ConfigurableNavMapBeaconComponent, MapInitEvent>(OnConfigurableMapInit);
|
SubscribeLocalEvent<ConfigurableNavMapBeaconComponent, MapInitEvent>(OnConfigurableMapInit);
|
||||||
SubscribeLocalEvent<ConfigurableNavMapBeaconComponent, ExaminedEvent>(OnConfigurableExamined);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnStationInit(StationGridAddedEvent ev)
|
private void OnStationInit(StationGridAddedEvent ev)
|
||||||
@@ -223,17 +222,6 @@ public sealed partial class NavMapSystem : SharedNavMapSystem
|
|||||||
UpdateBeaconEnabledVisuals((ent, navMap));
|
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
|
#endregion
|
||||||
|
|
||||||
#region: Grid functions
|
#region: Grid functions
|
||||||
|
|||||||
@@ -8,10 +8,7 @@ namespace Content.Shared.Pinpointer;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[RegisterComponent, NetworkedComponent]
|
[RegisterComponent, NetworkedComponent]
|
||||||
[Access(typeof(SharedNavMapSystem))]
|
[Access(typeof(SharedNavMapSystem))]
|
||||||
public sealed partial class ConfigurableNavMapBeaconComponent : Component
|
public sealed partial class ConfigurableNavMapBeaconComponent : Component;
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public sealed class NavMapBeaconConfigureBuiMessage : BoundUserInterfaceMessage
|
public sealed class NavMapBeaconConfigureBuiMessage : BoundUserInterfaceMessage
|
||||||
@@ -31,11 +28,11 @@ public sealed class NavMapBeaconConfigureBuiMessage : BoundUserInterfaceMessage
|
|||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public enum NavMapBeaconUiKey : byte
|
public enum NavMapBeaconUiKey : byte
|
||||||
{
|
{
|
||||||
Key
|
Key,
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public enum NavMapBeaconVisuals : byte
|
public enum NavMapBeaconVisuals : byte
|
||||||
{
|
{
|
||||||
Enabled
|
Enabled,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ public sealed partial class NavMapBeaconComponent : Component
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to entity name if nothing found.
|
/// Defaults to entity name if nothing found.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite), DataField]
|
[DataField, AutoNetworkedField]
|
||||||
[AutoNetworkedField]
|
|
||||||
public string? Text;
|
public string? Text;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -23,14 +22,12 @@ public sealed partial class NavMapBeaconComponent : Component
|
|||||||
[DataField]
|
[DataField]
|
||||||
public LocId? DefaultText;
|
public LocId? DefaultText;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite), DataField]
|
[DataField, AutoNetworkedField]
|
||||||
[AutoNetworkedField]
|
|
||||||
public Color Color = Color.Orange;
|
public Color Color = Color.Orange;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Only enabled beacons can be seen on a station map.
|
/// Only enabled beacons can be seen on a station map.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite), DataField]
|
[DataField, AutoNetworkedField]
|
||||||
[AutoNetworkedField]
|
|
||||||
public bool Enabled = true;
|
public bool Enabled = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
using Content.Shared.Examine;
|
||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
@@ -34,6 +35,8 @@ public abstract class SharedNavMapSystem : EntitySystem
|
|||||||
|
|
||||||
// Data handling events
|
// Data handling events
|
||||||
SubscribeLocalEvent<NavMapComponent, ComponentGetState>(OnGetState);
|
SubscribeLocalEvent<NavMapComponent, ComponentGetState>(OnGetState);
|
||||||
|
SubscribeLocalEvent<ConfigurableNavMapBeaconComponent, ExaminedEvent>(OnConfigurableExamined);
|
||||||
|
|
||||||
_doorQuery = GetEntityQuery<NavMapDoorComponent>();
|
_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));
|
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
|
#endregion
|
||||||
|
|
||||||
#region: System messages
|
#region: System messages
|
||||||
|
|||||||
Reference in New Issue
Block a user