mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-13 22:49:51 -04:00
Fixed a couple issues with errors during incompletely loaded levels or weird child window global situations using level editor.
This commit is contained in:
parent
1be0852872
commit
8fc893dd6f
2 changed files with 7 additions and 6 deletions
|
@ -109,7 +109,7 @@ module.exports = class LevelHUDView extends CocoView
|
|||
props.find('.prop').remove()
|
||||
#propNames = _.without @thang.hudProperties ? [], 'action'
|
||||
propNames = @thang.hudProperties
|
||||
for prop, i in propNames
|
||||
for prop, i in propNames ? []
|
||||
pel = @createPropElement prop
|
||||
continue unless pel?
|
||||
if pel.find('.bar').is('*') and props.find('.bar').is('*')
|
||||
|
|
|
@ -60,7 +60,8 @@ module.exports = class TomeView extends CocoView
|
|||
@worker = @createWorker()
|
||||
programmableThangs = _.filter @options.thangs, (t) -> t.isProgrammable and t.programmableMethods
|
||||
@createSpells programmableThangs, programmableThangs[0]?.world # Do before spellList, thangList, and castButton
|
||||
@spellList = @insertSubView new SpellListView spells: @spells, supermodel: @supermodel, level: @options.level
|
||||
unless @options.level.get('type', true) in ['hero', 'hero-ladder', 'hero-coop']
|
||||
@spellList = @insertSubView new SpellListView spells: @spells, supermodel: @supermodel, level: @options.level
|
||||
@castButton = @insertSubView new CastButtonView spells: @spells, level: @options.level, session: @options.session
|
||||
@teamSpellMap = @generateTeamSpellMap(@spells)
|
||||
unless programmableThangs.length
|
||||
|
@ -74,7 +75,7 @@ module.exports = class TomeView extends CocoView
|
|||
thangs = _.filter e.world.thangs, 'inThangList'
|
||||
programmableThangs = _.filter thangs, (t) -> t.isProgrammable and t.programmableMethods
|
||||
@createSpells programmableThangs, e.world
|
||||
@spellList.adjustSpells @spells
|
||||
@spellList?.adjustSpells @spells
|
||||
|
||||
onCommentMyCode: (e) ->
|
||||
for spellKey, spell of @spells when spell.canWrite()
|
||||
|
@ -170,8 +171,8 @@ module.exports = class TomeView extends CocoView
|
|||
Backbone.Mediator.publish 'tome:cast-spells', spells: @spells, preload: preload, realTime: realTime, submissionCount: sessionState.submissionCount ? 0, flagHistory: sessionState.flagHistory ? [], difficulty: difficulty
|
||||
|
||||
onToggleSpellList: (e) ->
|
||||
@spellList.rerenderEntries()
|
||||
@spellList.$el.toggle()
|
||||
@spellList?.rerenderEntries()
|
||||
@spellList?.$el.toggle()
|
||||
|
||||
onSpellViewClick: (e) ->
|
||||
@spellList?.$el.hide()
|
||||
|
@ -210,7 +211,7 @@ module.exports = class TomeView extends CocoView
|
|||
@castButton?.attachTo @spellView
|
||||
Backbone.Mediator.publish 'tome:spell-shown', thang: thang, spell: spell
|
||||
@updateSpellPalette thang, spell
|
||||
@spellList.setThangAndSpell thang, spell
|
||||
@spellList?.setThangAndSpell thang, spell
|
||||
@spellView?.setThang thang
|
||||
@spellTabView?.setThang thang
|
||||
|
||||
|
|
Loading…
Reference in a new issue