mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Fixed a few bugs where default hero level type wasn't getting pulled.
This commit is contained in:
parent
e0b49ba2aa
commit
7f9ac5e573
3 changed files with 6 additions and 6 deletions
|
@ -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
|
||||
|
|
|
@ -42,8 +42,8 @@ module.exports = class LevelThangEditView extends CocoView
|
|||
supermodel: @supermodel
|
||||
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
|
||||
|
|
|
@ -394,7 +394,7 @@ module.exports = class ThangsTabView extends CocoView
|
|||
thang.isSelectable = not thang.isLand for thang in @world.thangs # let us select walls and such
|
||||
@surface?.setWorld @world
|
||||
@selectAddThangType @addThangType, @cloneSourceThang if @addThangType # make another addThang sprite, since the World just refreshed
|
||||
|
||||
|
||||
# update selection, since the thangs have been remade
|
||||
if @selectedExtantThang
|
||||
@selectedExtantSprite = @surface.spriteBoss.sprites[@selectedExtantThang.id]
|
||||
|
@ -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') ? []
|
||||
|
|
Loading…
Reference in a new issue