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'
if finished
@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
for scriptNote in @shared.world.scriptNotes
Backbone.Mediator.publish scriptNote.channel, scriptNote.event

View file

@ -455,7 +455,10 @@ module.exports = Surface = class Surface extends CocoClass
else
@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
@updatePaths()
if event.finished
@updatePaths()
else
@hidePaths()
onIdleChanged: (e) ->
@setPaused e.idle unless @ended

View file

@ -472,9 +472,13 @@ module.exports = class World
perf.t1 = now()
if w.thangs.length
for thangConfig in o.thangs when not w.thangMap[thangConfig.id]
w.thangs.push thang = Thang.deserialize(thangConfig, w, classMap, level.levelComponents)
w.setThang thang
for thangConfig in o.thangs
if thang = w.thangMap[thangConfig.id]
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
w.thangs = (Thang.deserialize(thang, w, classMap, level.levelComponents) for thang in o.thangs)
w.setThang thang for thang in w.thangs

View file

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