Fixed another bug with loading heroes between levels.

This commit is contained in:
Nick Winter 2014-09-22 23:01:19 -07:00
parent b0ee2224ae
commit f3511a5dde
2 changed files with 13 additions and 3 deletions

View file

@ -97,12 +97,21 @@ module.exports = class LevelLoader extends CocoClass
heroConfig ?= {inventory: {}, thangType: '529ffbf1cf1818f2be000001'} # If we got here not from PlayLevelModal (like level editor preview), assign Tharin as the hero.
session.set 'heroConfig', heroConfig unless _.isEqual heroConfig, session.get('heroConfig')
url = "/db/thang.type/#{heroConfig.thangType}/version"
@worldNecessities.push @maybeLoadURL(url, ThangType, 'thang')
if heroResource = @maybeLoadURL(url, ThangType, 'thang')
@worldNecessities.push heroResource
else
heroThangType = @supermodel.getModel url
@loadDefaultComponentsForThangType heroThangType
@loadThangsRequiredByThangType heroThangType
for itemThangType in _.values(heroConfig.inventory)
url = "/db/thang.type/#{itemThangType}/version?project=name,components,original"
@worldNecessities.push @maybeLoadURL(url, ThangType, 'thang')
if itemResource = @maybeLoadURL(url, ThangType, 'thang')
@worldNecessities.push itemResource
else
itemThangType = @supermodel.getModel url
@loadDefaultComponentsForThangType itemThangType
@loadThangsRequiredByThangType itemThangType
# Grabbing the rest of the required data for the level

View file

@ -200,6 +200,7 @@ module.exports = class LevelHUDView extends CocoView
group.append($('<button class="btn btn-small banner with-dot">' + s + ' <div class="dot"></div></button>'))
@lastResponses = null
if @speaker is 'Hero Placeholder'
# Doesn't work if it fires from a script; we don't really know who we are then.
name = {knight: 'Tharin', captain: 'Anya'}[@speakerSprite?.thang?.id] ? 'Hero'
else
name = @speaker