From 8a5c4eec79d0e7b619495065fd439d25947f5d4c Mon Sep 17 00:00:00 2001 From: garrettmills Date: Sat, 12 Sep 2020 14:29:07 -0500 Subject: [PATCH] Only allow firing missiles in missile mode (#5) --- src/components/TopLevel.component.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/TopLevel.component.js b/src/components/TopLevel.component.js index 74be3c2..6b91368 100644 --- a/src/components/TopLevel.component.js +++ b/src/components/TopLevel.component.js @@ -170,12 +170,14 @@ export default class TopLevelComponent extends Component { * @param {number} column_index */ on_missile_fired([row_index, column_index]) { - game_service.attempt_missile_fire([row_index, column_index]) + if ( this.player_is_firing_missiles ) { + game_service.attempt_missile_fire([row_index, column_index]) - // Give the user time to see whether they hit or not - setTimeout(() => { - game_service.advance_game_state() - }, 5000) + // Give the user time to see whether they hit or not + setTimeout(() => { + game_service.advance_game_state() + }, 5000) + } } /**