Station maps (#13027)
This commit is contained in:
@@ -13,14 +13,12 @@ namespace Content.Shared.Medical.CrewMonitoring
|
||||
public sealed class CrewMonitoringState : BoundUserInterfaceState
|
||||
{
|
||||
public List<SuitSensorStatus> Sensors;
|
||||
public readonly Vector2 WorldPosition;
|
||||
public readonly bool Snap;
|
||||
public readonly float Precision;
|
||||
|
||||
public CrewMonitoringState(List<SuitSensorStatus> sensors, Vector2 worldPosition, bool snap, float precision)
|
||||
public CrewMonitoringState(List<SuitSensorStatus> sensors, bool snap, float precision)
|
||||
{
|
||||
Sensors = sensors;
|
||||
WorldPosition = worldPosition;
|
||||
Snap = snap;
|
||||
Precision = precision;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Content.Shared.Medical.SuitSensor
|
||||
public const string NET_JOB = "job";
|
||||
public const string NET_IS_ALIVE = "alive";
|
||||
public const string NET_TOTAL_DAMAGE = "vitals";
|
||||
public const string NET_CORDINATES = "cords";
|
||||
public const string NET_COORDINATES = "coords";
|
||||
|
||||
///Used by the CrewMonitoringServerSystem to send the status of all connected suit sensors to each crew monitor
|
||||
public const string NET_STATUS_COLLECTION = "suit-status-collection";
|
||||
|
||||
29
Content.Shared/Pinpointer/NavMapComponent.cs
Normal file
29
Content.Shared/Pinpointer/NavMapComponent.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Shared.Pinpointer;
|
||||
|
||||
/// <summary>
|
||||
/// Used to store grid poly data to be used for UIs.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class NavMapComponent : Component
|
||||
{
|
||||
[ViewVariables]
|
||||
public readonly Dictionary<Vector2i, NavMapChunk> Chunks = new();
|
||||
}
|
||||
|
||||
public sealed class NavMapChunk
|
||||
{
|
||||
public readonly Vector2i Origin;
|
||||
|
||||
/// <summary>
|
||||
/// Bitmask for tiles, 1 for occupied and 0 for empty.
|
||||
/// </summary>
|
||||
public int TileData;
|
||||
|
||||
public NavMapChunk(Vector2i origin)
|
||||
{
|
||||
Origin = origin;
|
||||
}
|
||||
}
|
||||
45
Content.Shared/Pinpointer/SharedNavMapSystem.cs
Normal file
45
Content.Shared/Pinpointer/SharedNavMapSystem.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Shared.Pinpointer;
|
||||
|
||||
public abstract class SharedNavMapSystem : EntitySystem
|
||||
{
|
||||
public const byte ChunkSize = 4;
|
||||
|
||||
/// <summary>
|
||||
/// Converts the chunk's tile into a bitflag for the slot.
|
||||
/// </summary>
|
||||
public static int GetFlag(Vector2i relativeTile)
|
||||
{
|
||||
return 1 << (relativeTile.X * ChunkSize + relativeTile.Y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the chunk's tile into a bitflag for the slot.
|
||||
/// </summary>
|
||||
public static Vector2i GetTile(int flag)
|
||||
{
|
||||
var value = Math.Log2(flag);
|
||||
var x = (int) value / ChunkSize;
|
||||
var y = (int) value % ChunkSize;
|
||||
var result = new Vector2i(x, y);
|
||||
|
||||
DebugTools.Assert(GetFlag(result) == flag);
|
||||
|
||||
return new Vector2i(x, y);
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
protected sealed class NavMapComponentState : ComponentState
|
||||
{
|
||||
public Dictionary<Vector2i, int> TileData = new();
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
protected sealed class NavMapDiffComponentState : ComponentState
|
||||
{
|
||||
public Dictionary<Vector2i, int> TileData = new();
|
||||
public List<Vector2i> RemovedChunks = new();
|
||||
}
|
||||
}
|
||||
9
Content.Shared/Pinpointer/SharedStationMapSystem.cs
Normal file
9
Content.Shared/Pinpointer/SharedStationMapSystem.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Pinpointer;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum StationMapUiKey : byte
|
||||
{
|
||||
Key,
|
||||
}
|
||||
@@ -3,7 +3,7 @@ using Robust.Shared.Serialization;
|
||||
namespace Content.Shared.Power
|
||||
{
|
||||
[Serializable, NetSerializable]
|
||||
public enum PowerDeviceVisuals
|
||||
public enum PowerDeviceVisuals : byte
|
||||
{
|
||||
VisualState,
|
||||
Powered
|
||||
|
||||
Reference in New Issue
Block a user