Add navmap beacons (#19388)
This commit is contained in:
19
Content.Shared/Pinpointer/NavMapBeaconComponent.cs
Normal file
19
Content.Shared/Pinpointer/NavMapBeaconComponent.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Pinpointer;
|
||||
|
||||
/// <summary>
|
||||
/// Will show a marker on a NavMap.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
public sealed partial class NavMapBeaconComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Defaults to entity name if nothing found.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("text"), AutoNetworkedField]
|
||||
public string? Text;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("color"), AutoNetworkedField]
|
||||
public Color Color = Color.Orange;
|
||||
}
|
||||
@@ -9,8 +9,14 @@ namespace Content.Shared.Pinpointer;
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class NavMapComponent : Component
|
||||
{
|
||||
/*
|
||||
* Don't need DataFields as this can be reconstructed
|
||||
*/
|
||||
|
||||
[ViewVariables]
|
||||
public readonly Dictionary<Vector2i, NavMapChunk> Chunks = new();
|
||||
|
||||
[ViewVariables] public readonly List<SharedNavMapSystem.NavMapBeacon> Beacons = new();
|
||||
}
|
||||
|
||||
public sealed class NavMapChunk
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Numerics;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -34,12 +35,10 @@ public abstract class SharedNavMapSystem : EntitySystem
|
||||
protected sealed class NavMapComponentState : ComponentState
|
||||
{
|
||||
public Dictionary<Vector2i, int> TileData = new();
|
||||
|
||||
public List<NavMapBeacon> Beacons = new();
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
protected sealed class NavMapDiffComponentState : ComponentState
|
||||
{
|
||||
public Dictionary<Vector2i, int> TileData = new();
|
||||
public List<Vector2i> RemovedChunks = new();
|
||||
}
|
||||
public readonly record struct NavMapBeacon(Color Color, string Text, Vector2 Position);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user