mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-31 07:12:49 -04:00
No longer constructing SpellViews for non-readable methods.
This commit is contained in:
parent
718d586f07
commit
08f2ee248b
3 changed files with 8 additions and 7 deletions
app
|
@ -111,7 +111,7 @@ module.exports = class Level extends CocoModel
|
|||
visit = (c) ->
|
||||
return if c in sorted
|
||||
lc = _.find levelComponents, {original: c.original}
|
||||
#console.error thang.id or thang.name, 'couldn\'t find lc for', c, 'of', levelComponents unless lc # STREAM: uncomment
|
||||
console.error thang.id or thang.name, 'couldn\'t find lc for', c, 'of', levelComponents unless lc
|
||||
return unless lc
|
||||
if lc.name is 'Programmable'
|
||||
# Programmable always comes last
|
||||
|
|
|
@ -40,19 +40,17 @@ module.exports = class Spell
|
|||
if @permissions.readwrite.length and sessionSource = @session.getSourceFor(@spellKey)
|
||||
@source = sessionSource
|
||||
@thangs = {}
|
||||
if true # @canRead() # Surely we could avoid creating these if we'll never use them? TODO
|
||||
if @canRead() # We can avoid creating these views if we'll never use them.
|
||||
@view = new SpellView {spell: @, session: @session, worker: @worker}
|
||||
@view.render() # Get it ready and code loaded in advance
|
||||
@tabView = new SpellListTabEntryView spell: @, supermodel: @supermodel, language: @language
|
||||
@tabView.render()
|
||||
#else
|
||||
# @spell.loaded = true
|
||||
@team = @permissions.readwrite[0] ? 'common'
|
||||
Backbone.Mediator.publish 'tome:spell-created', spell: @
|
||||
|
||||
destroy: ->
|
||||
@view.destroy()
|
||||
@tabView.destroy()
|
||||
@view?.destroy()
|
||||
@tabView?.destroy()
|
||||
@thangs = null
|
||||
@worker = null
|
||||
|
||||
|
@ -75,7 +73,7 @@ module.exports = class Spell
|
|||
(team ? me.team) in @permissions.readwrite
|
||||
|
||||
getSource: ->
|
||||
@view.getSource()
|
||||
@view?.getSource() ? @source
|
||||
|
||||
transpile: (source) ->
|
||||
if source
|
||||
|
|
|
@ -142,6 +142,9 @@ module.exports = class TomeView extends CocoView
|
|||
else
|
||||
delete @thangSpells[thangID]
|
||||
spell.removeThangID thangID for spell in @spells
|
||||
for spellKey, spell of @spells when not spell.canRead() # Make sure these get transpiled (they have no views).
|
||||
spell.transpile()
|
||||
spell.loaded = true
|
||||
null
|
||||
|
||||
onSpellLoaded: (e) ->
|
||||
|
|
Loading…
Add table
Reference in a new issue