Visualized regions for NavMapControl (#31910)

* Atmospheric alerts computer

* Moved components, restricted access to them

* Minor tweaks

* The screen will now turn off when the computer is not powered

* Bug fix

* Adjusted label

* Updated to latest master version

* Initial commit

* Tidy up

* Add firelocks to the nav map

* Add nav map regions to atmos alerts computer

* Added support for multiple region overlay sets per grid

* Fixed issue where console values were not updating correctly

* Fixing merge conflict

* Fixing merge conflicts

* Finished all major features

* Removed station map regions (to be re-added in a separate PR)

* Improved clarity

* Adjusted the color saturation of the regions displayed on the atmos alerts computer
This commit is contained in:
chromiumboy
2024-10-23 07:49:58 -05:00
committed by GitHub
parent 3b0d8e63a1
commit d2216835d8
9 changed files with 649 additions and 22 deletions

View File

@@ -27,6 +27,50 @@ public sealed partial class NavMapComponent : Component
/// </summary>
[ViewVariables]
public Dictionary<NetEntity, SharedNavMapSystem.NavMapBeacon> Beacons = new();
/// <summary>
/// Describes the properties of a region on the station.
/// It is indexed by the entity assigned as the region owner.
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
public Dictionary<NetEntity, SharedNavMapSystem.NavMapRegionProperties> RegionProperties = new();
/// <summary>
/// All flood filled regions, ready for display on a NavMapControl.
/// It is indexed by the entity assigned as the region owner.
/// </summary>
/// <remarks>
/// For client use only
/// </remarks>
[ViewVariables(VVAccess.ReadOnly)]
public Dictionary<NetEntity, NavMapRegionOverlay> RegionOverlays = new();
/// <summary>
/// A queue of all region owners that are waiting their associated regions to be floodfilled.
/// </summary>
/// <remarks>
/// For client use only
/// </remarks>
[ViewVariables(VVAccess.ReadOnly)]
public Queue<NetEntity> QueuedRegionsToFlood = new();
/// <summary>
/// A look up table to get a list of region owners associated with a flood filled chunk.
/// </summary>
/// <remarks>
/// For client use only
/// </remarks>
[ViewVariables(VVAccess.ReadOnly)]
public Dictionary<Vector2i, HashSet<NetEntity>> ChunkToRegionOwnerTable = new();
/// <summary>
/// A look up table to find flood filled chunks associated with a given region owner.
/// </summary>
/// <remarks>
/// For client use only
/// </remarks>
[ViewVariables(VVAccess.ReadOnly)]
public Dictionary<NetEntity, HashSet<Vector2i>> RegionOwnerToChunkTable = new();
}
[Serializable, NetSerializable]
@@ -51,10 +95,30 @@ public sealed class NavMapChunk(Vector2i origin)
public GameTick LastUpdate;
}
[Serializable, NetSerializable]
public sealed class NavMapRegionOverlay(Enum uiKey, List<(Vector2i, Vector2i)> gridCoords)
{
/// <summary>
/// The key to the UI that will be displaying this region on its navmap
/// </summary>
public Enum UiKey = uiKey;
/// <summary>
/// The local grid coordinates of the rectangles that make up the region
/// Item1 is the top left corner, Item2 is the bottom right corner
/// </summary>
public List<(Vector2i, Vector2i)> GridCoords = gridCoords;
/// <summary>
/// Color of the region
/// </summary>
public Color Color = Color.White;
}
public enum NavMapChunkType : byte
{
// Values represent bit shift offsets when retrieving data in the tile array.
Invalid = byte.MaxValue,
Invalid = byte.MaxValue,
Floor = 0, // I believe floors have directional information for diagonal tiles?
Wall = SharedNavMapSystem.Directions,
Airlock = 2 * SharedNavMapSystem.Directions,