From 4b9349b3f8bee21eb086cfd6e7668532a50e6048 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Sat, 2 Mar 2024 04:02:20 -0700 Subject: add text on lambda factory --- src/engine/systems/Grid.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/engine/systems/Grid.ts') diff --git a/src/engine/systems/Grid.ts b/src/engine/systems/Grid.ts index 28ca5ea..8756320 100644 --- a/src/engine/systems/Grid.ts +++ b/src/engine/systems/Grid.ts @@ -39,7 +39,7 @@ export class Grid extends System { } private highlightEntitiesLookedAt(game: Game) { - const highlightableEntities = new Set(); + const highlightableEntities: [string, Direction][] = []; game.forEachEntityWithComponent( ComponentNames.FacingDirection, @@ -64,23 +64,23 @@ export class Grid extends System { } this.grid[lookingAt.y][lookingAt.x].forEach((id) => { - highlightableEntities.add(id); + highlightableEntities.push([id, facingDirection.currentDirection]); }); }, ); - highlightableEntities.forEach((id) => { + highlightableEntities.forEach(([id, direction]) => { const entity = game.getEntity(id)!; if (entity.hasComponent(ComponentNames.Highlight)) { const highlight = entity.getComponent( ComponentNames.Highlight, )!; - highlight.highlight(); + highlight.highlight(direction); } }); game.forEachEntityWithComponent(ComponentNames.Highlight, (entity) => { - if (!highlightableEntities.has(entity.id)) { + if (!highlightableEntities.find(([id]) => id === entity.id)) { const highlight = entity.getComponent( ComponentNames.Highlight, )!; -- cgit v1.2.3-70-g09d2