mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-01 07:40:22 -04:00
Set up the goal manager to only use goals from the level.goals property, rather than from scripts.
This commit is contained in:
parent
adaedc240c
commit
23964abee9
2 changed files with 2 additions and 14 deletions
app
|
@ -35,8 +35,6 @@ module.exports = class GoalManager extends CocoClass
|
|||
@thangTeams[thang.team].push(thang.id)
|
||||
|
||||
subscriptions:
|
||||
'level-add-goals': 'onAddGoals'
|
||||
'level-remove-goals': 'onRemoveGoals'
|
||||
'god:new-world-created': 'onNewWorldCreated'
|
||||
'level:restarted': 'onLevelRestarted'
|
||||
|
||||
|
@ -52,20 +50,10 @@ module.exports = class GoalManager extends CocoClass
|
|||
@goalStates = {}
|
||||
@userCodeMap = {}
|
||||
@notifyGoalChanges()
|
||||
@addGoal goal for goal in @initialGoals if @initialGoals
|
||||
|
||||
# INTERFACE AND LIFETIME OVERVIEW
|
||||
|
||||
# main instance receives goal updates from the script manager
|
||||
onAddGoals: (e) ->
|
||||
return unless e.worldName is @world.name
|
||||
goals = e.goals
|
||||
@addGoal(goal) for goal in goals
|
||||
|
||||
onRemoveGoals: (e) ->
|
||||
if e.goal in @goals
|
||||
@goals.remove(e.goal)
|
||||
delete @goalStates[e.goal]
|
||||
|
||||
# world generator gets current goals from the main instance
|
||||
getGoals: -> @goals
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ module.exports = class PlayLevelView extends View
|
|||
|
||||
onShowVictory: (e) ->
|
||||
console.log 'show vict', e
|
||||
$('#level-done-button').show()
|
||||
$('#level-done-button').removeClass('hide')
|
||||
@showVictory() if e.showModal
|
||||
setTimeout(@preloadNextLevel, 3000)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue