This commit is contained in:
Scott Erickson 2014-02-25 10:50:53 -08:00
commit f4084ba5cc
5 changed files with 9 additions and 13 deletions

View file

@ -87,6 +87,9 @@ module.exports = class LevelBus extends Bus
# LevelSession object. Either break this off into a separate class # LevelSession object. Either break this off into a separate class
# or have the LevelSession object listen for all these events itself. # or have the LevelSession object listen for all these events itself.
setSpells: (spells) ->
@onSpellCreated spell: spell for spellKey, spell of spells
onSpellChanged: (e) -> onSpellChanged: (e) ->
return unless @onPoint() return unless @onPoint()
code = @session.get('code') code = @session.get('code')
@ -102,6 +105,7 @@ module.exports = class LevelBus extends Bus
onSpellCreated: (e) -> onSpellCreated: (e) ->
return unless @onPoint() return unless @onPoint()
spellTeam = e.spell.team spellTeam = e.spell.team
@teamSpellMap ?= {}
@teamSpellMap[spellTeam] ?= [] @teamSpellMap[spellTeam] ?= []
unless e.spell.spellKey in @teamSpellMap[spellTeam] unless e.spell.spellKey in @teamSpellMap[spellTeam]
@ -109,8 +113,7 @@ module.exports = class LevelBus extends Bus
@changedSessionProperties.teamSpells = true @changedSessionProperties.teamSpells = true
@session.set({'teamSpells': @teamSpellMap}) @session.set({'teamSpells': @teamSpellMap})
@saveSession() @saveSession()
@onSpellChanged e # Save the new spell to the session, too.
onScriptStateChanged: (e) -> onScriptStateChanged: (e) ->
return unless @onPoint() return unless @onPoint()
@ -236,10 +239,3 @@ module.exports = class LevelBus extends Bus
destroy: -> destroy: ->
@session.off 'change:multiplayer', @onMultiplayerChanged, @ @session.off 'change:multiplayer', @onMultiplayerChanged, @
super() super()
setTeamSpellMap: (spellMap) ->
@teamSpellMap = spellMap
console.log @teamSpellMap
@changedSessionProperties.teamSpells = true
@session.set({'teamSpells': @teamSpellMap})
@saveSession()

View file

@ -22,6 +22,7 @@ module.exports = IndieSprite = class IndieSprite extends CocoSprite
thang.width = thang.height = thang.depth = 4 thang.width = thang.height = thang.depth = 4
thang.pos = pos ? @defaultPos() thang.pos = pos ? @defaultPos()
thang.pos.z = thang.depth / 2 thang.pos.z = thang.depth / 2
thang.shape = 'ellipsoid'
thang.rotation = 0 thang.rotation = 0
thang.action = 'idle' thang.action = 'idle'
thang.setAction = (action) -> thang.action = action thang.setAction = (action) -> thang.action = action

View file

@ -7,7 +7,7 @@ block content
!{description} !{description}
if !me.get('anonymous') if !me.get('anonymous')
a(href="http://www.youtube.com/watch?v=IFvfZiJGDsw&list=HL1392928835&feature=mh_lolz").intro-button.btn.btn-primary.btn-lg Watch the Video //a(href="http://www.youtube.com/watch?v=IFvfZiJGDsw&list=HL1392928835&feature=mh_lolz").intro-button.btn.btn-primary.btn-lg Watch the Video
a(href="/play/level/ladder-tutorial").intro-button.btn.btn-primary.btn-lg Play the Tutorial a(href="/play/level/ladder-tutorial").intro-button.btn.btn-primary.btn-lg Play the Tutorial

View file

@ -393,7 +393,7 @@ module.exports = class PlayLevelView extends View
register: -> register: ->
@bus = LevelBus.get(@levelID, @session.id) @bus = LevelBus.get(@levelID, @session.id)
@bus.setSession(@session) @bus.setSession(@session)
@bus.setTeamSpellMap @tome.teamSpellMap @bus.setSpells @tome.spells
@bus.connect() if @session.get('multiplayer') @bus.connect() if @session.get('multiplayer')
onSessionWillSave: (e) -> onSessionWillSave: (e) ->

View file

@ -62,7 +62,6 @@
"sendwithus": "2.0.x", "sendwithus": "2.0.x",
"aws-sdk":"~2.0.0", "aws-sdk":"~2.0.0",
"bayesian-battle":"0.0.x", "bayesian-battle":"0.0.x",
"hiredis":"",
"redis": "" "redis": ""
}, },
"devDependencies": { "devDependencies": {
@ -70,7 +69,7 @@
"javascript-brunch": "> 1.0 < 1.8", "javascript-brunch": "> 1.0 < 1.8",
"coffee-script-brunch": "https://github.com/brunch/coffee-script-brunch/tarball/master", "coffee-script-brunch": "https://github.com/brunch/coffee-script-brunch/tarball/master",
"coffeelint-brunch": "> 1.0 < 1.8", "coffeelint-brunch": "> 1.0 < 1.8",
"sass-brunch": "1.7.0", "sass-brunch": "~1.8.0",
"css-brunch": "> 1.0 < 1.8", "css-brunch": "> 1.0 < 1.8",
"jade-brunch": "> 1.0 < 1.8", "jade-brunch": "> 1.0 < 1.8",
"uglify-js-brunch": "~1.7.4", "uglify-js-brunch": "~1.7.4",