Goal states (for the purpose of triggering achievements) are now only saved as having succeeded when the overall level is succeeded.

This commit is contained in:
Scott Erickson 2014-11-18 14:05:55 -08:00
parent 1889c771f2
commit 5ee1289621

View file

@ -211,10 +211,12 @@ module.exports = class LevelBus extends Bus
@changedSessionProperties.state = true
@reallySaveSession() # Make sure it saves right away; don't debounce it.
onNewGoalStates: ({goalStates}) ->
onNewGoalStates: (e) ->
# TODO: this log doesn't capture when null-status goals are being set during world streaming. Where can they be coming from?
goalStates = e.goalStates
return console.error("Somehow trying to save null goal states!", newGoalStates) if _.find(newGoalStates, (gs) -> not gs.status)
return unless e.overallStatus is 'success'
newGoalStates = goalStates
state = @session.get('state')
oldGoalStates = state.goalStates or {}