mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 22:13:32 -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'
|
||||
'god': require './schemas/subscriptions/god'
|
||||
'scripts': require './schemas/subscriptions/scripts'
|
||||
'world': require './schemas/subscriptions/world'
|
||||
|
||||
definitionSchemas =
|
||||
'bus': require './schemas/definitions/bus'
|
||||
|
|
|
@ -271,7 +271,6 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass
|
|||
@run()
|
||||
|
||||
onEndNoteGroup: (e) ->
|
||||
e?.preventDefault()
|
||||
# press enter
|
||||
return unless @currentNoteGroup?.script.skippable
|
||||
@endNoteGroup()
|
||||
|
@ -285,7 +284,7 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass
|
|||
clearTimeout(timeout) for timeout in @currentTimeouts
|
||||
for module in @currentNoteGroup.modules
|
||||
@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
|
||||
@trackScriptCompletionsFromNoteGroup(@currentNoteGroup)
|
||||
@currentNoteGroup = null
|
||||
|
|
|
@ -297,7 +297,7 @@ module.exports = class SpriteBoss extends CocoClass
|
|||
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
|
||||
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
|
||||
@camera.zoomTo(sprite?.imageObject or @camera.worldToSurface(worldPos), @camera.zoom, 1000, true)
|
||||
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']},
|
||||
key: {type: 'string'}
|
||||
value: {type: ['any', 'undefined']}
|
||||
value: {}
|
||||
|
|
|
@ -27,3 +27,7 @@ module.exports =
|
|||
|
||||
'achievements:new': c.object {required: 'earnedAchievements'},
|
||||
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']},
|
||||
selector: {type: 'string'}
|
||||
delay: {type: 'number'}
|
||||
delay: {type: ['number', 'null', 'undefined']}
|
||||
sides: {type: 'array', items: {'enum': ['left', 'right', 'top', 'bottom']}}
|
||||
offset: {type: 'object'}
|
||||
rotation: {type: 'number'}
|
||||
|
|
|
@ -102,13 +102,14 @@ module.exports = # /app/lib/surface
|
|||
|
||||
'sprite:highlight-sprites': c.object {},
|
||||
thangIDs: c.array {}, {type: 'string'}
|
||||
delay: {type: 'number'}
|
||||
delay: {type: ['number', 'null', 'undefined']}
|
||||
|
||||
'sprite:move': c.object {required: ['spriteID', 'pos']},
|
||||
spriteID: {type: 'string'}
|
||||
pos: c.object {required: ['x', 'y']},
|
||||
x: {type: 'number'}
|
||||
y: {type: 'number'}
|
||||
z: {type: 'number'}
|
||||
duration: {type: 'number', minimum: 0}
|
||||
|
||||
'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
|
||||
|
||||
events:
|
||||
'click #restart-level-confirm-button': -> Backbone.Mediator.publish 'level:restart-level', {}
|
||||
'click #restart-level-confirm-button': -> Backbone.Mediator.publish 'level:restart', {}
|
||||
|
||||
getRenderData: (context={}) ->
|
||||
context = super(context)
|
||||
|
|
|
@ -223,7 +223,7 @@ module.exports = class TomeView extends CocoView
|
|||
|
||||
reloadAllCode: ->
|
||||
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) ->
|
||||
spell.updateLanguageAether e.language for spellKey, spell of @spells when spell.canWrite()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue