summaryrefslogtreecommitdiff
path: root/src/engine/systems/LambdaFactory.ts
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-03-05 22:00:04 -0700
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-03-05 22:00:04 -0700
commitce06fa7c29ba4e3d6137f7aa74fbfe45af0e8b73 (patch)
treeef17306b0fe5f2f957d9c37638a6af76236c7881 /src/engine/systems/LambdaFactory.ts
parent110fe21a2340365b7b7cb72f6f44ad13ed39f4ea (diff)
downloadthe-abstraction-engine-ce06fa7c29ba4e3d6137f7aa74fbfe45af0e8b73.tar.gz
the-abstraction-engine-ce06fa7c29ba4e3d6137f7aa74fbfe45af0e8b73.zip
refactor spawners
Diffstat (limited to 'src/engine/systems/LambdaFactory.ts')
-rw-r--r--src/engine/systems/LambdaFactory.ts34
1 files changed, 0 insertions, 34 deletions
diff --git a/src/engine/systems/LambdaFactory.ts b/src/engine/systems/LambdaFactory.ts
deleted file mode 100644
index 1263eae..0000000
--- a/src/engine/systems/LambdaFactory.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import { System, SystemNames } from ".";
-import { Game } from "..";
-import { ComponentNames, Grid, LambdaSpawn } from "../components";
-import { FunctionBox } from "../entities";
-
-export class LambdaFactory extends System {
- constructor() {
- super(SystemNames.LambdaFactory);
- }
-
- public update(_dt: number, game: Game) {
- game.forEachEntityWithComponent(ComponentNames.LambdaSpawn, (entity) => {
- const lambdaSpawn = entity.getComponent<LambdaSpawn>(
- ComponentNames.LambdaSpawn,
- )!;
- const hasGrid = entity.hasComponent(SystemNames.Grid);
-
- if (!lambdaSpawn.direction || !hasGrid) {
- return;
- }
-
- const grid = entity.getComponent<Grid>(SystemNames.Grid)!;
-
- const lambda = new FunctionBox(grid.gridPosition, lambdaSpawn.code);
- const lambdaGrid = lambda.getComponent<Grid>(SystemNames.Grid)!;
- lambdaGrid.movingDirection = lambdaSpawn.direction;
- lambda.addComponent(lambdaGrid);
- game.addEntity(lambda);
-
- lambdaSpawn.direction = null;
- entity.addComponent(lambdaSpawn);
- });
- }
-}