Better handling of non-user-code problems in game-dev mode. Don't simulate whole level first time a game-dev level is loaded.

This commit is contained in:
Nick Winter 2016-08-24 15:21:09 -07:00
parent 80f8fd60d8
commit 878dcbdc49
3 changed files with 9 additions and 3 deletions

View file

@ -507,6 +507,11 @@ self.onWorldError = function onWorldError(error) {
}
else {
console.log("Non-UserCodeError:", error.toString() + "\n" + error.stack || error.stackTrace);
if(self.world.indefiniteLength) {
// We don't abort completely, since the player can always click to end the game.
// TODO: some better error to the user would be nice, though.
return true;
}
self.postMessage({type: 'non-user-code-problem', problem: {message: error.toString()}});
return false;
}

View file

@ -234,7 +234,7 @@ module.exports = class Angel extends CocoClass
@running = false
@work = null
@streamingWorld = null
@deserializationQueue = null
@deserializationQueue = []
_.remove @shared.busyAngels, @
@abortTimeout = _.delay @fireWorker, @abortTimeoutDuration
@aborting = true
@ -254,7 +254,7 @@ module.exports = class Angel extends CocoClass
@initialized = false
@work = null
@streamingWorld = null
@deserializationQueue = null
@deserializationQueue = []
@hireWorker() if rehire
hireWorker: ->

View file

@ -139,7 +139,8 @@ module.exports = class TomeView extends CocoView
onSpellLoaded: (e) ->
for spellID, spell of @spells
return unless spell.loaded
@cast()
justBegin = @options.level.isType('game-dev')
@cast false, false, justBegin
onCastSpell: (e) ->
# A single spell is cast.