diff --git a/app/lib/errors.coffee b/app/lib/errors.coffee index 04a0c8fd5..50f7de71e 100644 --- a/app/lib/errors.coffee +++ b/app/lib/errors.coffee @@ -10,7 +10,7 @@ module.exports.parseServerError = (text) -> error module.exports.genericFailure = (jqxhr) -> - Backbone.Mediator.publish('server-error', {response: jqxhr}) + Backbone.Mediator.publish('errors:server-error', {response: jqxhr}) return connectionFailure() if not jqxhr.status error = module.exports.parseServerError(jqxhr.responseText) diff --git a/app/lib/surface/Surface.coffee b/app/lib/surface/Surface.coffee index b7ca42669..7047709ac 100644 --- a/app/lib/surface/Surface.coffee +++ b/app/lib/surface/Surface.coffee @@ -87,7 +87,7 @@ module.exports = Surface = class Surface extends CocoClass @options = _.extend(@options, givenOptions) if givenOptions @initEasel() @initAudio() - @onResize = _.debounce @onResize, 250 + @onResize = _.debounce @onResize, 500 # At least as much as $level-resize-transition-time. $(window).on 'resize', @onResize if @world.ended _.defer => @setWorld @world @@ -489,7 +489,7 @@ module.exports = Surface = class Surface extends CocoClass newPos = @camera.screenToCanvas({x: e.stageX, y: e.stageY}) # getObject(s)UnderPoint is broken, so we have to use the private method to get what we want onBackground = not @stage._getObjectsUnderPoint(newPos.x, newPos.y, null, true) - + worldPos = @camera.screenToWorld x: e.stageX, y: e.stageY event = onBackground: onBackground, x: e.stageX, y: e.stageY, originalEvent: e, worldPos: worldPos Backbone.Mediator.publish 'surface:stage-mouse-down', event diff --git a/app/models/Level.coffee b/app/models/Level.coffee index 5f6ff797c..ddad95999 100644 --- a/app/models/Level.coffee +++ b/app/models/Level.coffee @@ -24,14 +24,14 @@ module.exports = class Level extends CocoModel # Figure out ThangTypes' Components tmap = {} tmap[t.thangType] = true for t in o.thangs ? [] - o.thangTypes = (original: tt.get('original'), name: tt.get('name'), components: $.extend(true, [], tt.get('components')) for tt in supermodel.getModels ThangType when tmap[tt.get('original')] or tt.isFullyLoaded()) + o.thangTypes = (original: tt.get('original'), name: tt.get('name'), components: $.extend(true, [], tt.get('components')) for tt in supermodel.getModels ThangType when tmap[tt.get('original')] or tt.get('components')) @sortThangComponents o.thangTypes, o.levelComponents, 'ThangType' @fillInDefaultComponentConfiguration o.thangTypes, o.levelComponents - + o - + cachedLevelComponents: null - + getCachedLevelComponents: (supermodel) -> @cachedLevelComponents ?= {} levelComponents = supermodel.getModels LevelComponent @@ -43,7 +43,7 @@ module.exports = class Level extends CocoModel @cachedLevelComponents[levelComponent.id] ?= @cachedLevelComponents[levelComponent.id] = $.extend(true, {}, levelComponent.attributes) newLevelComponents.push(@cachedLevelComponents[levelComponent.id]) newLevelComponents - + denormalize: (supermodel, session) -> o = $.extend true, {}, @attributes if o.thangs and @get('type', true) is 'hero' diff --git a/app/models/LevelSession.coffee b/app/models/LevelSession.coffee index ba87aef23..5d59d1bc2 100644 --- a/app/models/LevelSession.coffee +++ b/app/models/LevelSession.coffee @@ -42,3 +42,14 @@ module.exports = class LevelSession extends CocoModel completed: -> @get('state')?.complete || false + + shouldAvoidCorruptData: (attrs) -> + return false unless me.team is 'humans' + if _.string.startsWith (attrs?.code ? @get('code'))?.anya?.makeBid ? '', 'var __interceptThis' + noty text: "Not saving session--it's trying to overwrite Anya's code with transpiled output. Please let us know and help us reproduce this bug!", layout: 'topCenter', type: 'error', killer: false, timeout: 120000 + return true + false + + save: (attrs, options) -> + return if @shouldAvoidCorruptData attrs + super attrs, options diff --git a/app/styles/game-menu/game-menu-modal.sass b/app/styles/game-menu/game-menu-modal.sass index 428dc8e72..71b9728e7 100644 --- a/app/styles/game-menu/game-menu-modal.sass +++ b/app/styles/game-menu/game-menu-modal.sass @@ -1,4 +1,10 @@ #game-menu-modal + + .close + position: absolute + top: 10px + right: 20px + .modal-dialog margin-top: 0 diff --git a/app/styles/play/level.sass b/app/styles/play/level.sass index 4a87c0099..cf4edfba7 100644 --- a/app/styles/play/level.sass +++ b/app/styles/play/level.sass @@ -6,6 +6,8 @@ body.is-playing .footer background-color: black +$level-resize-transition-time: 0.5s + #level-view margin: 0 auto @include user-select(none) @@ -49,13 +51,13 @@ body.is-playing width: 55% position: relative overflow: hidden - @include transition(0.5s ease-out) + @include transition($level-resize-transition-time ease-out) canvas#surface background-color: #333 display: block z-index: 1 - @include transition(0.5s ease-out) + @include transition($level-resize-transition-time ease-out) &.flag-color-selected cursor: crosshair @@ -73,7 +75,7 @@ body.is-playing right: 0 top: 0px bottom: 0 - @include transition(width 0.5s ease-in-out, right 0.5s ease-in-out) + @include transition(width $level-resize-transition-time ease-in-out, right $level-resize-transition-time ease-in-out) #pointer position: absolute diff --git a/app/templates/game-menu/game-menu-modal.jade b/app/templates/game-menu/game-menu-modal.jade index 0876d23d5..0ebc65f97 100644 --- a/app/templates/game-menu/game-menu-modal.jade +++ b/app/templates/game-menu/game-menu-modal.jade @@ -3,6 +3,7 @@ extends /templates/modal/modal_base block modal-header block modal-body-content + .button.close(type="button", data-dismiss="modal", aria-hidden="true") × .tabbable.tabs-left - var submenus = ["inventory", "choose-hero", "save-load", "options", "guide", "multiplayer"] - if (!showDevBits) { // Not done yet. diff --git a/app/views/play/SpectateView.coffee b/app/views/play/SpectateView.coffee index 8cd6a79cb..f4d7514ba 100644 --- a/app/views/play/SpectateView.coffee +++ b/app/views/play/SpectateView.coffee @@ -217,7 +217,7 @@ module.exports = class SpectateLevelView extends RootView initScriptManager: -> if @world.scripts nonVictoryPlaybackScripts = _.reject @world.scripts, (script) -> - script.id.indexOf('Set Camera Boundaries and Goals') == -1 + script.id.indexOf('Set Camera Boundaries') is -1 else console.log 'World scripts don\'t exist!' nonVictoryPlaybackScripts = [] diff --git a/app/views/play/level/tome/Spell.coffee b/app/views/play/level/tome/Spell.coffee index dde14abf8..940715f45 100644 --- a/app/views/play/level/tome/Spell.coffee +++ b/app/views/play/level/tome/Spell.coffee @@ -171,4 +171,4 @@ module.exports = class Spell @source = e.code[spellkeyComponents[0]][spellkeyComponents[1]] @updateLanguageAether e.codeLanguage else - console.error 'Spell onNewOpponentCode did not recieve code', e + console.error 'Spell onNewOpponentCode did not receive code', e diff --git a/app/views/play/level/tome/SpellView.coffee b/app/views/play/level/tome/SpellView.coffee index b0b7b55a5..b1b7cadae 100644 --- a/app/views/play/level/tome/SpellView.coffee +++ b/app/views/play/level/tome/SpellView.coffee @@ -668,7 +668,7 @@ module.exports = class SpellView extends CocoView @ace.setValue pretty onMaximizeToggled: (e) -> - @ace.resize true + _.delay (=> @ace?.resize true), 500 # Wait $level-resize-transition-time. onChangeEditorConfig: (e) -> aceConfig = me.get('aceConfig') ? {}