Skip to content

Commit f6b476d

Browse files
committed
fix: failing to eject an unheld item is an illegal state
1 parent 390a19c commit f6b476d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/lib/ActionInputStateMachine.svelte.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ export class ActionInputVerifier {
4141
else if (action.includes('EjectBalloon')) this.held_balloons--;
4242
else if (action.includes('EjectBunny')) this.held_bunnies--;
4343
else if (action.includes('EjectTote')) this.held_totes--;
44+
} else {
45+
if (action.includes('EjectBalloon') && this.held_balloons <= 0) return false;
46+
else if (action.includes('EjectBunny') && this.held_bunnies <= 0) return false;
47+
else if (action.includes('EjectTote') && this.held_totes <= 0) return false;
4448
}
4549
if (action.includes('ScoreBalloon')) this.held_balloons--;
4650
else if (action.includes('ScoreBunny')) this.held_bunnies--;

0 commit comments

Comments
 (0)