Fixed a few bugs where default hero level type wasn't getting pulled.

This commit is contained in:
Nick Winter 2014-09-02 16:02:30 -07:00
parent e0b49ba2aa
commit 7f9ac5e573
3 changed files with 6 additions and 6 deletions

View file

@ -52,7 +52,7 @@ module.exports = class ThangComponentConfigView extends CocoView
schema.default ?= {}
_.merge schema.default, @additionalDefaults if @additionalDefaults
if @level?.get('type') is 'hero'
if @level?.get('type', true) is 'hero'
schema.required = []
treemaOptions =
supermodel: @supermodel

View file

@ -43,7 +43,7 @@ module.exports = class LevelThangEditView extends CocoView
level: @level
world: @world
if @level.get('type') is 'hero' then options.thangType = thangType
if @level.get('type', true) is 'hero' then options.thangType = thangType
@thangComponentEditView = new ThangComponentsEditView options
@listenTo @thangComponentEditView, 'components-changed', @onComponentsChanged

View file

@ -419,14 +419,14 @@ module.exports = class ThangsTabView extends CocoView
if batchInsert
if thangType.get('name') is 'Hero Placeholder'
thangID = 'Hero Placeholder'
return if @level.get('type') isnt 'hero' or @thangsTreema.get "id=#{thangID}"
return if @level.get('type', true) isnt 'hero' or @thangsTreema.get "id=#{thangID}"
else
thangID = "Random #{thangType.get('name')} #{@thangsBatch.length}"
else
thangID = Thang.nextID(thangType.get('name'), @world) until thangID and not @thangsTreema.get "id=#{thangID}"
if @cloneSourceThang
components = _.cloneDeep @thangsTreema.get "id=#{@cloneSourceThang.id}/components"
else if @level.get('type') is 'hero'
else if @level.get('type', true) is 'hero'
components = [] # Load them all from default ThangType Components
else
components = _.cloneDeep thangType.get('components') ? []