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<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
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user