mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 08:50:58 -05:00
Fixed a bug where sometimes scripts setting playback would be overridden by the surface resetting playback after casting is done.
This commit is contained in:
parent
3f884e71e5
commit
2b56dffcb0
1 changed files with 3 additions and 1 deletions
|
@ -281,6 +281,7 @@ module.exports = Surface = class Surface extends CocoClass
|
|||
|
||||
onSetPlaying: (e) ->
|
||||
@playing = (e ? {}).playing ? true
|
||||
@setPlayingCalled = true
|
||||
if @playing and @currentFrame >= (@world.totalFrames - 5)
|
||||
@currentFrame = 0
|
||||
if @fastForwarding and not @playing
|
||||
|
@ -352,6 +353,7 @@ module.exports = Surface = class Surface extends CocoClass
|
|||
@casting = true
|
||||
@wasPlayingWhenCastingBegan = @playing
|
||||
Backbone.Mediator.publish 'level-set-playing', { playing: false }
|
||||
@setPlayingCalled = false # don't overwrite playing settings if they changed by, say, scripts
|
||||
|
||||
if @coordinateDisplay?
|
||||
@surfaceTextLayer.removeChild @coordinateDisplay
|
||||
|
@ -370,7 +372,7 @@ module.exports = Surface = class Surface extends CocoClass
|
|||
|
||||
# This has a tendency to break scripts that are waiting for playback to change when the level is loaded
|
||||
# so only run it after the first world is created.
|
||||
Backbone.Mediator.publish 'level-set-playing', { playing: @wasPlayingWhenCastingBegan } unless event.firstWorld
|
||||
Backbone.Mediator.publish 'level-set-playing', { playing: @wasPlayingWhenCastingBegan } unless event.firstWorld or @setPlayingCalled
|
||||
|
||||
fastForwardTo = null
|
||||
if @playing
|
||||
|
|
Loading…
Reference in a new issue