From f2445648c406e489a9fa4f7d5dc7d89bfd1017af Mon Sep 17 00:00:00 2001 From: cha0s Date: Tue, 11 Jun 2024 02:52:23 -0500 Subject: [PATCH] refactor: simple --- app/ecs-systems/calculate-aabbs.js | 2 +- app/ecs-systems/follow-camera.js | 4 ++-- app/ecs-systems/update-spatial-hash.js | 2 +- app/react-components/ecs.jsx | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/ecs-systems/calculate-aabbs.js b/app/ecs-systems/calculate-aabbs.js index f4fef6e..348b054 100644 --- a/app/ecs-systems/calculate-aabbs.js +++ b/app/ecs-systems/calculate-aabbs.js @@ -12,7 +12,7 @@ export default class CalculateAabbs extends System { const {diff} = this.ecs; for (const id in diff) { if (diff[id].Position) { - const {Position: {x, y}, VisibleAabb} = this.ecs.get(parseInt(id)) + const {Position: {x, y}, VisibleAabb} = this.ecs.get(id); if (VisibleAabb) { VisibleAabb.x0 = x - 32; VisibleAabb.x1 = x + 32; diff --git a/app/ecs-systems/follow-camera.js b/app/ecs-systems/follow-camera.js index a53b7f6..68725c1 100644 --- a/app/ecs-systems/follow-camera.js +++ b/app/ecs-systems/follow-camera.js @@ -12,7 +12,7 @@ export default class FollowCamera extends System { reindex(entities) { super.reindex(entities); for (const id of entities) { - this.updateCamera(this.ecs.get(parseInt(id))); + this.updateCamera(this.ecs.get(id)); } } @@ -20,7 +20,7 @@ export default class FollowCamera extends System { const {diff} = this.ecs; for (const id in diff) { if (diff[id].Position) { - this.updateCamera(this.ecs.get(parseInt(id))); + this.updateCamera(this.ecs.get(id)); } } } diff --git a/app/ecs-systems/update-spatial-hash.js b/app/ecs-systems/update-spatial-hash.js index 543f1f8..6a96a59 100644 --- a/app/ecs-systems/update-spatial-hash.js +++ b/app/ecs-systems/update-spatial-hash.js @@ -85,7 +85,7 @@ export default class UpdateSpatialHash extends System { const {diff} = this.ecs; for (const id in diff) { if (diff[id].VisibleAabb) { - this.updateHash(this.ecs.get(parseInt(id))); + this.updateHash(this.ecs.get(id)); } } } diff --git a/app/react-components/ecs.jsx b/app/react-components/ecs.jsx index fc01f9e..6d4b350 100644 --- a/app/react-components/ecs.jsx +++ b/app/react-components/ecs.jsx @@ -20,9 +20,9 @@ export default function EcsComponent() { delete updatedEntities[id]; } else { - updatedEntities[id] = ecs.get(parseInt(id)); + updatedEntities[id] = ecs.get(id); if (updatedEntities[id].MainEntity) { - setMainEntity(ecs.get(parseInt(id))); + setMainEntity(ecs.get(id)); } } }