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
|
||||
@consolidateFlagHistory() if @session.loaded
|
||||
if @level.get('type', true) in ['course'] # course-ladder is hard to handle because there's 2 sessions
|
||||
heroConfig = me.get('heroConfig')
|
||||
console.log "Course mode, loading custom hero: ", heroConfig if LOG
|
||||
return if not heroConfig
|
||||
url = "/db/thang.type/#{heroConfig.thangType}/version"
|
||||
heroThangType = me.get('heroConfig')?.thangType or ThangType.heroes.captain
|
||||
console.log "Course mode, loading custom hero: ", heroThangType if LOG
|
||||
url = "/db/thang.type/#{heroThangType}/version"
|
||||
if heroResource = @maybeLoadURL(url, ThangType, 'thang')
|
||||
console.log "Pushing resource: ", heroResource if LOG
|
||||
@worldNecessities.push heroResource
|
||||
|
|
|
@ -166,7 +166,7 @@ module.exports = class World
|
|||
shouldUpdateProgress = @shouldUpdateRealTimePlayback t2
|
||||
shouldDelayRealTimeSimulation = not shouldUpdateProgress and @shouldDelayRealTimeSimulation t2
|
||||
else
|
||||
shouldUpdateProgress = t2 - t1 > PROGRESS_UPDATE_INTERVAL
|
||||
shouldUpdateProgress = t2 - t1 > PROGRESS_UPDATE_INTERVAL# and (@frames.length - @framesSerializedSoFar >= @frameRate or t2 - t1 > 1000)
|
||||
shouldDelayRealTimeSimulation = false
|
||||
return true unless shouldUpdateProgress or shouldDelayRealTimeSimulation
|
||||
# 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
|
||||
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
|
||||
|
||||
sortSystems: (levelSystems, systemModels) ->
|
||||
|
|
Loading…
Reference in a new issue