Set up the goal manager to use goals from the new level goals property, rather than from scripts. Backward-compatible for now.

This commit is contained in:
Scott Erickson 2014-02-12 16:20:25 -08:00
parent f3489a6c2f
commit 8176e2258f
3 changed files with 4 additions and 3 deletions
app
assets/javascripts/workers
lib/world
views/play

View file

@ -64,7 +64,7 @@ self.transferableSupported = transferableSupported = ->
if args.level
self.world.loadFromLevel args.level, true
self.goalManager = new GoalManager self.world
self.goalManager.setGoals args.goals
self.goalManager.setGoals args.level?.goals or args.goals
self.goalManager.setCode args.userCodeMap
self.goalManager.worldGenerationWillBegin()
self.world.setGoalManager self.goalManager

View file

@ -15,7 +15,7 @@ module.exports = class GoalManager extends CocoClass
nextGoalID: 0
constructor: (@world) ->
constructor: (@world, @initialGoals) ->
super()
@init()
@ -25,6 +25,7 @@ module.exports = class GoalManager extends CocoClass
@userCodeMap = {} # @userCodeMap.thangID.methodName.aether.raw = codeString
@thangTeams = {}
@initThangTeams()
@addGoal goal for goal in @initialGoals if @initialGoals
initThangTeams: ->
return unless @world

View file

@ -327,7 +327,7 @@ module.exports = class PlayLevelView extends View
@surface.camera.zoomTo({x:0, y:0}, 0.1, 0)
initGoalManager: ->
@goalManager = new GoalManager(@world)
@goalManager = new GoalManager(@world, @level.get('goals'))
@god.goalManager = @goalManager
initScriptManager: ->