2014-11-28 20:49:41 -05:00
|
|
|
CocoClass = require 'core/CocoClass'
|
|
|
|
utils = require 'core/utils'
|
2014-03-11 19:57:30 -04:00
|
|
|
|
2014-01-03 13:32:13 -05:00
|
|
|
module.exports = class GoalManager extends CocoClass
|
|
|
|
# The Goal Manager is created both on the main thread and
|
|
|
|
# each time the world is generated. The one in world generation
|
|
|
|
# records which code and world related goals
|
|
|
|
# are completed or failed, and then the results are sent back
|
|
|
|
# and saved to the main thread instance.
|
|
|
|
# The main instance handles goals based on UI notifications,
|
|
|
|
# and keeps track of what the goals are at any given point.
|
|
|
|
|
|
|
|
# Goals can only have only one goal property. Otherwise who knows what will happen.
|
|
|
|
# If you want weird goals or hybrid goals, make a custom goal.
|
|
|
|
|
|
|
|
nextGoalID: 0
|
2014-06-30 22:16:26 -04:00
|
|
|
nicks: ['GoalManager']
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-05-19 23:50:05 -04:00
|
|
|
constructor: (@world, @initialGoals, @team) ->
|
2014-01-03 13:32:13 -05:00
|
|
|
super()
|
|
|
|
@init()
|
|
|
|
|
|
|
|
init: ->
|
|
|
|
@goals = []
|
|
|
|
@goalStates = {} # goalID -> object (complete, frameCompleted)
|
|
|
|
@userCodeMap = {} # @userCodeMap.thangID.methodName.aether.raw = codeString
|
|
|
|
@thangTeams = {}
|
|
|
|
@initThangTeams()
|
2014-02-12 19:20:25 -05:00
|
|
|
@addGoal goal for goal in @initialGoals if @initialGoals
|
2014-01-03 13:32:13 -05:00
|
|
|
|
|
|
|
initThangTeams: ->
|
|
|
|
return unless @world
|
|
|
|
for thang in @world.thangs when thang.team and thang.isAttackable
|
|
|
|
continue unless thang.team
|
|
|
|
@thangTeams[thang.team] = [] unless @thangTeams[thang.team]
|
|
|
|
@thangTeams[thang.team].push(thang.id)
|
|
|
|
|
|
|
|
subscriptions:
|
|
|
|
'god:new-world-created': 'onNewWorldCreated'
|
|
|
|
'level:restarted': 'onLevelRestarted'
|
|
|
|
|
|
|
|
backgroundSubscriptions:
|
|
|
|
'world:thang-died': 'onThangDied'
|
|
|
|
'world:thang-touched-goal': 'onThangTouchedGoal'
|
|
|
|
'world:thang-left-map': 'onThangLeftMap'
|
|
|
|
'world:thang-collected-item': 'onThangCollectedItem'
|
2014-10-20 12:41:28 -04:00
|
|
|
'world:user-code-problem': 'onUserCodeProblem'
|
2014-10-20 16:57:32 -04:00
|
|
|
'world:lines-of-code-counted': 'onLinesOfCodeCounted'
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-02-11 15:32:12 -05:00
|
|
|
onLevelRestarted: ->
|
2014-01-03 13:32:13 -05:00
|
|
|
@goals = []
|
|
|
|
@goalStates = {}
|
|
|
|
@userCodeMap = {}
|
|
|
|
@notifyGoalChanges()
|
2014-02-13 12:26:42 -05:00
|
|
|
@addGoal goal for goal in @initialGoals if @initialGoals
|
2014-01-03 13:32:13 -05:00
|
|
|
|
|
|
|
# INTERFACE AND LIFETIME OVERVIEW
|
|
|
|
|
|
|
|
# world generator gets current goals from the main instance
|
|
|
|
getGoals: -> @goals
|
|
|
|
|
|
|
|
# background instance created by world generator,
|
|
|
|
# gets these goals and code, and is told to be all ears during world gen
|
|
|
|
setGoals: (@goals) ->
|
|
|
|
setCode: (@userCodeMap) -> @updateCodeGoalStates()
|
2014-10-20 20:49:52 -04:00
|
|
|
worldGenerationWillBegin: ->
|
|
|
|
@initGoalStates()
|
|
|
|
@checkForInitialUserCodeProblems()
|
2014-01-03 13:32:13 -05:00
|
|
|
|
|
|
|
# World generator feeds world events to the goal manager to keep track
|
|
|
|
submitWorldGenerationEvent: (channel, event, frameNumber) ->
|
|
|
|
func = @backgroundSubscriptions[channel]
|
|
|
|
func = utils.normalizeFunc(func, @)
|
|
|
|
return unless func
|
2014-02-11 15:54:08 -05:00
|
|
|
func.call(@, event, frameNumber)
|
2014-01-03 13:32:13 -05:00
|
|
|
|
|
|
|
# after world generation, generated goal states
|
|
|
|
# are grabbed to send back to main instance
|
|
|
|
worldGenerationEnded: (finalFrame) -> @wrapUpGoalStates(finalFrame)
|
|
|
|
getGoalStates: -> @goalStates
|
|
|
|
|
|
|
|
# main instance gets them and updates their existing goal states,
|
|
|
|
# passes the word along
|
2014-02-11 15:32:12 -05:00
|
|
|
onNewWorldCreated: (e) ->
|
2014-02-06 17:00:27 -05:00
|
|
|
@world = e.world
|
2014-05-19 23:10:51 -04:00
|
|
|
@updateGoalStates(e.goalStates) if e.goalStates?
|
2014-01-03 13:32:13 -05:00
|
|
|
|
|
|
|
updateGoalStates: (newGoalStates) ->
|
|
|
|
for goalID, goalState of newGoalStates
|
|
|
|
continue unless @goalStates[goalID]?
|
|
|
|
@goalStates[goalID] = goalState
|
|
|
|
@notifyGoalChanges()
|
|
|
|
|
|
|
|
# IMPLEMENTATION DETAILS
|
|
|
|
|
|
|
|
addGoal: (goal) ->
|
2014-03-18 16:08:26 -04:00
|
|
|
goal = $.extend(true, {}, goal)
|
2014-01-03 13:32:13 -05:00
|
|
|
goal.id = @nextGoalID++ if not goal.id
|
|
|
|
return if @goalStates[goal.id]?
|
|
|
|
@goals.push(goal)
|
|
|
|
goal.isPositive = @goalIsPositive goal.id
|
2014-04-08 17:58:34 -04:00
|
|
|
@goalStates[goal.id] = {status: 'incomplete', keyFrame: 0, team: goal.team}
|
2014-01-03 13:32:13 -05:00
|
|
|
@notifyGoalChanges()
|
|
|
|
return unless goal.notificationGoal
|
|
|
|
f = (channel) => (event) => @onNote(channel, event)
|
|
|
|
channel = goal.notificationGoal.channel
|
|
|
|
@addNewSubscription(channel, f(channel))
|
|
|
|
|
|
|
|
notifyGoalChanges: ->
|
|
|
|
overallStatus = @checkOverallStatus()
|
2014-05-19 19:34:39 -04:00
|
|
|
event =
|
|
|
|
goalStates: @goalStates
|
|
|
|
goals: @goals
|
|
|
|
overallStatus: overallStatus
|
|
|
|
timedOut: @world.totalFrames is @world.maxTotalFrames
|
2014-01-03 13:32:13 -05:00
|
|
|
Backbone.Mediator.publish('goal-manager:new-goal-states', event)
|
|
|
|
|
|
|
|
checkOverallStatus: (ignoreIncomplete=false) ->
|
|
|
|
overallStatus = null
|
2014-05-19 23:50:05 -04:00
|
|
|
goals = if @goalStates then _.values @goalStates else []
|
2014-10-20 16:57:32 -04:00
|
|
|
goals = (g for g in goals when not g.optional)
|
2014-05-19 23:50:05 -04:00
|
|
|
goals = (g for g in goals when g.team in [undefined, @team]) if @team
|
|
|
|
statuses = if @goalStates then (goal.status for goal in goals) else []
|
2014-01-03 13:32:13 -05:00
|
|
|
overallStatus = 'success' if statuses.length > 0 and _.every(statuses, (s) -> s is 'success' or (ignoreIncomplete and s is null))
|
|
|
|
overallStatus = 'failure' if statuses.length > 0 and 'failure' in statuses
|
2014-10-20 16:57:32 -04:00
|
|
|
#console.log 'got overallStatus', overallStatus, 'from goals', goals, 'goalStates', @goalStates, 'statuses', statuses
|
2014-01-03 13:32:13 -05:00
|
|
|
overallStatus
|
|
|
|
|
|
|
|
# WORLD GOAL TRACKING
|
|
|
|
|
|
|
|
initGoalStates: ->
|
|
|
|
@goalStates = {}
|
|
|
|
return unless @goals
|
|
|
|
for goal in @goals
|
|
|
|
state = {
|
|
|
|
status: null # should eventually be either 'success', 'failure', or 'incomplete'
|
|
|
|
keyFrame: 0 # when it became a 'success' or 'failure'
|
2014-04-08 17:58:34 -04:00
|
|
|
team: goal.team
|
2014-10-20 16:57:32 -04:00
|
|
|
optional: goal.optional
|
2014-01-03 13:32:13 -05:00
|
|
|
}
|
|
|
|
@initGoalState(state, [goal.killThangs, goal.saveThangs], 'killed')
|
2014-03-30 20:24:07 -04:00
|
|
|
for getTo in goal.getAllToLocations ? []
|
2014-06-30 22:16:26 -04:00
|
|
|
@initGoalState(state, [getTo.getToLocation?.who, []], 'arrived')
|
2014-03-30 20:24:07 -04:00
|
|
|
for keepFrom in goal.keepAllFromLocations ? []
|
2014-06-30 22:16:26 -04:00
|
|
|
@initGoalState(state, [[], keepFrom.keepFromLocation?.who], 'arrived')
|
2014-01-03 13:32:13 -05:00
|
|
|
@initGoalState(state, [goal.getToLocations?.who, goal.keepFromLocations?.who], 'arrived')
|
|
|
|
@initGoalState(state, [goal.leaveOffSides?.who, goal.keepFromLeavingOffSides?.who], 'left')
|
2014-09-15 20:01:34 -04:00
|
|
|
@initGoalState(state, [goal.collectThangs?.targets, goal.keepFromCollectingThangs?.targets], 'collected')
|
2014-10-20 17:43:18 -04:00
|
|
|
@initGoalState(state, [goal.codeProblems], 'problems')
|
|
|
|
@initGoalState(state, [_.keys(goal.linesOfCode ? {})], 'lines')
|
2014-01-03 13:32:13 -05:00
|
|
|
@goalStates[goal.id] = state
|
|
|
|
|
2014-10-20 20:49:52 -04:00
|
|
|
checkForInitialUserCodeProblems: ->
|
|
|
|
# There might have been some user code problems reported before the goal manager started listening.
|
2014-10-21 14:54:03 -04:00
|
|
|
return unless @world
|
2014-10-20 20:49:52 -04:00
|
|
|
for thang in @world.thangs when thang.isProgrammable
|
|
|
|
for message, problem of thang.publishedUserCodeProblems
|
|
|
|
@onUserCodeProblem {thang: thang, problem: problem}, 0
|
|
|
|
|
2014-02-11 15:54:08 -05:00
|
|
|
onThangDied: (e, frameNumber) ->
|
2014-01-03 13:32:13 -05:00
|
|
|
for goal in @goals ? []
|
|
|
|
@checkKillThangs(goal.id, goal.killThangs, e.thang, frameNumber) if goal.killThangs?
|
|
|
|
@checkKillThangs(goal.id, goal.saveThangs, e.thang, frameNumber) if goal.saveThangs?
|
|
|
|
|
2014-02-11 15:54:08 -05:00
|
|
|
checkKillThangs: (goalID, targets, thang, frameNumber) ->
|
2014-01-03 13:32:13 -05:00
|
|
|
return unless thang.id in targets or thang.team in targets
|
|
|
|
@updateGoalState(goalID, thang.id, 'killed', frameNumber)
|
|
|
|
|
2014-02-11 15:54:08 -05:00
|
|
|
onThangTouchedGoal: (e, frameNumber) ->
|
2014-01-03 13:32:13 -05:00
|
|
|
for goal in @goals ? []
|
2014-02-20 14:43:35 -05:00
|
|
|
@checkArrived(goal.id, goal.getToLocations.who, goal.getToLocations.targets, e.actor, e.touched.id, frameNumber) if goal.getToLocations?
|
2014-03-30 20:24:07 -04:00
|
|
|
if goal.getAllToLocations?
|
2014-03-11 19:57:30 -04:00
|
|
|
for getTo in goal.getAllToLocations
|
|
|
|
@checkArrived(goal.id, getTo.getToLocation.who, getTo.getToLocation.targets, e.actor, e.touched.id, frameNumber)
|
2014-02-20 14:43:35 -05:00
|
|
|
@checkArrived(goal.id, goal.keepFromLocations.who, goal.keepFromLocations.targets, e.actor, e.touched.id, frameNumber) if goal.keepFromLocations?
|
2014-03-30 20:24:07 -04:00
|
|
|
if goal.keepAllFromLocations?
|
2014-03-11 19:57:30 -04:00
|
|
|
for keepFrom in goal.keepAllFromLocations
|
|
|
|
@checkArrived(goal.id, keepFrom.keepFromLocation.who , keepFrom.keepFromLocation.targets, e.actor, e.touched.id, frameNumber )
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-02-20 14:43:35 -05:00
|
|
|
checkArrived: (goalID, who, targets, thang, touchedID, frameNumber) ->
|
2014-01-03 13:32:13 -05:00
|
|
|
return unless touchedID in targets
|
2014-02-20 14:43:35 -05:00
|
|
|
return unless thang.id in who or thang.team in who
|
|
|
|
@updateGoalState(goalID, thang.id, 'arrived', frameNumber)
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-02-11 15:54:08 -05:00
|
|
|
onThangLeftMap: (e, frameNumber) ->
|
2014-01-03 13:32:13 -05:00
|
|
|
for goal in @goals ? []
|
2014-09-15 19:49:08 -04:00
|
|
|
@checkLeft(goal.id, goal.leaveOffSides.who, goal.leaveOffSides.sides, e.thang, e.side, frameNumber) if goal.leaveOffSides?
|
|
|
|
@checkLeft(goal.id, goal.keepFromLeavingOffSides.who, goal.keepFromLeavingOffSides.sides, e.thang, e.side, frameNumber) if goal.keepFromLeavingOffSides?
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-09-15 19:49:08 -04:00
|
|
|
checkLeft: (goalID, who, sides, thang, side, frameNumber) ->
|
2014-01-03 13:32:13 -05:00
|
|
|
return if sides and side and not (side in sides)
|
2014-09-15 19:49:08 -04:00
|
|
|
return unless thang.id in who or thang.team in who
|
|
|
|
@updateGoalState(goalID, thang.id, 'left', frameNumber)
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-02-11 15:54:08 -05:00
|
|
|
onThangCollectedItem: (e, frameNumber) ->
|
2014-01-03 13:32:13 -05:00
|
|
|
for goal in @goals ? []
|
2014-09-15 19:49:08 -04:00
|
|
|
@checkCollected(goal.id, goal.collectThangs.who, goal.collectThangs.targets, e.actor, e.item.id, frameNumber) if goal.collectThangs?
|
|
|
|
@checkCollected(goal.id, goal.keepFromCollectingThangs.who, goal.keepFromCollectingThangs.targets, e.actor, e.item.id, frameNumber) if goal.keepFromCollectingThangs?
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-09-15 19:49:08 -04:00
|
|
|
checkCollected: (goalID, who, targets, thang, itemID, frameNumber) ->
|
2014-01-03 13:32:13 -05:00
|
|
|
return unless itemID in targets
|
2014-09-15 19:49:08 -04:00
|
|
|
return unless thang.id in who or thang.team in who
|
2014-09-15 20:01:34 -04:00
|
|
|
@updateGoalState(goalID, itemID, 'collected', frameNumber)
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-10-20 12:41:28 -04:00
|
|
|
onUserCodeProblem: (e, frameNumber) ->
|
|
|
|
for goal in @goals ? [] when goal.codeProblems
|
2014-10-20 16:57:32 -04:00
|
|
|
@checkCodeProblem goal.id, goal.codeProblems, e.thang, frameNumber
|
2014-10-20 12:41:28 -04:00
|
|
|
|
|
|
|
checkCodeProblem: (goalID, who, thang, frameNumber) ->
|
|
|
|
return unless thang.id in who or thang.team in who
|
2014-10-20 16:57:32 -04:00
|
|
|
@updateGoalState goalID, thang.id, 'problems', frameNumber
|
|
|
|
|
|
|
|
onLinesOfCodeCounted: (e, frameNumber) ->
|
|
|
|
for goal in @goals ? [] when goal.linesOfCode
|
|
|
|
@checkLinesOfCode goal.id, goal.linesOfCode, e.thang, e.linesUsed, frameNumber
|
|
|
|
|
|
|
|
checkLinesOfCode: (goalID, who, thang, linesUsed, frameNumber) ->
|
2014-10-20 17:43:18 -04:00
|
|
|
return unless linesAllowed = who[thang.id] ? who[thang.team]
|
|
|
|
@updateGoalState goalID, thang.id, 'lines', frameNumber if linesUsed > linesAllowed
|
2014-10-20 12:41:28 -04:00
|
|
|
|
2014-01-03 13:32:13 -05:00
|
|
|
wrapUpGoalStates: (finalFrame) ->
|
|
|
|
for goalID, state of @goalStates
|
|
|
|
if state.status is null
|
|
|
|
if @goalIsPositive(goalID)
|
|
|
|
state.status = 'incomplete'
|
|
|
|
else
|
|
|
|
state.status = 'success'
|
|
|
|
state.keyFrame = 'end' # special case for objective UI to handle
|
|
|
|
|
|
|
|
# UI EVENT GOAL TRACKING
|
|
|
|
|
|
|
|
onNote: (channel, e) ->
|
|
|
|
# TODO for UI event related goals
|
|
|
|
|
|
|
|
# HELPER FUNCTIONS
|
|
|
|
|
|
|
|
# It's a pretty similar pattern for each of the above goals.
|
|
|
|
# Once you determine a thang has done the thing, you mark it done in the progress object.
|
|
|
|
initGoalState: (state, whos, progressObjectName) ->
|
|
|
|
# 'whos' is an array of goal 'who' values.
|
|
|
|
# This inits the progress object for the goal tracking.
|
2014-03-30 20:24:07 -04:00
|
|
|
|
2014-01-03 13:32:13 -05:00
|
|
|
arrays = (prop for prop in whos when prop?.length)
|
|
|
|
return unless arrays.length
|
2014-05-06 10:22:09 -04:00
|
|
|
state[progressObjectName] ?= {}
|
2014-01-03 13:32:13 -05:00
|
|
|
for array in arrays
|
|
|
|
for thang in array
|
|
|
|
if @thangTeams[thang]?
|
|
|
|
for t in @thangTeams[thang]
|
|
|
|
state[progressObjectName][t] = false
|
|
|
|
else
|
|
|
|
state[progressObjectName][thang] = false
|
|
|
|
|
2014-05-13 13:41:39 -04:00
|
|
|
getGoalState: (goalID) ->
|
|
|
|
@goalStates[goalID].status
|
|
|
|
|
2014-03-28 21:52:02 -04:00
|
|
|
setGoalState: (goalID, status) ->
|
|
|
|
state = @goalStates[goalID]
|
|
|
|
state.status = status
|
|
|
|
if overallStatus = @checkOverallStatus true
|
|
|
|
matchedGoals = (_.find(@goals, {id: goalID}) for goalID, goalState of @goalStates when goalState.status is overallStatus)
|
|
|
|
mostEagerGoal = _.min matchedGoals, 'worldEndsAfter'
|
2014-06-30 22:16:26 -04:00
|
|
|
victory = overallStatus is 'success'
|
|
|
|
tentative = overallStatus is 'success'
|
2014-03-28 21:52:02 -04:00
|
|
|
@world.endWorld victory, mostEagerGoal.worldEndsAfter, tentative if mostEagerGoal isnt Infinity
|
2014-03-30 20:24:07 -04:00
|
|
|
|
2014-01-03 13:32:13 -05:00
|
|
|
updateGoalState: (goalID, thangID, progressObjectName, frameNumber) ->
|
|
|
|
# A thang has done something related to the goal!
|
|
|
|
# Mark it down and update the goal state.
|
|
|
|
goal = _.find @goals, {id: goalID}
|
|
|
|
state = @goalStates[goalID]
|
|
|
|
stateThangs = state[progressObjectName]
|
|
|
|
stateThangs[thangID] = true
|
|
|
|
success = @goalIsPositive goalID
|
|
|
|
if success
|
2014-02-20 14:43:35 -05:00
|
|
|
numNeeded = goal.howMany ? Math.max(1, _.size stateThangs)
|
2014-01-03 13:32:13 -05:00
|
|
|
else
|
2014-06-30 22:16:26 -04:00
|
|
|
# saveThangs: by default we would want to save all the Thangs, which means that we would want none of them to be 'done'
|
Update GoalManager.coffee
Justification:
For a negative goal like saveThangs, let's say you have 5 thangs on the save list. As things stand, if you don't have a HowMany defined, then the number of needed deaths to fail is
numNeeded = _.size(stateThangs) - Math.min((goal.howMany ? 1), _.size stateThangs) + 1
numNeeded = 5 - Math.min(1, 5) + 1
numNeeded = 5
So you would only fail the goal if all 5 thangs you were supposed to save died. This is contrary to the comment right above this line:
# saveThangs: by default we would want to save all the Thangs, which means that we would want none of them to be "done"
Therefore, I think it should be Math.max rather than Math.min.
numNeeded = _.size(stateThangs) - Math.max((goal.howMany ? 1), _.size stateThangs) + 1
numNeeded = 5 - Math.max(1, 5) + 1
numNeeded = 1
So any of the Thangs on the save list dying is enough to fail the goal.
As a double check, what if the level designer designated a HowMany of 5?
numNeeded = _.size(stateThangs) - Math.max((goal.howMany ? 1), _.size stateThangs) + 1
numNeeded = 5 - Math.max(5, 5) + 1
numNeeded = 1
So this is consistent.
2014-05-05 15:08:41 -04:00
|
|
|
numNeeded = _.size(stateThangs) - Math.max((goal.howMany ? 1), _.size stateThangs) + 1
|
2014-01-03 13:32:13 -05:00
|
|
|
numDone = _.filter(stateThangs).length
|
2014-10-20 17:43:18 -04:00
|
|
|
#console.log 'needed', numNeeded, 'done', numDone, 'of total', _.size(stateThangs), 'with how many', goal.howMany, 'and stateThangs', stateThangs, 'for', goalID, thangID, 'on frame', frameNumber
|
2014-01-03 13:32:13 -05:00
|
|
|
return unless numDone >= numNeeded
|
|
|
|
return if state.status and not success # already failed it; don't wipe keyframe
|
2014-06-30 22:16:26 -04:00
|
|
|
state.status = if success then 'success' else 'failure'
|
2014-01-03 13:32:13 -05:00
|
|
|
state.keyFrame = frameNumber
|
2014-10-20 17:43:18 -04:00
|
|
|
#console.log goalID, 'became', success, 'on frame', frameNumber, 'with overallStatus', @checkOverallStatus true
|
2014-01-03 13:32:13 -05:00
|
|
|
if overallStatus = @checkOverallStatus true
|
|
|
|
matchedGoals = (_.find(@goals, {id: goalID}) for goalID, goalState of @goalStates when goalState.status is overallStatus)
|
|
|
|
mostEagerGoal = _.min matchedGoals, 'worldEndsAfter'
|
2014-06-30 22:16:26 -04:00
|
|
|
victory = overallStatus is 'success'
|
|
|
|
tentative = overallStatus is 'success'
|
2014-01-03 13:32:13 -05:00
|
|
|
@world.endWorld victory, mostEagerGoal.worldEndsAfter, tentative if mostEagerGoal isnt Infinity
|
|
|
|
|
|
|
|
goalIsPositive: (goalID) ->
|
|
|
|
# Positive goals are completed when all conditions are true (kill all these thangs)
|
|
|
|
# Negative goals fail when any are true (keep all these thangs from being killed)
|
|
|
|
goal = _.find(@goals, {id: goalID}) ? {}
|
|
|
|
return false for prop of goal when @positiveGoalMap[prop] is 0
|
|
|
|
true
|
|
|
|
|
|
|
|
positiveGoalMap:
|
|
|
|
killThangs: 1
|
|
|
|
saveThangs: 0
|
|
|
|
getToLocations: 1
|
2014-03-11 19:57:30 -04:00
|
|
|
getAllToLocations: 1
|
2014-01-03 13:32:13 -05:00
|
|
|
keepFromLocations: 0
|
2014-03-11 19:57:30 -04:00
|
|
|
keepAllFromLocations: 0
|
2014-01-03 13:32:13 -05:00
|
|
|
leaveOffSides: 1
|
|
|
|
keepFromLeavingOffSides: 0
|
|
|
|
collectThangs: 1
|
|
|
|
keepFromCollectingThangs: 0
|
2014-10-20 12:41:28 -04:00
|
|
|
linesOfCode: 0
|
|
|
|
codeProblems: 0
|
2014-01-03 13:32:13 -05:00
|
|
|
|
|
|
|
updateCodeGoalStates: ->
|
|
|
|
# TODO
|
|
|
|
|
|
|
|
# teardown
|
|
|
|
|
|
|
|
destroy: ->
|
|
|
|
super()
|