Set up the goal manager to only use goals from the level.goals property, rather than from scripts.

This commit is contained in:
Scott Erickson 2014-02-13 09:26:42 -08:00
parent adaedc240c
commit 23964abee9
2 changed files with 2 additions and 14 deletions

View file

@ -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

View file

@ -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)