mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Fix #3744: course levels work with no hero selected
This commit is contained in:
parent
503d1dd08a
commit
380977f766
3 changed files with 5 additions and 6 deletions
|
@ -173,10 +173,9 @@ module.exports = class LevelLoader extends CocoClass
|
||||||
else if session is @opponentSession
|
else if session is @opponentSession
|
||||||
@consolidateFlagHistory() if @session.loaded
|
@consolidateFlagHistory() if @session.loaded
|
||||||
if @level.get('type', true) in ['course'] # course-ladder is hard to handle because there's 2 sessions
|
if @level.get('type', true) in ['course'] # course-ladder is hard to handle because there's 2 sessions
|
||||||
heroConfig = me.get('heroConfig')
|
heroThangType = me.get('heroConfig')?.thangType or ThangType.heroes.captain
|
||||||
console.log "Course mode, loading custom hero: ", heroConfig if LOG
|
console.log "Course mode, loading custom hero: ", heroThangType if LOG
|
||||||
return if not heroConfig
|
url = "/db/thang.type/#{heroThangType}/version"
|
||||||
url = "/db/thang.type/#{heroConfig.thangType}/version"
|
|
||||||
if heroResource = @maybeLoadURL(url, ThangType, 'thang')
|
if heroResource = @maybeLoadURL(url, ThangType, 'thang')
|
||||||
console.log "Pushing resource: ", heroResource if LOG
|
console.log "Pushing resource: ", heroResource if LOG
|
||||||
@worldNecessities.push heroResource
|
@worldNecessities.push heroResource
|
||||||
|
|
|
@ -166,7 +166,7 @@ module.exports = class World
|
||||||
shouldUpdateProgress = @shouldUpdateRealTimePlayback t2
|
shouldUpdateProgress = @shouldUpdateRealTimePlayback t2
|
||||||
shouldDelayRealTimeSimulation = not shouldUpdateProgress and @shouldDelayRealTimeSimulation t2
|
shouldDelayRealTimeSimulation = not shouldUpdateProgress and @shouldDelayRealTimeSimulation t2
|
||||||
else
|
else
|
||||||
shouldUpdateProgress = t2 - t1 > PROGRESS_UPDATE_INTERVAL
|
shouldUpdateProgress = t2 - t1 > PROGRESS_UPDATE_INTERVAL# and (@frames.length - @framesSerializedSoFar >= @frameRate or t2 - t1 > 1000)
|
||||||
shouldDelayRealTimeSimulation = false
|
shouldDelayRealTimeSimulation = false
|
||||||
return true unless shouldUpdateProgress or shouldDelayRealTimeSimulation
|
return true unless shouldUpdateProgress or shouldDelayRealTimeSimulation
|
||||||
# Stop loading frames for now; continue in a moment.
|
# Stop loading frames for now; continue in a moment.
|
||||||
|
|
|
@ -147,7 +147,7 @@ module.exports = class Level extends CocoModel
|
||||||
|
|
||||||
# Load the user's chosen hero AFTER getting stats from default char
|
# Load the user's chosen hero AFTER getting stats from default char
|
||||||
if /Hero Placeholder/.test(levelThang.id) and @get('type', true) in ['course']
|
if /Hero Placeholder/.test(levelThang.id) and @get('type', true) in ['course']
|
||||||
heroThangType = me.get('heroConfig')?.thangType
|
heroThangType = me.get('heroConfig')?.thangType or ThangType.heroes.captain
|
||||||
levelThang.thangType = heroThangType if heroThangType
|
levelThang.thangType = heroThangType if heroThangType
|
||||||
|
|
||||||
sortSystems: (levelSystems, systemModels) ->
|
sortSystems: (levelSystems, systemModels) ->
|
||||||
|
|
Loading…
Reference in a new issue