diff --git a/app/lib/simulator/Simulator.coffee b/app/lib/simulator/Simulator.coffee index 314ead42b..f8e485d31 100644 --- a/app/lib/simulator/Simulator.coffee +++ b/app/lib/simulator/Simulator.coffee @@ -71,6 +71,7 @@ module.exports = class Simulator extends CocoClass handleSingleSimulationError: (error) -> console.error 'There was an error simulating a single game!', error + return if @destroyed if @options.headlessClient and @options.simulateOnlyOneGame console.log 'GAMERESULT:tie' process.exit(0) @@ -78,6 +79,7 @@ module.exports = class Simulator extends CocoClass handleSingleSimulationInfiniteLoop: -> console.log 'There was an infinite loop in the single game!' + return if @destroyed if @options.headlessClient and @options.simulateOnlyOneGame console.log 'GAMERESULT:tie' process.exit(0) diff --git a/app/views/play/level/tome/TomeView.coffee b/app/views/play/level/tome/TomeView.coffee index 4fe38c061..b2962d779 100644 --- a/app/views/play/level/tome/TomeView.coffee +++ b/app/views/play/level/tome/TomeView.coffee @@ -61,15 +61,16 @@ module.exports = class TomeView extends CocoView super() @worker = @createWorker() programmableThangs = _.filter @options.thangs, 'isProgrammable' - if programmableThangs.length - @createSpells programmableThangs, programmableThangs[0].world # Do before spellList, thangList, and castButton - @spellList = @insertSubView new SpellListView spells: @spells, supermodel: @supermodel - @thangList = @insertSubView new ThangListView spells: @spells, thangs: @options.thangs, supermodel: @supermodel - @castButton = @insertSubView new CastButtonView spells: @spells, levelID: @options.levelID - @teamSpellMap = @generateTeamSpellMap(@spells) - else + @createSpells programmableThangs, programmableThangs[0]?.world # Do before spellList, thangList, and castButton + @spellList = @insertSubView new SpellListView spells: @spells, supermodel: @supermodel + @thangList = @insertSubView new ThangListView spells: @spells, thangs: @options.thangs, supermodel: @supermodel + @castButton = @insertSubView new CastButtonView spells: @spells, levelID: @options.levelID + @teamSpellMap = @generateTeamSpellMap(@spells) + unless programmableThangs.length @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 onNewWorld: (e) ->