Fixed up the level loader to include session objects as world necessities.

This commit is contained in:
Scott Erickson 2014-05-21 12:53:28 -07:00
parent c43081636f
commit 18f694b010

View file

@ -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}"