Replace NavMap dictionaries with int[] (#27602)

* Replace NavMap dictionaries with int[]

* Remove badly named const

* Remove unnecessary offset

* Prioritize airlocks
This commit is contained in:
Leon Friedrich
2024-05-07 04:18:25 +02:00
committed by null
parent 5360318978
commit 2cc879bb1c
10 changed files with 397 additions and 641 deletions
@@ -1,7 +1,5 @@
using Content.Server.GameTicking.Rules.Components;
using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.NodeGroups;
using Content.Server.NodeContainer.Nodes;
using Content.Server.Power.Components;
using Content.Server.Power.Nodes;
@@ -13,7 +11,6 @@ using Content.Shared.Power;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Map.Components;
using Robust.Shared.Player;
using Robust.Shared.Utility;
using System.Linq;
using System.Diagnostics.CodeAnalysis;
@@ -162,7 +159,7 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori
allChunks = new();
var tile = _sharedMapSystem.LocalToTile(xform.GridUid.Value, grid, xform.Coordinates);
var chunkOrigin = SharedMapSystem.GetChunkIndices(tile, SharedNavMapSystem.ChunkSize);
var chunkOrigin = SharedMapSystem.GetChunkIndices(tile, ChunkSize);
if (!allChunks.TryGetValue(chunkOrigin, out var chunk))
{
@@ -170,8 +167,8 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori
allChunks[chunkOrigin] = chunk;
}
var relative = SharedMapSystem.GetChunkRelative(tile, SharedNavMapSystem.ChunkSize);
var flag = SharedNavMapSystem.GetFlag(relative);
var relative = SharedMapSystem.GetChunkRelative(tile, ChunkSize);
var flag = GetFlag(relative);
if (args.Anchored)
chunk.PowerCableData[(int) component.CableType] |= flag;
@@ -720,8 +717,8 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori
}
}
// Designates a supplied entity as a 'collection master'. Other entities which share this
// entities collection name and are attached on the same load network are assigned this entity
// Designates a supplied entity as a 'collection master'. Other entities which share this
// entities collection name and are attached on the same load network are assigned this entity
// as the master that represents them on the console UI. This way you can have one device
// represent multiple connected devices
private void AssignEntityAsCollectionMaster
@@ -883,7 +880,7 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori
continue;
var tile = _sharedMapSystem.GetTileRef(gridUid, grid, entXform.Coordinates);
var chunkOrigin = SharedMapSystem.GetChunkIndices(tile.GridIndices, SharedNavMapSystem.ChunkSize);
var chunkOrigin = SharedMapSystem.GetChunkIndices(tile.GridIndices, ChunkSize);
if (!allChunks.TryGetValue(chunkOrigin, out var chunk))
{
@@ -891,8 +888,8 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori
allChunks[chunkOrigin] = chunk;
}
var relative = SharedMapSystem.GetChunkRelative(tile.GridIndices, SharedNavMapSystem.ChunkSize);
var flag = SharedNavMapSystem.GetFlag(relative);
var relative = SharedMapSystem.GetChunkRelative(tile.GridIndices, ChunkSize);
var flag = GetFlag(relative);
chunk.PowerCableData[(int) cable.CableType] |= flag;
}
@@ -909,7 +906,7 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori
var xform = Transform(ent);
var tile = _sharedMapSystem.GetTileRef(gridUid, grid, xform.Coordinates);
var gridIndices = tile.GridIndices;
var chunkOrigin = SharedMapSystem.GetChunkIndices(gridIndices, SharedNavMapSystem.ChunkSize);
var chunkOrigin = SharedMapSystem.GetChunkIndices(gridIndices, ChunkSize);
if (!component.FocusChunks.TryGetValue(chunkOrigin, out var chunk))
{
@@ -917,8 +914,8 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori
component.FocusChunks[chunkOrigin] = chunk;
}
var relative = SharedMapSystem.GetChunkRelative(gridIndices, SharedNavMapSystem.ChunkSize);
var flag = SharedNavMapSystem.GetFlag(relative);
var relative = SharedMapSystem.GetChunkRelative(gridIndices, ChunkSize);
var flag = GetFlag(relative);
if (TryComp<CableComponent>(ent, out var cable))
chunk.PowerCableData[(int) cable.CableType] |= flag;