diff --git a/app/assets/javascripts/workers/worker_world.js b/app/assets/javascripts/workers/worker_world.js index c47d296c3..f5d91cf18 100644 --- a/app/assets/javascripts/workers/worker_world.js +++ b/app/assets/javascripts/workers/worker_world.js @@ -238,13 +238,13 @@ self.retrieveValueFromFrame = function retrieveValueFromFrame(args) { self.enableFlowOnThangSpell = function (thangID, spellID, userCodeMap) { try { - if (userCodeMap[thangID][spellID].originalOptions.includeFlow === true && - userCodeMap[thangID][spellID].originalOptions.noSerializationInFlow === true) + var options = userCodeMap[thangID][spellID].originalOptions; + if (options.includeFlow === true && options.noSerializationInFlow === true) return; else { - userCodeMap[thangID][spellID].originalOptions.includeFlow = true; - userCodeMap[thangID][spellID].originalOptions.noSerializationInFlow = true; + options.includeFlow = true; + options.noSerializationInFlow = true; var temporaryAether = Aether.deserialize(userCodeMap[thangID][spellID]); temporaryAether.transpile(temporaryAether.raw); userCodeMap[thangID][spellID] = temporaryAether.serialize(); diff --git a/app/lib/surface/Mark.coffee b/app/lib/surface/Mark.coffee index abf2b7fed..de27d01dd 100644 --- a/app/lib/surface/Mark.coffee +++ b/app/lib/surface/Mark.coffee @@ -20,6 +20,7 @@ module.exports = class Mark extends CocoClass @build() destroy: -> + createjs.Tween.removeTweens @mark @mark?.parent?.removeChild @mark @markSprite?.destroy() @sprite = null diff --git a/app/lib/world/world.coffee b/app/lib/world/world.coffee index 4dae55cb0..acdc62048 100644 --- a/app/lib/world/world.coffee +++ b/app/lib/world/world.coffee @@ -85,6 +85,12 @@ module.exports = class World frameToLoadUntil = @totalFrames i = @frames.length while i < frameToLoadUntil + if @debugging + for thang in @thangs when thang.isProgrammable + userCode = @userCodeMap[thang.id] ? {} + for methodName, aether of userCode + framesToLoadFlowBefore = if methodName is 'plan' then 200 else 1 # Adjust if plan() is taking even longer + aether._shouldSkipFlow = i < loadUntilFrame - framesToLoadFlowBefore try @getFrame(i) ++i # increment this after we have succeeded in getting the frame, otherwise we'll have to do that frame again diff --git a/app/views/play/level/tome/spell_debug_view.coffee b/app/views/play/level/tome/spell_debug_view.coffee index aa419c750..a8a03cbd7 100644 --- a/app/views/play/level/tome/spell_debug_view.coffee +++ b/app/views/play/level/tome/spell_debug_view.coffee @@ -34,40 +34,38 @@ module.exports = class DebugView extends View @cache = {} @lastFrameRequested = -1 @workerIsSimulating = false - + pad2: (num) -> if not num? or num is 0 then "00" else ((if num < 10 then "0" else "") + num) - + calculateCurrentTimeString: => time = @currentFrame / @frameRate - console.log "Current frame is",@currentFrame - console.log "Current framerate is",@frameRate mins = Math.floor(time / 60) secs = (time - mins * 60).toFixed(1) "#{mins}:#{@pad2 secs}" - - + + setTooltipKeyAndValue: (key, value) => message = "Time: #{@calculateCurrentTimeString()}\n#{key}: #{value}" @$el.find("code").text message @$el.show().css(@pos) - + setTooltipText: (text) => #perhaps changing styling here in the future @$el.find("code").text text @$el.show().css(@pos) - + onTomeCast: -> @invalidateCache() - + invalidateCache: -> @cache = {} - + retrieveValueFromCache: (thangID,spellID,variableChain,frame) -> joinedVariableChain = variableChain.join() value = @cache[frame]?[thangID]?[spellID]?[joinedVariableChain] return value ? undefined - + updateCache: (thangID, spellID, variableChain, frame, value) -> currentObject = @cache keys = [frame,thangID,spellID,variableChain.join()] @@ -77,8 +75,8 @@ module.exports = class DebugView extends View currentObject[key] = {} currentObject = currentObject[key] currentObject[keys[keys.length - 1]] = value - - + + changeCurrentThangAndSpell: (thangAndSpellObject) -> @thang = thangAndSpellObject.thang @spell = thangAndSpellObject.spell @@ -143,11 +141,11 @@ module.exports = class DebugView extends View onNewWorld: (e) -> @thang = @options.thang = e.world.thangMap[@thang.id] if @thang @frameRate = e.world.frameRate - + onFrameChanged: (data) -> @currentFrame = data.frame @frameRate = data.world.frameRate - + update: -> if @variableChain if @variableChain.length is 2 and @variableChain[0] is "this" @@ -173,7 +171,7 @@ module.exports = class DebugView extends View else @notifyPropertyHovered() @updateMarker() - + stringifyValue: (value, depth) -> return value if not value or _.isString value if _.isFunction value @@ -214,7 +212,7 @@ module.exports = class DebugView extends View @hoveredProperty = if @variableChain?.length is 2 then owner: @variableChain[0], property: @variableChain[1] else {} unless _.isEqual oldHoveredProperty, @hoveredProperty Backbone.Mediator.publish 'tome:spell-debug-property-hovered', @hoveredProperty - + updateMarker: -> if @marker @ace.getSession().removeMarker @marker