Merge branch 'master' into production

This commit is contained in:
Nick Winter 2014-09-04 11:15:16 -07:00
commit c0a39151f1
10 changed files with 34 additions and 14 deletions

View file

@ -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)

View file

@ -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

View file

@ -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'

View file

@ -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

View file

@ -1,4 +1,10 @@
#game-menu-modal
.close
position: absolute
top: 10px
right: 20px
.modal-dialog
margin-top: 0

View file

@ -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

View file

@ -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.

View file

@ -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 = []

View file

@ -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

View file

@ -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') ? {}