summaryrefslogtreecommitdiff
path: root/engine/structures
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-08-15 18:30:19 -0600
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-08-15 18:30:19 -0600
commit732fe6f4811cc082bf938fed2d28c1f9c8bbd1f6 (patch)
treebf9d2aa160fb3e5564f4ae788ecc86927b716e0b /engine/structures
parent2dc3120831fbcd03b635bbad59213ff0bf1f8879 (diff)
downloadjumpstorm-732fe6f4811cc082bf938fed2d28c1f9c8bbd1f6.tar.gz
jumpstorm-732fe6f4811cc082bf938fed2d28c1f9c8bbd1f6.zip
generate uuids for entities; scaffolding for a server
Diffstat (limited to 'engine/structures')
-rw-r--r--engine/structures/QuadTree.ts12
1 files changed, 4 insertions, 8 deletions
diff --git a/engine/structures/QuadTree.ts b/engine/structures/QuadTree.ts
index a57c6e7..49afdad 100644
--- a/engine/structures/QuadTree.ts
+++ b/engine/structures/QuadTree.ts
@@ -1,7 +1,7 @@
import type { Coord2D, Dimension2D } from "../interfaces";
interface BoxedEntry {
- id: number;
+ id: string;
dimension: Dimension2D;
center: Coord2D;
}
@@ -72,8 +72,8 @@ export class QuadTree {
}
}
- public getNeighborIds(boxedEntry: BoxedEntry): number[] {
- const neighbors: number[] = this.objects.map(({ id }) => id);
+ public getNeighborIds(boxedEntry: BoxedEntry): string[] {
+ const neighbors: string[] = this.objects.map(({ id }) => id);
if (this.hasChildren()) {
this.getQuadrants(boxedEntry).forEach((quadrant) => {
@@ -160,11 +160,7 @@ export class QuadTree {
this.objects.forEach((boxedEntry) => {
this.getQuadrants(boxedEntry).forEach((direction) => {
const quadrant = this.children.get(direction);
- quadrant?.insert(
- boxedEntry.id,
- boxedEntry.dimension,
- boxedEntry.center,
- );
+ quadrant?.insert(boxedEntry);
});
});