Added teamSpells persistence

This commit is contained in:
Michael Schmatz 2014-02-10 16:31:21 -08:00
parent cc3b93a0f8
commit 0cbf669474
2 changed files with 9 additions and 2 deletions
app/lib
server/levels/sessions

View file

@ -109,6 +109,10 @@ module.exports = class LevelBus extends Bus
unless e.spell.spellKey in @teamSpellMap[spellTeam]
@teamSpellMap[spellTeam].push e.spell.spellKey
console.log "Assigned spell #{e.spell.spellKey} to team #{spellTeam}"
@changedSessionProperties.teamSpells = true
@session.set({'teamSpells': @teamSpellMap})
@saveSession()
onScriptStateChanged: (e) ->
@ -234,4 +238,7 @@ module.exports = class LevelBus extends Bus
setTeamSpellMap: (spellMap) ->
@teamSpellMap = spellMap
console.log @teamSpellMap
console.log @teamSpellMap
@changedSessionProperties.teamSpells = true
@session.set({'teamSpells': @teamSpellMap})
@saveSession()

View file

@ -7,7 +7,7 @@ class LevelSessionHandler extends Handler
modelClass: LevelSession
editableProperties: ['multiplayer', 'players', 'code', 'completed', 'state',
'levelName', 'creatorName', 'levelID', 'screenshot',
'chat']
'chat', 'teamSpells']
getByRelationship: (req, res, args...) ->
return @sendNotFoundError(res) unless args.length is 2 and args[1] is 'active'