mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-07 02:25:29 -04:00
Merge branch 'master' into production
This commit is contained in:
commit
fd83fd5289
2 changed files with 9 additions and 1 deletions
app
Binary file not shown.
Before ![]() (image error) Size: 54 KiB After ![]() (image error) Size: 55 KiB ![]() ![]() |
|
@ -63,7 +63,9 @@ module.exports = class GoalManager extends CocoClass
|
|||
# gets these goals and code, and is told to be all ears during world gen
|
||||
setGoals: (@goals) ->
|
||||
setCode: (@userCodeMap) -> @updateCodeGoalStates()
|
||||
worldGenerationWillBegin: -> @initGoalStates()
|
||||
worldGenerationWillBegin: ->
|
||||
@initGoalStates()
|
||||
@checkForInitialUserCodeProblems()
|
||||
|
||||
# World generator feeds world events to the goal manager to keep track
|
||||
submitWorldGenerationEvent: (channel, event, frameNumber) ->
|
||||
|
@ -148,6 +150,12 @@ module.exports = class GoalManager extends CocoClass
|
|||
@initGoalState(state, [_.keys(goal.linesOfCode ? {})], 'lines')
|
||||
@goalStates[goal.id] = state
|
||||
|
||||
checkForInitialUserCodeProblems: ->
|
||||
# There might have been some user code problems reported before the goal manager started listening.
|
||||
for thang in @world.thangs when thang.isProgrammable
|
||||
for message, problem of thang.publishedUserCodeProblems
|
||||
@onUserCodeProblem {thang: thang, problem: problem}, 0
|
||||
|
||||
onThangDied: (e, frameNumber) ->
|
||||
for goal in @goals ? []
|
||||
@checkKillThangs(goal.id, goal.killThangs, e.thang, frameNumber) if goal.killThangs?
|
||||
|
|
Loading…
Add table
Reference in a new issue