mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 15:48:11 -05:00
Components tab now incorporates components inherited from thang types.
This commit is contained in:
parent
ef8ca9874a
commit
5b5bceda3a
1 changed files with 9 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
CocoView = require 'views/kinds/CocoView'
|
||||
template = require 'templates/editor/level/components_tab'
|
||||
ThangType = require 'models/ThangType'
|
||||
LevelComponent = require 'models/LevelComponent'
|
||||
LevelComponentEditView = require './LevelComponentEditView'
|
||||
LevelComponentNewView = require './NewLevelComponentModal'
|
||||
|
@ -27,7 +28,15 @@ module.exports = class ComponentsTabView extends CocoView
|
|||
refreshLevelThangsTreema: (thangsData) ->
|
||||
presentComponents = {}
|
||||
for thang in thangsData
|
||||
componentMap = {}
|
||||
thangType = @supermodel.getModelByOriginal ThangType, thang.thangType
|
||||
for component in thangType.get('components') ? []
|
||||
componentMap[component.original] = component
|
||||
|
||||
for component in thang.components
|
||||
componentMap[component.original] = component
|
||||
|
||||
for component in _.values(componentMap)
|
||||
haveThisComponent = (presentComponents[component.original + '.' + (component.majorVersion ? 0)] ?= [])
|
||||
haveThisComponent.push thang.id if haveThisComponent.length < 100 # for performance when adding many Thangs
|
||||
return if _.isEqual presentComponents, @presentComponents
|
||||
|
|
Loading…
Reference in a new issue