Update content vectors to numerics (#17759)

This commit is contained in:
metalgearsloth
2023-07-08 14:08:32 +10:00
committed by GitHub
parent 15772478c9
commit 68480af109
383 changed files with 978 additions and 575 deletions

View File

@@ -1,5 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Numerics;
using System.Threading.Tasks;
using Content.Server.Administration.Managers;
using Content.Shared.Administration;
@@ -32,6 +33,8 @@ namespace Content.Server.Decals
private readonly Dictionary<EntityUid, HashSet<Vector2i>> _dirtyChunks = new();
private readonly Dictionary<IPlayerSession, Dictionary<EntityUid, HashSet<Vector2i>>> _previousSentChunks = new();
private static readonly Vector2 _boundsMinExpansion = new(0.01f, 0.01f);
private static readonly Vector2 _boundsMaxExpansion = new(1.01f, 1.01f);
// If this ever gets parallelised then you'll want to increase the pooled count.
private ObjectPool<HashSet<Vector2i>> _chunkIndexPool =
@@ -100,7 +103,7 @@ namespace Content.Server.Decals
if (!oldChunkCollection.TryGetValue(chunkIndices, out var oldChunk))
continue;
var bounds = new Box2(tilePos - 0.01f, tilePos + 1.01f);
var bounds = new Box2(tilePos - _boundsMinExpansion, tilePos + _boundsMaxExpansion);
var toRemove = new RemQueue<uint>();
foreach (var (oldDecalId, decal) in oldChunk.Decals)
@@ -283,7 +286,7 @@ namespace Content.Server.Decals
foreach (var (uid, decal) in chunk.Decals)
{
if ((position - decal.Coordinates-new Vector2(0.5f, 0.5f)).Length > distance)
if ((position - decal.Coordinates - new Vector2(0.5f, 0.5f)).Length() > distance)
continue;
if (validDelegate == null || validDelegate(decal))