Dependency update / fixes / skrungle bungle (#23745)

* Give .props files 2-space indents.

* Move to Central Package Management.

Allows us to store NuGet package versions all in one place. Yay!

* Update NuGet packages and fix code for changes.

Notable:

Changes to ILVerify.
Npgsql doesn't need hacks for inet anymore, now we need hacks to make the old code work with this new reality.
NUnit's analyzers are already complaining and I didn't even update it to 4.x yet.
TerraFX changed to GetLastSystemError so error handling had to be changed.
Buncha APIs have more NRT annotations.

* Remove dotnet-eng NuGet package source.

I genuinely don't know what this was for, and Central Package Management starts throwing warnings about it, so YEET.

* Remove Robust.Physics project.

Never used.

* Remove erroneous NVorbis reference.

Should be VorbisPizza and otherwise wasn't used.

* Sandbox fixes

* Remove unused unit test package references.

Castle.Core and NUnit.ConsoleRunner.

* Update NUnit to 4.0.1

This requires replacing all the old assertion methods because they removed them 🥲

* Oh so that's what dotnet-eng was used for. Yeah ok that makes sense.

* Add Robust.Analyzers.Test

* Update submodule

* commit to re-run CI
This commit is contained in:
Pieter-Jan Briers
2024-01-12 23:22:01 +01:00
committed by GitHub
parent d2a1eae2d9
commit a6c9c36b68
44 changed files with 267 additions and 294 deletions

View File

@@ -16,7 +16,7 @@ namespace Content.Shared.Atmos
public readonly Vector2i Index;
public readonly Vector2i Origin;
public GasOverlayData[][] TileData = new GasOverlayData[ChunkSize][];
public GasOverlayData[] TileData = new GasOverlayData[ChunkSize * ChunkSize];
[NonSerialized]
public GameTick LastUpdate;
@@ -25,31 +25,25 @@ namespace Content.Shared.Atmos
{
Index = index;
Origin = Index * ChunkSize;
// For whatever reason, net serialize does not like multi_D arrays. So Jagged it is.
for (var i = 0; i < ChunkSize; i++)
{
TileData[i] = new GasOverlayData[ChunkSize];
}
}
public GasOverlayChunk(GasOverlayChunk data)
{
Index = data.Index;
Origin = data.Origin;
for (int i = 0; i < ChunkSize; i++)
{
// This does not clone the opacity array. However, this chunk cloning is only used by the client,
// which never modifies that directly. So this should be fine.
var array = TileData[i] = new GasOverlayData[ChunkSize];
Array.Copy(data.TileData[i], array, ChunkSize);
}
// This does not clone the opacity array. However, this chunk cloning is only used by the client,
// which never modifies that directly. So this should be fine.
Array.Copy(data.TileData, TileData, data.TileData.Length);
}
public ref GasOverlayData GetData(Vector2i gridIndices)
/// <summary>
/// Resolve a data index into <see cref="TileData"/> for the given grid index.
/// </summary>
public int GetDataIndex(Vector2i gridIndices)
{
DebugTools.Assert(InBounds(gridIndices));
return ref TileData[gridIndices.X - Origin.X][gridIndices.Y - Origin.Y];
return (gridIndices.X - Origin.X) + (gridIndices.Y - Origin.Y) * ChunkSize;
}
private bool InBounds(Vector2i gridIndices)
@@ -63,37 +57,32 @@ namespace Content.Shared.Atmos
public struct GasChunkEnumerator
{
private GasOverlayChunk _chunk;
public int X = 0;
public int Y = -1;
private GasOverlayData[] _column;
private readonly GasOverlayData[] _tileData;
private int _index = -1;
public int X = ChunkSize - 1;
public int Y = -1;
public GasChunkEnumerator(GasOverlayChunk chunk)
{
_chunk = chunk;
_column = _chunk.TileData[0];
_tileData = chunk.TileData;
}
public bool MoveNext(out GasOverlayData gas)
{
while (X < ChunkSize)
while (_index < _tileData.Length)
{
// We want to increment Y before returning, but we also want it to match the current Y coordinate for
// the returned gas, so using a slightly different logic for the Y loop.
while (Y < ChunkSize - 1)
X += 1;
if (X >= ChunkSize)
{
Y++;
gas = _column[Y];
if (!gas.Equals(default))
return true;
X = 0;
Y += 1;
}
X++;
if (X < ChunkSize)
_column = _chunk.TileData[X];
Y = -1;
_index += 1;
gas = _tileData[_index];
if (!gas.Equals(default))
return true;
}
gas = default;