mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Fixed issues with level previews and localStorage model loading. Disabled break animations on code error for now. Stopped multiple ThangType load on multiple missiles. Stopped trying to connect to Redis on local production setup.
This commit is contained in:
parent
0561235da2
commit
6b028513fd
5 changed files with 45 additions and 43 deletions
|
@ -82,7 +82,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
|||
if @thangType.isFullyLoaded()
|
||||
@setupSprite()
|
||||
else
|
||||
@thangType.fetch()
|
||||
@thangType.fetch() unless @thangType.loading
|
||||
@listenToOnce(@thangType, 'sync', @setupSprite)
|
||||
|
||||
setupSprite: ->
|
||||
|
@ -442,7 +442,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
|||
console.warn 'Cannot show action', action, 'for', @thangType.get('name'), 'because it DNE' unless @warnedFor[action]
|
||||
@warnedFor[action] = true
|
||||
return if @action is 'idle' then null else 'idle'
|
||||
action = 'break' if @actions.break? and @thang?.erroredOut
|
||||
#action = 'break' if @actions.break? and @thang?.erroredOut # This makes it looks like it's dead when it's not: bad in Brawlwood.
|
||||
action = 'die' if @actions.die? and thang?.health? and thang.health <= 0
|
||||
@actions[action]
|
||||
|
||||
|
|
|
@ -115,7 +115,8 @@ module.exports = Surface = class Surface extends CocoClass
|
|||
|
||||
setWorld: (@world) ->
|
||||
@worldLoaded = true
|
||||
@world.getFrame(Math.min(@getCurrentFrame(), @world.totalFrames - 1)).restoreState() unless @options.choosing
|
||||
lastFrame = Math.min(@getCurrentFrame(), @world.totalFrames - 1)
|
||||
@world.getFrame(lastFrame).restoreState() unless @options.choosing
|
||||
@spriteBoss.world = @world
|
||||
|
||||
@showLevel()
|
||||
|
@ -241,7 +242,7 @@ module.exports = Surface = class Surface extends CocoClass
|
|||
@onFrameChanged()
|
||||
|
||||
getCurrentFrame: ->
|
||||
return Math.max(0, Math.min(Math.floor(@currentFrame), @world.totalFrames - 1))
|
||||
return Math.max(0, Math.min(Math.floor(@currentFrame), @world.frames.length - 1))
|
||||
|
||||
getProgress: -> @currentFrame / @world.totalFrames
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ module.exports = class EditorLevelView extends View
|
|||
constructor: (options, @levelID) ->
|
||||
super options
|
||||
@supermodel.shouldSaveBackups = (model) ->
|
||||
model.constructor.className in ['Level', 'LevelComponent', 'LevelSystem']
|
||||
model.constructor.className in ['Level', 'LevelComponent', 'LevelSystem', 'ThangType']
|
||||
@levelLoader = new LevelLoader supermodel: @supermodel, levelID: @levelID, headless: true, editorMode: true
|
||||
@level = @levelLoader.level
|
||||
@files = new DocumentFiles(@levelLoader.level)
|
||||
|
|
|
@ -84,8 +84,9 @@ module.exports = class PlayLevelView extends View
|
|||
@saveScreenshot = _.throttle @saveScreenshot, 30000
|
||||
|
||||
if @isEditorPreview
|
||||
# wait to see if it's just given to us through setLevel
|
||||
f = => @load() unless @levelLoader
|
||||
@supermodel.shouldSaveBackups = (model) -> # Make sure to load possibly changed things from localStorage.
|
||||
model.constructor.className in ['Level', 'LevelComponent', 'LevelSystem', 'ThangType']
|
||||
f = => @load() unless @levelLoader # Wait to see if it's just given to us through setLevel.
|
||||
setTimeout f, 100
|
||||
else
|
||||
@load()
|
||||
|
|
|
@ -8,7 +8,7 @@ LevelSession = require '../levels/sessions/LevelSession'
|
|||
Level = require '../levels/Level'
|
||||
log = require 'winston'
|
||||
sendwithus = require '../sendwithus'
|
||||
if config.isProduction
|
||||
if config.isProduction and config.redis.host isnt 'localhost'
|
||||
lockManager = require '../commons/LockManager'
|
||||
|
||||
module.exports.setup = (app) ->
|
||||
|
|
Loading…
Reference in a new issue