merge main

This commit is contained in:
Peter Cottle 2023-06-24 10:33:32 -06:00
commit b30bcb0395

View file

@ -264,13 +264,14 @@ var Level = Sandbox.extend({
var toIssue = this.level.solutionCommand; var toIssue = this.level.solutionCommand;
var issueFunc = function() { var issueFunc = function() {
this.isShowingSolution = true; this.isShowingSolution = true;
this.wasResetAfterSolved = true;
Main.getEventBaton().trigger( Main.getEventBaton().trigger(
'commandSubmitted', 'commandSubmitted',
toIssue toIssue
); );
log.showLevelSolution(this.getEnglishName()); log.showLevelSolution(this.getEnglishName());
}.bind(this); }.bind(this);
var commandStr = command.get('rawStr'); var commandStr = command.get('rawStr');
if (!this.testOptionOnString(commandStr, 'noReset')) { if (!this.testOptionOnString(commandStr, 'noReset')) {
toIssue = 'reset --forSolution; ' + toIssue; toIssue = 'reset --forSolution; ' + toIssue;
@ -281,25 +282,30 @@ var Level = Sandbox.extend({
return; return;
} }
// allow them for force the solution if(!LevelStore.isLevelSolved(this.level.id)){
var confirmDefer = Q.defer(); // allow them for force the solution
var dialog = intl.getDialog(require('../dialogs/confirmShowSolution'))[0]; var confirmDefer = Q.defer();
var confirmView = new ConfirmCancelTerminal({ var dialog = intl.getDialog(require('../dialogs/confirmShowSolution'))[0];
markdowns: dialog.options.markdowns, var confirmView = new ConfirmCancelTerminal({
deferred: confirmDefer markdowns: dialog.options.markdowns,
}); deferred: confirmDefer
});
confirmDefer.promise confirmDefer.promise
.then(issueFunc) .then(issueFunc)
.fail(function() { .fail(function() {
command.setResult(""); command.setResult("");
}) })
.done(function() { .done(function() {
// either way we animate, so both options can share this logic // either way we animate, so both options can share this logic
setTimeout(function() { setTimeout(function() {
command.finishWith(deferred); command.finishWith(deferred);
}, confirmView.getAnimationTime()); }, confirmView.getAnimationTime());
}); });
} else {
issueFunc();
command.finishWith(deferred);
}
}, },
toggleObjective: function() { toggleObjective: function() {