Fixes for updating paths during world streaming.

This commit is contained in:
Nick Winter 2014-11-18 12:40:28 -08:00
parent aab51178e2
commit f5b5ee2206
4 changed files with 13 additions and 5 deletions

View file

@ -130,7 +130,7 @@ module.exports = class Angel extends CocoClass
eventType = if finished then 'god:new-world-created' else 'god:streaming-world-updated' eventType = if finished then 'god:new-world-created' else 'god:streaming-world-updated'
if finished if finished
@shared.world = world @shared.world = world
Backbone.Mediator.publish eventType, world: world, firstWorld: @shared.firstWorld, goalStates: goalStates, team: me.team, firstChangedFrame: firstChangedFrame Backbone.Mediator.publish eventType, world: world, firstWorld: @shared.firstWorld, goalStates: goalStates, team: me.team, firstChangedFrame: firstChangedFrame, finished: finished
if finished if finished
for scriptNote in @shared.world.scriptNotes for scriptNote in @shared.world.scriptNotes
Backbone.Mediator.publish scriptNote.channel, scriptNote.event Backbone.Mediator.publish scriptNote.channel, scriptNote.event

View file

@ -455,7 +455,10 @@ module.exports = Surface = class Surface extends CocoClass
else else
@fastForwardingToFrame = @fastForwardingSpeed = null @fastForwardingToFrame = @fastForwardingSpeed = null
# console.log "on new world, lag", lag, "intended lag", intendedLag, "fastForwardingToFrame", @fastForwardingToFrame, "speed", @fastForwardingSpeed, "cause we are at", @world.age, "of", @world.frames.length * @world.dt # console.log "on new world, lag", lag, "intended lag", intendedLag, "fastForwardingToFrame", @fastForwardingToFrame, "speed", @fastForwardingSpeed, "cause we are at", @world.age, "of", @world.frames.length * @world.dt
@updatePaths() if event.finished
@updatePaths()
else
@hidePaths()
onIdleChanged: (e) -> onIdleChanged: (e) ->
@setPaused e.idle unless @ended @setPaused e.idle unless @ended

View file

@ -472,9 +472,13 @@ module.exports = class World
perf.t1 = now() perf.t1 = now()
if w.thangs.length if w.thangs.length
for thangConfig in o.thangs when not w.thangMap[thangConfig.id] for thangConfig in o.thangs
w.thangs.push thang = Thang.deserialize(thangConfig, w, classMap, level.levelComponents) if thang = w.thangMap[thangConfig.id]
w.setThang thang for prop, val of thangConfig.finalState
thang[prop] = val
else
w.thangs.push thang = Thang.deserialize(thangConfig, w, classMap, level.levelComponents)
w.setThang thang
else else
w.thangs = (Thang.deserialize(thang, w, classMap, level.levelComponents) for thang in o.thangs) w.thangs = (Thang.deserialize(thang, w, classMap, level.levelComponents) for thang in o.thangs)
w.setThang thang for thang in w.thangs w.setThang thang for thang in w.thangs

View file

@ -24,6 +24,7 @@ worldUpdatedEventSchema = c.object {required: ['world', 'firstWorld', 'goalState
goalStates: goalStatesSchema goalStates: goalStatesSchema
team: {type: 'string'} team: {type: 'string'}
firstChangedFrame: {type: 'integer', minimum: 0} firstChangedFrame: {type: 'integer', minimum: 0}
finished: {type: 'boolean'}
module.exports = module.exports =
'god:user-code-problem': c.object {required: ['problem']}, 'god:user-code-problem': c.object {required: ['problem']},