refactor: simple

This commit is contained in:
cha0s 2024-06-11 02:52:23 -05:00
parent e033d6e79a
commit f2445648c4
4 changed files with 6 additions and 6 deletions

View File

@ -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;

View File

@ -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));
}
}
}

View File

@ -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));
}
}
}

View File

@ -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));
}
}
}