Show old difficulty instead of new difficulty when observing a replayable success. This will likely need revisiting when we are using observing for more than just leaderboards.
This commit is contained in:
parent
18202b6852
commit
46ef93190a
4 changed files with 10 additions and 2 deletions
app
|
@ -32,6 +32,7 @@ module.exports = class LevelLoader extends CocoClass
|
||||||
@team = options.team
|
@team = options.team
|
||||||
@headless = options.headless
|
@headless = options.headless
|
||||||
@spectateMode = options.spectateMode ? false
|
@spectateMode = options.spectateMode ? false
|
||||||
|
@observing = options.observing
|
||||||
|
|
||||||
@worldNecessities = []
|
@worldNecessities = []
|
||||||
@listenTo @supermodel, 'resource-loaded', @onWorldNecessityLoaded
|
@listenTo @supermodel, 'resource-loaded', @onWorldNecessityLoaded
|
||||||
|
@ -389,6 +390,8 @@ module.exports = class LevelLoader extends CocoClass
|
||||||
@world.submissionCount = @session?.get('state')?.submissionCount ? 0
|
@world.submissionCount = @session?.get('state')?.submissionCount ? 0
|
||||||
@world.flagHistory = @session?.get('state')?.flagHistory ? []
|
@world.flagHistory = @session?.get('state')?.flagHistory ? []
|
||||||
@world.difficulty = @session?.get('state')?.difficulty ? 0
|
@world.difficulty = @session?.get('state')?.difficulty ? 0
|
||||||
|
if @observing
|
||||||
|
@world.difficulty = Math.max 0, @world.difficulty - 1 # Show the difficulty they won, not the next one.
|
||||||
serializedLevel = @level.serialize(@supermodel, @session, @opponentSession)
|
serializedLevel = @level.serialize(@supermodel, @session, @opponentSession)
|
||||||
@world.loadFromLevel serializedLevel, false
|
@world.loadFromLevel serializedLevel, false
|
||||||
console.log 'World has been initialized from level loader.'
|
console.log 'World has been initialized from level loader.'
|
||||||
|
|
|
@ -64,6 +64,8 @@ module.exports = class ControlBarView extends CocoView
|
||||||
c.multiplayerStatus = @multiplayerStatusManager?.status
|
c.multiplayerStatus = @multiplayerStatusManager?.status
|
||||||
if @level.get 'replayable'
|
if @level.get 'replayable'
|
||||||
c.levelDifficulty = @session.get('state')?.difficulty ? 0
|
c.levelDifficulty = @session.get('state')?.difficulty ? 0
|
||||||
|
if @observing
|
||||||
|
c.levelDifficulty = Math.max 0, c.levelDifficulty - 1 # Show the difficulty they won, not the next one.
|
||||||
c.difficultyTitle = "#{$.i18n.t 'play.level_difficulty'}#{c.levelDifficulty}"
|
c.difficultyTitle = "#{$.i18n.t 'play.level_difficulty'}#{c.levelDifficulty}"
|
||||||
@lastDifficulty = c.levelDifficulty
|
@lastDifficulty = c.levelDifficulty
|
||||||
c.spectateGame = @spectateGame
|
c.spectateGame = @spectateGame
|
||||||
|
|
|
@ -127,7 +127,7 @@ module.exports = class PlayLevelView extends RootView
|
||||||
load: ->
|
load: ->
|
||||||
@loadStartTime = new Date()
|
@loadStartTime = new Date()
|
||||||
@god = new God debugWorker: true
|
@god = new God debugWorker: true
|
||||||
@levelLoader = new LevelLoader supermodel: @supermodel, levelID: @levelID, sessionID: @sessionID, opponentSessionID: @opponentSessionID, team: @getQueryVariable('team')
|
@levelLoader = new LevelLoader supermodel: @supermodel, levelID: @levelID, sessionID: @sessionID, opponentSessionID: @opponentSessionID, team: @getQueryVariable('team'), observing: @observing
|
||||||
@listenToOnce @levelLoader, 'world-necessities-loaded', @onWorldNecessitiesLoaded
|
@listenToOnce @levelLoader, 'world-necessities-loaded', @onWorldNecessitiesLoaded
|
||||||
|
|
||||||
trackLevelLoadEnd: ->
|
trackLevelLoadEnd: ->
|
||||||
|
|
|
@ -166,7 +166,10 @@ module.exports = class TomeView extends CocoView
|
||||||
sessionState.flagHistory = _.filter sessionState.flagHistory ? [], (event) => event.team isnt (@options.session.get('team') ? 'humans')
|
sessionState.flagHistory = _.filter sessionState.flagHistory ? [], (event) => event.team isnt (@options.session.get('team') ? 'humans')
|
||||||
sessionState.lastUnsuccessfulSubmissionTime = new Date() if @options.level.get 'replayable'
|
sessionState.lastUnsuccessfulSubmissionTime = new Date() if @options.level.get 'replayable'
|
||||||
@options.session.set 'state', sessionState
|
@options.session.set 'state', sessionState
|
||||||
Backbone.Mediator.publish 'tome:cast-spells', spells: @spells, preload: preload, realTime: realTime, submissionCount: sessionState.submissionCount ? 0, flagHistory: sessionState.flagHistory ? [], difficulty: sessionState.difficulty ? 0
|
difficulty = sessionState.difficulty ? 0
|
||||||
|
if @options.observing
|
||||||
|
difficulty = Math.max 0, difficulty - 1 # Show the difficulty they won, not the next one.
|
||||||
|
Backbone.Mediator.publish 'tome:cast-spells', spells: @spells, preload: preload, realTime: realTime, submissionCount: sessionState.submissionCount ? 0, flagHistory: sessionState.flagHistory ? [], difficulty: difficulty
|
||||||
|
|
||||||
onToggleSpellList: (e) ->
|
onToggleSpellList: (e) ->
|
||||||
@spellList.rerenderEntries()
|
@spellList.rerenderEntries()
|
||||||
|
|
Reference in a new issue