refactor: less noise

This commit is contained in:
cha0s 2024-07-13 00:33:50 -05:00
parent 03035ec8b6
commit 4256d8770f

View File

@ -12,7 +12,7 @@ export default class Interactions extends System {
tick() {
for (const entity of this.select('default')) {
const {Interacts} = entity;
Interacts.willInteractWith = 0
let willInteract = false;
const entities = Array.from(this.ecs.system('Colliders').within(Interacts.aabb()))
.filter((other) => other !== entity)
.sort(({Position: l}, {Position: r}) => {
@ -24,8 +24,12 @@ export default class Interactions extends System {
}
if (other.Interactive && other.Interactive.interacting) {
Interacts.willInteractWith = other.id;
willInteract = true;
}
}
if (!willInteract) {
Interacts.willInteractWith = 0;
}
}
}