diff --git a/app/lib/God.coffee b/app/lib/God.coffee index cf1631689..8feafbfa1 100644 --- a/app/lib/God.coffee +++ b/app/lib/God.coffee @@ -131,7 +131,9 @@ module.exports = class God extends CocoClass Backbone.Mediator.publish 'god:debug-world-load-progress-changed', progress: event.data.progress onNewWorldCreated: (e) -> + console.log 'filtering', _.cloneDeep e.world.userCodeMap @currentUserCodeMap = @filterUserCodeMapWhenFromWorld e.world.userCodeMap + console.log ' ... filtered into', _.cloneDeep e.world.userCodeMap filterUserCodeMapWhenFromWorld: (worldUserCodeMap) -> newUserCodeMap = {} diff --git a/app/lib/aether_utils.coffee b/app/lib/aether_utils.coffee index 0356aa89f..ba02b5cb7 100644 --- a/app/lib/aether_utils.coffee +++ b/app/lib/aether_utils.coffee @@ -8,7 +8,7 @@ module.exports.createAetherOptions = (options) -> aetherOptions = functionName: options.functionName protectAPI: not options.skipProtectAPI - includeFlow: false + includeFlow: options.includeFlow yieldConditionally: options.functionName is 'plan' simpleLoops: true globals: ['Vector', '_'] diff --git a/app/lib/world/world.coffee b/app/lib/world/world.coffee index f0cad15a0..fb4ed80bd 100644 --- a/app/lib/world/world.coffee +++ b/app/lib/world/world.coffee @@ -442,7 +442,15 @@ module.exports = class World perf = {} perf.t0 = now() nFrames = endFrame - startFrame - w = streamingWorld ? new World o.userCodeMap, classMap + if streamingWorld + w = streamingWorld + # Make sure we get any Aether updates from the new frames into the already-deserialized streaming world Aethers. + for thangID, methods of o.userCodeMap + for methodName, serializedAether of methods + for aetherStateKey in ['flow', 'metrics', 'style', 'problems'] + w.userCodeMap[thangID][methodName][aetherStateKey] = serializedAether[aetherStateKey] + else + w = new World o.userCodeMap, classMap [w.totalFrames, w.maxTotalFrames, w.frameRate, w.dt, w.scriptNotes, w.victory] = [o.totalFrames, o.maxTotalFrames, o.frameRate, o.dt, o.scriptNotes ? [], o.victory] w[prop] = val for prop, val of o.trackedProperties diff --git a/app/schemas/subscriptions/tome.coffee b/app/schemas/subscriptions/tome.coffee index 3f20ebe78..573cd5dd3 100644 --- a/app/schemas/subscriptions/tome.coffee +++ b/app/schemas/subscriptions/tome.coffee @@ -58,7 +58,7 @@ module.exports = entry: {type: 'object'} 'tome:spell-statement-index-updated': c.object {title: 'Spell Statement Index Updated', description: 'Published when the spell index is updated', required: ['statementIndex', 'ace']}, - statementIndex: {type: 'object'} + statementIndex: {type: 'integer'} ace: {type: 'object'} 'tome:spell-beautify': c.object {title: 'Beautify', description: 'Published when you click the \'beautify\' button', required: []}, diff --git a/app/styles/play/level/tome/spell_toolbar.sass b/app/styles/play/level/tome/spell_toolbar.sass index 6a5e7505a..57f4257a5 100644 --- a/app/styles/play/level/tome/spell_toolbar.sass +++ b/app/styles/play/level/tome/spell_toolbar.sass @@ -17,8 +17,9 @@ .spell-progress position: absolute height: 100% - width: 40% - left: 45% + top: -50px + width: 85% + left: 10% display: inline-block cursor: pointer box-sizing: border-box diff --git a/app/views/play/level/tome/Spell.coffee b/app/views/play/level/tome/Spell.coffee index 43bfb0faf..20d05bf93 100644 --- a/app/views/play/level/tome/Spell.coffee +++ b/app/views/play/level/tome/Spell.coffee @@ -19,6 +19,7 @@ module.exports = class Spell @skipProtectAPI = options.skipProtectAPI @worker = options.worker @levelID = options.levelID + @levelType = options.level.get('type', true) p = options.programmableMethod @languages = p.languages ? {} @@ -131,7 +132,7 @@ module.exports = class Spell aceConfig = me.get('aceConfig') ? {} writable = @permissions.readwrite.length > 0 skipProtectAPI = @skipProtectAPI or not writable - aetherOptions = createAetherOptions functionName: @name, codeLanguage: @language, functionParameters: @parameters, skipProtectAPI: skipProtectAPI + aetherOptions = createAetherOptions functionName: @name, codeLanguage: @language, functionParameters: @parameters, skipProtectAPI: skipProtectAPI, includeFlow: @levelType is 'hero' aether = new Aether aetherOptions if @worker workerMessage = diff --git a/app/views/play/level/tome/SpellView.coffee b/app/views/play/level/tome/SpellView.coffee index 421befe1d..e21cb4f0a 100644 --- a/app/views/play/level/tome/SpellView.coffee +++ b/app/views/play/level/tome/SpellView.coffee @@ -605,18 +605,20 @@ module.exports = class SpellView extends CocoView @aceSession.removeGutterDecoration row, 'executing' @aceSession.removeGutterDecoration row, 'executed' @decoratedGutter[row] = '' - if not executed.length or (@spell.name is 'plan' and @spellThang.castAether.metrics.statementsExecuted < 20) + lastExecuted = _.last executed + showToolbarView = executed.length and (@spell.name isnt 'plan' or @spellThang.castAether.metrics.statementsExecuted > 20) + + if showToolbarView + statementIndex = Math.max 0, lastExecuted.length - 1 + @toolbarView?.toggleFlow true + @toolbarView?.setCallState states[currentCallIndex], statementIndex, currentCallIndex, @spellThang.castAether.metrics + lastExecuted = lastExecuted[0 .. @toolbarView.statementIndex] if @toolbarView?.statementIndex? + else @toolbarView?.toggleFlow false @debugView?.setVariableStates {} - return - lastExecuted = _.last executed - @toolbarView?.toggleFlow true - statementIndex = Math.max 0, lastExecuted.length - 1 - @toolbarView?.setCallState states[currentCallIndex], statementIndex, currentCallIndex, @spellThang.castAether.metrics marked = {} - lastExecuted = lastExecuted[0 .. @toolbarView.statementIndex] if @toolbarView?.statementIndex? gotVariableStates = false - for state, i in lastExecuted + for state, i in lastExecuted ? [] [start, end] = state.range clazz = if i is lastExecuted.length - 1 then 'executing' else 'executed' if clazz is 'executed' @@ -705,7 +707,6 @@ module.exports = class SpellView extends CocoView @reloadCode true if wasDefault onInsertSnippet: (e) -> - console.log 'doc', e.doc, e.formatted snippetCode = null if e.doc.snippets?[e.language]?.code snippetCode = e.doc.snippets[e.language].code