mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 08:50:58 -05:00
Added infinite loop handling to Simulator.
This commit is contained in:
parent
97613f12b4
commit
773df44b14
1 changed files with 6 additions and 0 deletions
|
@ -81,8 +81,14 @@ module.exports = class Simulator extends CocoClass
|
|||
|
||||
commenceSimulationAndSetupCallback: ->
|
||||
@god.createWorld()
|
||||
Backbone.Mediator.subscribeOnce 'god:infinite-loop', @onInfiniteLoop, @
|
||||
Backbone.Mediator.subscribeOnce 'god:new-world-created', @processResults, @
|
||||
|
||||
onInfiniteLoop: ->
|
||||
console.warn "Skipping infinitely looping game."
|
||||
@trigger 'statusUpdate', 'Infinite loop detected; grabbing a new game.'
|
||||
_.delay @cleanupAndSimulateAnotherTask, 5000
|
||||
|
||||
processResults: (simulationResults) ->
|
||||
taskResults = @formTaskResultsObject simulationResults
|
||||
@sendResultsBackToServer taskResults
|
||||
|
|
Loading…
Reference in a new issue