1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-22 19:38:47 +00:00

Query by order of closest to center outward

This commit is contained in:
Oliver Booth 2022-12-07 22:59:37 +00:00
parent 11d8d23339
commit b7e43666b5
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634

View File

@ -65,12 +65,9 @@ public sealed partial class VirtualParadiseClient
hashSet.Add(new Cell(x, z));
}
var centerPosition = center.ToVector3d();
var cells = new List<Cell>(hashSet);
cells.Sort((a, b) =>
{
int x = a.X.CompareTo(b.X);
return x == 0 ? a.Z.CompareTo(b.Z) : x;
});
cells.Sort((a, b) => Vector3d.DistanceSquared(a.ToVector3d(), centerPosition).CompareTo(Vector3d.Distance(b.ToVector3d(), centerPosition)));
var objects = new List<VirtualParadiseObject>();
var tasks = new List<Task>();