Fixed problem with loading levels with no Programmable Thanags, and fixed infinite loops while simulating single games when swapping out Simulators.
This commit is contained in:
parent
2c6fc67db2
commit
91db8397a0
2 changed files with 11 additions and 8 deletions
app
|
@ -71,6 +71,7 @@ module.exports = class Simulator extends CocoClass
|
||||||
|
|
||||||
handleSingleSimulationError: (error) ->
|
handleSingleSimulationError: (error) ->
|
||||||
console.error 'There was an error simulating a single game!', error
|
console.error 'There was an error simulating a single game!', error
|
||||||
|
return if @destroyed
|
||||||
if @options.headlessClient and @options.simulateOnlyOneGame
|
if @options.headlessClient and @options.simulateOnlyOneGame
|
||||||
console.log 'GAMERESULT:tie'
|
console.log 'GAMERESULT:tie'
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
|
@ -78,6 +79,7 @@ module.exports = class Simulator extends CocoClass
|
||||||
|
|
||||||
handleSingleSimulationInfiniteLoop: ->
|
handleSingleSimulationInfiniteLoop: ->
|
||||||
console.log 'There was an infinite loop in the single game!'
|
console.log 'There was an infinite loop in the single game!'
|
||||||
|
return if @destroyed
|
||||||
if @options.headlessClient and @options.simulateOnlyOneGame
|
if @options.headlessClient and @options.simulateOnlyOneGame
|
||||||
console.log 'GAMERESULT:tie'
|
console.log 'GAMERESULT:tie'
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
|
|
|
@ -61,15 +61,16 @@ module.exports = class TomeView extends CocoView
|
||||||
super()
|
super()
|
||||||
@worker = @createWorker()
|
@worker = @createWorker()
|
||||||
programmableThangs = _.filter @options.thangs, 'isProgrammable'
|
programmableThangs = _.filter @options.thangs, 'isProgrammable'
|
||||||
if programmableThangs.length
|
@createSpells programmableThangs, programmableThangs[0]?.world # Do before spellList, thangList, and castButton
|
||||||
@createSpells programmableThangs, programmableThangs[0].world # Do before spellList, thangList, and castButton
|
@spellList = @insertSubView new SpellListView spells: @spells, supermodel: @supermodel
|
||||||
@spellList = @insertSubView new SpellListView spells: @spells, supermodel: @supermodel
|
@thangList = @insertSubView new ThangListView spells: @spells, thangs: @options.thangs, supermodel: @supermodel
|
||||||
@thangList = @insertSubView new ThangListView spells: @spells, thangs: @options.thangs, supermodel: @supermodel
|
@castButton = @insertSubView new CastButtonView spells: @spells, levelID: @options.levelID
|
||||||
@castButton = @insertSubView new CastButtonView spells: @spells, levelID: @options.levelID
|
@teamSpellMap = @generateTeamSpellMap(@spells)
|
||||||
@teamSpellMap = @generateTeamSpellMap(@spells)
|
unless programmableThangs.length
|
||||||
else
|
|
||||||
@cast()
|
@cast()
|
||||||
console.warn 'Warning: There are no Programmable Thangs in this level, which makes it unplayable.'
|
warning = 'Warning: There are no Programmable Thangs in this level, which makes it unplayable.'
|
||||||
|
noty text: warning, layout: 'topCenter', type: 'warning', killer: false, timeout: 15000, dismissQueue: true, maxVisible: 3
|
||||||
|
console.warn warning
|
||||||
delete @options.thangs
|
delete @options.thangs
|
||||||
|
|
||||||
onNewWorld: (e) ->
|
onNewWorld: (e) ->
|
||||||
|
|
Reference in a new issue