mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-03 09:23:41 -04:00
Fixed checking compile-time problems for clean code goals.
This commit is contained in:
parent
39166b77c3
commit
a33bb215d4
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
|
# gets these goals and code, and is told to be all ears during world gen
|
||||||
setGoals: (@goals) ->
|
setGoals: (@goals) ->
|
||||||
setCode: (@userCodeMap) -> @updateCodeGoalStates()
|
setCode: (@userCodeMap) -> @updateCodeGoalStates()
|
||||||
worldGenerationWillBegin: -> @initGoalStates()
|
worldGenerationWillBegin: ->
|
||||||
|
@initGoalStates()
|
||||||
|
@checkForInitialUserCodeProblems()
|
||||||
|
|
||||||
# World generator feeds world events to the goal manager to keep track
|
# World generator feeds world events to the goal manager to keep track
|
||||||
submitWorldGenerationEvent: (channel, event, frameNumber) ->
|
submitWorldGenerationEvent: (channel, event, frameNumber) ->
|
||||||
|
@ -148,6 +150,12 @@ module.exports = class GoalManager extends CocoClass
|
||||||
@initGoalState(state, [_.keys(goal.linesOfCode ? {})], 'lines')
|
@initGoalState(state, [_.keys(goal.linesOfCode ? {})], 'lines')
|
||||||
@goalStates[goal.id] = state
|
@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) ->
|
onThangDied: (e, frameNumber) ->
|
||||||
for goal in @goals ? []
|
for goal in @goals ? []
|
||||||
@checkKillThangs(goal.id, goal.killThangs, e.thang, frameNumber) if goal.killThangs?
|
@checkKillThangs(goal.id, goal.killThangs, e.thang, frameNumber) if goal.killThangs?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue