diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-03-07 23:48:04 -0700 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-03-07 23:48:04 -0700 |
commit | 634b2c1b69b9cc107546b12e710fc2daec53fcec (patch) | |
tree | 27b3396a227ace81fea583c62fbb36458cb1eebe /src/engine/entities | |
parent | ea6c1eef48ba8d39defdd8cd78adc45ae660caf9 (diff) | |
download | the-abstraction-engine-634b2c1b69b9cc107546b12e710fc2daec53fcec.tar.gz the-abstraction-engine-634b2c1b69b9cc107546b12e710fc2daec53fcec.zip |
minor bug fixes
Diffstat (limited to 'src/engine/entities')
-rw-r--r-- | src/engine/entities/LambdaFactory.ts | 13 |
1 files changed, 10 insertions, 3 deletions
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<GridSpawn>(ComponentNames.GridSpawn); spawner.spawnEntity(direction); - const text = this.getComponent<Text>(ComponentNames.Text); - text.text = spawner.spawnsLeft.toString(); - this.addComponent(text); + const textComponent = this.getComponent<Text>(ComponentNames.Text); + textComponent.text = spawner.spawnsLeft.toString(); + this.addComponent(textComponent); SOUNDS.get(LambdaTransformSound.name)!.play(); } |