mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-16 00:19:50 -05:00
Fixed another bug with loading heroes between levels.
This commit is contained in:
parent
b0ee2224ae
commit
f3511a5dde
2 changed files with 13 additions and 3 deletions
|
@ -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.
|
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')
|
session.set 'heroConfig', heroConfig unless _.isEqual heroConfig, session.get('heroConfig')
|
||||||
url = "/db/thang.type/#{heroConfig.thangType}/version"
|
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)
|
for itemThangType in _.values(heroConfig.inventory)
|
||||||
url = "/db/thang.type/#{itemThangType}/version?project=name,components,original"
|
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
|
# Grabbing the rest of the required data for the level
|
||||||
|
|
||||||
|
|
|
@ -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>'))
|
group.append($('<button class="btn btn-small banner with-dot">' + s + ' <div class="dot"></div></button>'))
|
||||||
@lastResponses = null
|
@lastResponses = null
|
||||||
if @speaker is 'Hero Placeholder'
|
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'
|
name = {knight: 'Tharin', captain: 'Anya'}[@speakerSprite?.thang?.id] ? 'Hero'
|
||||||
else
|
else
|
||||||
name = @speaker
|
name = @speaker
|
||||||
|
|
Loading…
Reference in a new issue