diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-03-02 04:02:20 -0700 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-03-02 04:02:20 -0700 |
commit | 4b9349b3f8bee21eb086cfd6e7668532a50e6048 (patch) | |
tree | fa3ae95f516d8ec10fb0de57886ff88410b6d11d /src/engine/systems/Grid.ts | |
parent | 06bb4177202b432d5f42141975ec82b5a8837f0e (diff) | |
download | the-abstraction-engine-4b9349b3f8bee21eb086cfd6e7668532a50e6048.tar.gz the-abstraction-engine-4b9349b3f8bee21eb086cfd6e7668532a50e6048.zip |
add text on lambda factory
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, )!; |