codecombat/app/lib/scripts/GoalsScriptModule.coffee
2014-01-03 10:32:13 -08:00

35 lines
No EOL
727 B
CoffeeScript

ScriptModule = require './ScriptModule'
module.exports = class GoalsScriptModule extends ScriptModule
@neededFor: (noteGroup) ->
return noteGroup.goals?
startNotes: ->
notes = []
notes.push(@addNote()) if @noteGroup.goals.add?
notes.push(@removeNote()) if @noteGroup.goals.remove?
return notes
endNotes: ->
return []
skipNotes: ->
return @startNotes()
addNote: ->
note =
channel: 'level-add-goals'
event:
goals: @noteGroup.goals.add
worldName: @view.world.name
return note
removeNote: ->
note =
channel: 'level-remove-goals'
event:
goals: @noteGroup.goals.remove
worldName: @view.world.name
return note