1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-23 00:48: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)); hashSet.Add(new Cell(x, z));
} }
var centerPosition = center.ToVector3d();
var cells = new List<Cell>(hashSet); var cells = new List<Cell>(hashSet);
cells.Sort((a, b) => cells.Sort((a, b) => Vector3d.DistanceSquared(a.ToVector3d(), centerPosition).CompareTo(Vector3d.Distance(b.ToVector3d(), centerPosition)));
{
int x = a.X.CompareTo(b.X);
return x == 0 ? a.Z.CompareTo(b.Z) : x;
});
var objects = new List<VirtualParadiseObject>(); var objects = new List<VirtualParadiseObject>();
var tasks = new List<Task>(); var tasks = new List<Task>();