mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 08:50:58 -05:00
Fixed up the level loader to include session objects as world necessities.
This commit is contained in:
parent
c43081636f
commit
18f694b010
1 changed files with 6 additions and 2 deletions
|
@ -63,12 +63,14 @@ module.exports = class LevelLoader extends CocoClass
|
|||
url += "?team=#{@team}" if @team
|
||||
|
||||
session = new LevelSession().setURL url
|
||||
@session = @supermodel.loadModel(session, 'level_session', {cache:false}).model
|
||||
@sessionResource = @supermodel.loadModel(session, 'level_session', {cache:false})
|
||||
@session = @sessionResource.model
|
||||
@session.once 'sync', -> @url = -> '/db/level.session/' + @id
|
||||
|
||||
if @opponentSessionID
|
||||
opponentSession = new LevelSession().setURL "/db/level_session/#{@opponentSessionID}"
|
||||
@opponentSession = @supermodel.loadModel(opponentSession, 'opponent_session').model
|
||||
@opponentSessionResource = @supermodel.loadModel(opponentSession, 'opponent_session')
|
||||
@opponentSession = @opponentSessionResource.model
|
||||
|
||||
# Supermodel (Level) Loading
|
||||
|
||||
|
@ -111,6 +113,8 @@ module.exports = class LevelLoader extends CocoClass
|
|||
@thangIDs = _.uniq thangIDs
|
||||
@thangNames = new ThangNamesCollection(@thangIDs)
|
||||
worldNecessities.push @supermodel.loadCollection(@thangNames, 'thang_names')
|
||||
worldNecessities.push @sessionResource if @sessionResource?.isLoading
|
||||
worldNecessities.push @opponentSessionResource if @opponentSessionResource?.isLoading
|
||||
|
||||
for obj in objUniq componentVersions
|
||||
url = "/db/level.component/#{obj.original}/version/#{obj.majorVersion}"
|
||||
|
|
Loading…
Reference in a new issue