diff --git a/src/js/actions/GlobalStateActions.js b/src/js/actions/GlobalStateActions.js index f04a747e..4e3ea1ca 100644 --- a/src/js/actions/GlobalStateActions.js +++ b/src/js/actions/GlobalStateActions.js @@ -20,6 +20,12 @@ var GlobalStateActions = { }); }, + disableLevelInstructions: function() { + AppDispatcher.handleViewAction({ + type: ActionTypes.DISABLE_LEVEL_INSTRUCTIONS, + }); + }, + changeFlipTreeY: function(flipTreeY) { AppDispatcher.handleViewAction({ type: ActionTypes.CHANGE_FLIP_TREE_Y, diff --git a/src/js/constants/AppConstants.js b/src/js/constants/AppConstants.js index b738fbfa..1c8c80bd 100644 --- a/src/js/constants/AppConstants.js +++ b/src/js/constants/AppConstants.js @@ -26,6 +26,7 @@ module.exports = { SUBMIT_COMMAND: null, CHANGE_LOCALE: null, CHANGE_LOCALE_FROM_HEADER: null, + DISABLE_LEVEL_INSTRUCTIONS: null, /** * only dispatched when you actually * solve the level, not ask for solution diff --git a/src/js/level/index.js b/src/js/level/index.js index a394468d..e17be7b5 100644 --- a/src/js/level/index.js +++ b/src/js/level/index.js @@ -69,6 +69,13 @@ var Level = Sandbox.extend({ // if there is a multiview in the beginning, open that // and let it resolve our deferred + if (GlobalStateStore.getShouldDisableLevelInstructions()) { + setTimeout(function() { + deferred.resolve(); + }, 100); + return; + } + if (this.level.startDialog && !this.testOption('noIntroDialog')) { new MultiView(Object.assign( {}, @@ -166,6 +173,14 @@ var Level = Sandbox.extend({ startOffCommand: function() { var method = this.options.command.get('method'); + if (GlobalStateStore.getShouldDisableLevelInstructions()) { + Main.getEventBaton().trigger( + 'commandSubmitted', + 'hint; show goal' + ); + return; + } + if (!this.testOption('noStartCommand') && method !== 'importLevelNow') { Main.getEventBaton().trigger( 'commandSubmitted', diff --git a/src/js/sandbox/commands.js b/src/js/sandbox/commands.js index 7d740362..24158874 100644 --- a/src/js/sandbox/commands.js +++ b/src/js/sandbox/commands.js @@ -84,6 +84,12 @@ var instantCommands = [ msg: intl.str('flip-tree-command') }); }], + [/^disableLevelInstructions$/, function() { + GlobalStateActions.disableLevelInstructions(); + throw new CommandResult({ + msg: intl.todo('Level instructions disabled'), + }); + }], [/^refresh$/, function() { var events = require('../app').getEvents(); diff --git a/src/js/stores/GlobalStateStore.js b/src/js/stores/GlobalStateStore.js index 50f764bb..74f4e47f 100644 --- a/src/js/stores/GlobalStateStore.js +++ b/src/js/stores/GlobalStateStore.js @@ -9,6 +9,7 @@ var ActionTypes = AppConstants.ActionTypes; var _isAnimating = false; var _flipTreeY = false; var _numLevelsSolved = 0; +var _disableLevelInstructions = false; var GlobalStateStore = Object.assign( {}, @@ -27,6 +28,10 @@ AppConstants.StoreSubscribePrototype, return _numLevelsSolved; }, + getShouldDisableLevelInstructions: function() { + return _disableLevelInstructions; + }, + dispatchToken: AppDispatcher.register(function(payload) { var action = payload.action; var shouldInform = false; @@ -44,6 +49,10 @@ AppConstants.StoreSubscribePrototype, _numLevelsSolved++; shouldInform = true; break; + case ActionTypes.DISABLE_LEVEL_INSTRUCTIONS: + _disableLevelInstructions = true; + shouldInform = true; + break; } if (shouldInform) {