mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Make sync pvp level sessions publicly readable
This commit is contained in:
parent
6b7e146084
commit
48d5dd9dc6
1 changed files with 9 additions and 5 deletions
|
@ -697,7 +697,7 @@ module.exports = class PlayLevelView extends RootView
|
||||||
data = snapshot.val()
|
data = snapshot.val()
|
||||||
if data? and data.id isnt me.id
|
if data? and data.id isnt me.id
|
||||||
@realTimeOpponentData = data
|
@realTimeOpponentData = data
|
||||||
console.log 'PlayLevelView onRealTimePlayerAdded opponent', @realTimeOpponentData, @realTimePlayersData
|
# console.log 'PlayLevelView onRealTimePlayerAdded opponent', @realTimeOpponentData, @realTimePlayersData
|
||||||
@realTimePlayersData[@realTimeOpponentData.id] = @realTimeOpponentData
|
@realTimePlayersData[@realTimeOpponentData.id] = @realTimeOpponentData
|
||||||
if @realTimeSessionData?.state is 'creating'
|
if @realTimeSessionData?.state is 'creating'
|
||||||
@realTimeSessionRef.update 'state': 'coding'
|
@realTimeSessionRef.update 'state': 'coding'
|
||||||
|
@ -758,7 +758,7 @@ module.exports = class PlayLevelView extends RootView
|
||||||
# console.error 'Joining real-time multiplayer game with an existing @realTimeSessionRef.'
|
# console.error 'Joining real-time multiplayer game with an existing @realTimeSessionRef.'
|
||||||
|
|
||||||
onRealTimeMultiplayerJoinedGame: (e) ->
|
onRealTimeMultiplayerJoinedGame: (e) ->
|
||||||
console.log 'PlayLevelView onRealTimeMultiplayerJoinedGame', e
|
# console.log 'PlayLevelView onRealTimeMultiplayerJoinedGame', e
|
||||||
@joinRealTimeMultiplayerGame e
|
@joinRealTimeMultiplayerGame e
|
||||||
@realTimePlayerGameRef.update 'state': 'coding'
|
@realTimePlayerGameRef.update 'state': 'coding'
|
||||||
@realTimePlayerRef.update 'state': 'unavailable'
|
@realTimePlayerRef.update 'state': 'unavailable'
|
||||||
|
@ -828,7 +828,7 @@ module.exports = class PlayLevelView extends RootView
|
||||||
if me.id is @realTimeSessionData.creator
|
if me.id is @realTimeSessionData.creator
|
||||||
sessionState = @session.get('state')
|
sessionState = @session.get('state')
|
||||||
if sessionState?
|
if sessionState?
|
||||||
submissionCount = sessionState.submissionCount
|
submissionCount = sessionState.submissionCount ? 0
|
||||||
console.info 'Setting multiplayer submissionCount to', submissionCount
|
console.info 'Setting multiplayer submissionCount to', submissionCount
|
||||||
@realTimeSessionRef.update 'submissionCount': submissionCount
|
@realTimeSessionRef.update 'submissionCount': submissionCount
|
||||||
else
|
else
|
||||||
|
@ -849,6 +849,10 @@ module.exports = class PlayLevelView extends RootView
|
||||||
transpiledCode[thang][spellID] = aether.transpile spell
|
transpiledCode[thang][spellID] = aether.transpile spell
|
||||||
# console.log "PlayLevelView transpiled code", transpiledCode
|
# console.log "PlayLevelView transpiled code", transpiledCode
|
||||||
@session.set 'transpiledCode', transpiledCode
|
@session.set 'transpiledCode', transpiledCode
|
||||||
|
permissions = @session.get 'permissions' ? []
|
||||||
|
unless _.find(permissions, (p) -> p.target is 'public' and p.access is 'read')
|
||||||
|
permissions.push target:'public', access:'read'
|
||||||
|
@session.set 'permissions', permissions
|
||||||
@session.patch()
|
@session.patch()
|
||||||
@realTimePlayerGameRef.update 'state': 'submitted'
|
@realTimePlayerGameRef.update 'state': 'submitted'
|
||||||
|
|
||||||
|
@ -926,7 +930,7 @@ module.exports = class PlayLevelView extends RootView
|
||||||
[newThang, newSpell] = newSpellKey.split '/'
|
[newThang, newSpell] = newSpellKey.split '/'
|
||||||
if newSpell is oldSpell
|
if newSpell is oldSpell
|
||||||
# Found spell location under new team
|
# Found spell location under new team
|
||||||
console.log "Swapping spell=#{oldSpell} from #{oldThang} to #{newThang}"
|
# console.log "Swapping spell=#{oldSpell} from #{oldThang} to #{newThang}"
|
||||||
if code[newThang]?[oldSpell]?
|
if code[newThang]?[oldSpell]?
|
||||||
# Option 1: have a new spell to swap
|
# Option 1: have a new spell to swap
|
||||||
code[oldThang][oldSpell] = code[newThang][oldSpell]
|
code[oldThang][oldSpell] = code[newThang][oldSpell]
|
||||||
|
|
Loading…
Reference in a new issue