diff options
Diffstat (limited to 'src/engine/systems/Grid.ts')
-rw-r--r-- | src/engine/systems/Grid.ts | 10 |
1 files changed, 5 insertions, 5 deletions
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<string>(); + 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<Highlight>( 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<Highlight>( ComponentNames.Highlight, )!; |