mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-01 15:50:11 -04:00
Don't uncomplete levels by resetting them.
This commit is contained in:
parent
00b8a62bfb
commit
2e413700dd
1 changed files with 3 additions and 3 deletions
|
@ -173,7 +173,7 @@ module.exports = class LevelBus extends Bus
|
|||
@fireScriptsRef?.set({})
|
||||
state = @session.get('state')
|
||||
state.scripts = {}
|
||||
state.complete = false
|
||||
#state.complete = false # Keep it complete once ever completed.
|
||||
@session.set('state', state)
|
||||
@changedSessionProperties.state = true
|
||||
@saveSession()
|
||||
|
@ -217,14 +217,14 @@ module.exports = class LevelBus extends Bus
|
|||
newGoalStates = goalStates
|
||||
state = @session.get('state')
|
||||
oldGoalStates = state.goalStates or {}
|
||||
|
||||
|
||||
changed = false
|
||||
for goalKey, goalState of newGoalStates
|
||||
continue if oldGoalStates[goalKey]?.status is 'success' and goalState.status isnt 'success' # don't undo success, this property is for keying off achievements
|
||||
continue if utils.kindaEqual state.goalStates?[goalKey], goalState # Only save when goals really change
|
||||
changed = true
|
||||
oldGoalStates[goalKey] = _.cloneDeep newGoalStates[goalKey]
|
||||
|
||||
|
||||
if changed
|
||||
state.goalStates = oldGoalStates
|
||||
@session.set 'state', state
|
||||
|
|
Loading…
Add table
Reference in a new issue