diff options
Diffstat (limited to 'src/engine/entities/FunctionApplication.ts')
-rw-r--r-- | src/engine/entities/FunctionApplication.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/engine/entities/FunctionApplication.ts b/src/engine/entities/FunctionApplication.ts index bd88bda..ac07f88 100644 --- a/src/engine/entities/FunctionApplication.ts +++ b/src/engine/entities/FunctionApplication.ts @@ -30,8 +30,9 @@ import { interpret, } from "../../interpreter"; -const APPLICATION_RESULTS: Record<string, (gridPosition: Coord2D) => Entity> = { +const APPLICATION_RESULTS: Record<string, (gridPosition: Coord2D) => null | Entity> = { _KEY: (gridPosition: Coord2D) => new Key(gridPosition), + _EMPTY: (_gridPosition: Coord2D) => null, }; export class FunctionApplication extends Entity { @@ -177,7 +178,8 @@ export class FunctionApplication extends Entity { const { name } = data; const entityFactory = APPLICATION_RESULTS[name]; if (entityFactory) { - game.addEntity(entityFactory(nextPosition)); + const entity = entityFactory(nextPosition) + entity && game.addEntity(entity); } } |