mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-01 08:23:57 -04:00
Fixed #1481. More Mediator schema fixes.
This commit is contained in:
parent
28431703f5
commit
ec6b3d7e5f
10 changed files with 43 additions and 8 deletions
app
|
@ -12,6 +12,7 @@ channelSchemas =
|
||||||
'tome': require './schemas/subscriptions/tome'
|
'tome': require './schemas/subscriptions/tome'
|
||||||
'god': require './schemas/subscriptions/god'
|
'god': require './schemas/subscriptions/god'
|
||||||
'scripts': require './schemas/subscriptions/scripts'
|
'scripts': require './schemas/subscriptions/scripts'
|
||||||
|
'world': require './schemas/subscriptions/world'
|
||||||
|
|
||||||
definitionSchemas =
|
definitionSchemas =
|
||||||
'bus': require './schemas/definitions/bus'
|
'bus': require './schemas/definitions/bus'
|
||||||
|
|
|
@ -271,7 +271,6 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass
|
||||||
@run()
|
@run()
|
||||||
|
|
||||||
onEndNoteGroup: (e) ->
|
onEndNoteGroup: (e) ->
|
||||||
e?.preventDefault()
|
|
||||||
# press enter
|
# press enter
|
||||||
return unless @currentNoteGroup?.script.skippable
|
return unless @currentNoteGroup?.script.skippable
|
||||||
@endNoteGroup()
|
@endNoteGroup()
|
||||||
|
@ -285,7 +284,7 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass
|
||||||
clearTimeout(timeout) for timeout in @currentTimeouts
|
clearTimeout(timeout) for timeout in @currentTimeouts
|
||||||
for module in @currentNoteGroup.modules
|
for module in @currentNoteGroup.modules
|
||||||
@processNote(note, @currentNoteGroup) for note in module.endNotes()
|
@processNote(note, @currentNoteGroup) for note in module.endNotes()
|
||||||
Backbone.Mediator.publish 'script:note-group-ended' unless @quiet
|
Backbone.Mediator.publish 'script:note-group-ended', {} unless @quiet
|
||||||
@scriptInProgress = false
|
@scriptInProgress = false
|
||||||
@trackScriptCompletionsFromNoteGroup(@currentNoteGroup)
|
@trackScriptCompletionsFromNoteGroup(@currentNoteGroup)
|
||||||
@currentNoteGroup = null
|
@currentNoteGroup = null
|
||||||
|
|
|
@ -297,7 +297,7 @@ module.exports = class SpriteBoss extends CocoClass
|
||||||
selectSprite: (e, sprite=null, spellName=null, treemaThangSelected = null) ->
|
selectSprite: (e, sprite=null, spellName=null, treemaThangSelected = null) ->
|
||||||
return if e and (@disabled or @selectLocked) # Ignore clicks for selection/panning/wizard movement while disabled or select is locked
|
return if e and (@disabled or @selectLocked) # Ignore clicks for selection/panning/wizard movement while disabled or select is locked
|
||||||
worldPos = sprite?.thang?.pos
|
worldPos = sprite?.thang?.pos
|
||||||
worldPos ?= @camera.screenToWorld {x: e.originalEvent.rawX, y: e.originalEvent.rawY} if e
|
worldPos ?= @camera.screenToWorld {x: e.originalEvent.rawX, y: e.originalEvent.rawY} if e?.originalEvent
|
||||||
if worldPos and (@options.navigateToSelection or not sprite or treemaThangSelected) and e?.originalEvent?.nativeEvent?.which isnt 3
|
if worldPos and (@options.navigateToSelection or not sprite or treemaThangSelected) and e?.originalEvent?.nativeEvent?.which isnt 3
|
||||||
@camera.zoomTo(sprite?.imageObject or @camera.worldToSurface(worldPos), @camera.zoom, 1000, true)
|
@camera.zoomTo(sprite?.imageObject or @camera.worldToSurface(worldPos), @camera.zoom, 1000, true)
|
||||||
sprite = null if @options.choosing # Don't select sprites while choosing
|
sprite = null if @options.choosing # Don't select sprites while choosing
|
||||||
|
|
|
@ -50,4 +50,4 @@ module.exports =
|
||||||
|
|
||||||
'god:debug-value-return': c.object {required: ['key']},
|
'god:debug-value-return': c.object {required: ['key']},
|
||||||
key: {type: 'string'}
|
key: {type: 'string'}
|
||||||
value: {type: ['any', 'undefined']}
|
value: {}
|
||||||
|
|
|
@ -27,3 +27,7 @@ module.exports =
|
||||||
|
|
||||||
'achievements:new': c.object {required: 'earnedAchievements'},
|
'achievements:new': c.object {required: 'earnedAchievements'},
|
||||||
earnedAchievements: {type: 'object'}
|
earnedAchievements: {type: 'object'}
|
||||||
|
|
||||||
|
'ladder:game-submitted': c.object {required: ['session', 'level']},
|
||||||
|
session: {type: 'object'}
|
||||||
|
level: {type: 'object'}
|
||||||
|
|
|
@ -107,7 +107,7 @@ module.exports =
|
||||||
|
|
||||||
'level:highlight-dom': c.object {required: ['selector']},
|
'level:highlight-dom': c.object {required: ['selector']},
|
||||||
selector: {type: 'string'}
|
selector: {type: 'string'}
|
||||||
delay: {type: 'number'}
|
delay: {type: ['number', 'null', 'undefined']}
|
||||||
sides: {type: 'array', items: {'enum': ['left', 'right', 'top', 'bottom']}}
|
sides: {type: 'array', items: {'enum': ['left', 'right', 'top', 'bottom']}}
|
||||||
offset: {type: 'object'}
|
offset: {type: 'object'}
|
||||||
rotation: {type: 'number'}
|
rotation: {type: 'number'}
|
||||||
|
|
|
@ -102,13 +102,14 @@ module.exports = # /app/lib/surface
|
||||||
|
|
||||||
'sprite:highlight-sprites': c.object {},
|
'sprite:highlight-sprites': c.object {},
|
||||||
thangIDs: c.array {}, {type: 'string'}
|
thangIDs: c.array {}, {type: 'string'}
|
||||||
delay: {type: 'number'}
|
delay: {type: ['number', 'null', 'undefined']}
|
||||||
|
|
||||||
'sprite:move': c.object {required: ['spriteID', 'pos']},
|
'sprite:move': c.object {required: ['spriteID', 'pos']},
|
||||||
spriteID: {type: 'string'}
|
spriteID: {type: 'string'}
|
||||||
pos: c.object {required: ['x', 'y']},
|
pos: c.object {required: ['x', 'y']},
|
||||||
x: {type: 'number'}
|
x: {type: 'number'}
|
||||||
y: {type: 'number'}
|
y: {type: 'number'}
|
||||||
|
z: {type: 'number'}
|
||||||
duration: {type: 'number', minimum: 0}
|
duration: {type: 'number', minimum: 0}
|
||||||
|
|
||||||
'sprite:mouse-down': spriteMouseEventSchema
|
'sprite:mouse-down': spriteMouseEventSchema
|
||||||
|
|
30
app/schemas/subscriptions/world.coffee
Normal file
30
app/schemas/subscriptions/world.coffee
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
c = require 'schemas/schemas'
|
||||||
|
|
||||||
|
module.exports =
|
||||||
|
'world:won': c.object {},
|
||||||
|
replacedNoteChain: {type: 'array'}
|
||||||
|
|
||||||
|
'world:thang-died': c.object {required: ['thang', 'killer']},
|
||||||
|
replacedNoteChain: {type: 'array'}
|
||||||
|
thang: {type: 'object'}
|
||||||
|
killer: {type: 'object'}
|
||||||
|
|
||||||
|
'world:thang-touched-goal': c.object {required: ['actor', 'touched']},
|
||||||
|
replacedNoteChain: {type: 'array'}
|
||||||
|
thang: {type: 'object'}
|
||||||
|
actor: {type: 'object'}
|
||||||
|
touched: {type: 'object'}
|
||||||
|
|
||||||
|
'world:thang-collected-item': c.object {required: ['actor', 'item']},
|
||||||
|
replacedNoteChain: {type: 'array'}
|
||||||
|
thang: {type: 'object'}
|
||||||
|
actor: {type: 'object'}
|
||||||
|
item: {type: 'object'}
|
||||||
|
|
||||||
|
'world:thang-finished-plans': c.object {required: ['thang']},
|
||||||
|
replacedNoteChain: {type: 'array'}
|
||||||
|
thang: {type: 'object'}
|
||||||
|
|
||||||
|
'world:attacked-when-out-of-range': c.object {required: ['thang']},
|
||||||
|
replacedNoteChain: {type: 'array'}
|
||||||
|
thang: {type: 'object'}
|
|
@ -9,7 +9,7 @@ module.exports = class ChooseHeroView extends CocoView
|
||||||
template: template
|
template: template
|
||||||
|
|
||||||
events:
|
events:
|
||||||
'click #restart-level-confirm-button': -> Backbone.Mediator.publish 'level:restart-level', {}
|
'click #restart-level-confirm-button': -> Backbone.Mediator.publish 'level:restart', {}
|
||||||
|
|
||||||
getRenderData: (context={}) ->
|
getRenderData: (context={}) ->
|
||||||
context = super(context)
|
context = super(context)
|
||||||
|
|
|
@ -223,7 +223,7 @@ module.exports = class TomeView extends CocoView
|
||||||
|
|
||||||
reloadAllCode: ->
|
reloadAllCode: ->
|
||||||
spell.view.reloadCode false for spellKey, spell of @spells when spell.team is me.team or (spell.team in ['common', 'neutral', null])
|
spell.view.reloadCode false for spellKey, spell of @spells when spell.team is me.team or (spell.team in ['common', 'neutral', null])
|
||||||
Backbone.Mediator.publish 'tome:cast-spells', spells: @spells, preload: false
|
Backbone.Mediator.publish 'tome:cast-spells', spells: @spells, preload: false, realTime: false
|
||||||
|
|
||||||
updateLanguageForAllSpells: (e) ->
|
updateLanguageForAllSpells: (e) ->
|
||||||
spell.updateLanguageAether e.language for spellKey, spell of @spells when spell.canWrite()
|
spell.updateLanguageAether e.language for spellKey, spell of @spells when spell.canWrite()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue