From 634b2c1b69b9cc107546b12e710fc2daec53fcec Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Thu, 7 Mar 2024 23:48:04 -0700 Subject: minor bug fixes --- src/engine/entities/LambdaFactory.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/engine/entities/LambdaFactory.ts') diff --git a/src/engine/entities/LambdaFactory.ts b/src/engine/entities/LambdaFactory.ts index 9ad1398..770c096 100644 --- a/src/engine/entities/LambdaFactory.ts +++ b/src/engine/entities/LambdaFactory.ts @@ -143,12 +143,19 @@ export class LambdaFactory extends Entity { } private spawnNewLambda(direction: Direction) { + try { + parse(this.code); + } catch (e: any) { + SOUNDS.get(Failure.name)!.play(); + return; + } + const spawner = this.getComponent(ComponentNames.GridSpawn); spawner.spawnEntity(direction); - const text = this.getComponent(ComponentNames.Text); - text.text = spawner.spawnsLeft.toString(); - this.addComponent(text); + const textComponent = this.getComponent(ComponentNames.Text); + textComponent.text = spawner.spawnsLeft.toString(); + this.addComponent(textComponent); SOUNDS.get(LambdaTransformSound.name)!.play(); } -- cgit v1.2.3-70-g09d2