diff --git a/app/lib/scripts/ScriptManager.coffee b/app/lib/scripts/ScriptManager.coffee index 69ef4427c..4fbcde254 100644 --- a/app/lib/scripts/ScriptManager.coffee +++ b/app/lib/scripts/ScriptManager.coffee @@ -49,6 +49,7 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass @originalScripts = options.scripts @view = options.view @session = options.session + @debugScripts = @view.getQueryVariable 'dev' @initProperties() @addScriptSubscriptions() @@ -146,7 +147,7 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass continue unless @scriptPrereqsSatisfied(script) continue unless scriptMatchesEventPrereqs(script, event) # everything passed! - console.log "SCRIPT: Running script '#{script.id}'" + console.log "SCRIPT: Running script '#{script.id}'" if @debugScripts script.lastTriggered = new Date().getTime() @triggered.push(script.id) unless alreadyTriggered noteChain = @processScript(script) @@ -206,7 +207,7 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass @notifyScriptStateChanged() @scriptInProgress = true @currentTimeouts = [] - console.log "SCRIPT: Starting note group '#{nextNoteGroup.name}'" + console.log "SCRIPT: Starting note group '#{nextNoteGroup.name}'" if @debugScripts for module in nextNoteGroup.modules @processNote(note, nextNoteGroup) for note in module.startNotes() if nextNoteGroup.script.duration @@ -220,7 +221,7 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass @ignoreEvents = true for noteGroup, i in @noteGroupQueue break unless noteGroup.skipMe - console.log "SCRIPT: Skipping note group '#{noteGroup.name}'" + console.log "SCRIPT: Skipping note group '#{noteGroup.name}'" if @debugScripts @processNoteGroup(noteGroup) for module in noteGroup.modules notes = module.skipNotes() @@ -267,7 +268,7 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass return if @ending # kill infinite loops right here @ending = true return unless @currentNoteGroup? - console.log "SCRIPT: Ending note group '#{@currentNoteGroup.name}'" + console.log "SCRIPT: Ending note group '#{@currentNoteGroup.name}'" if @debugScripts clearTimeout(timeout) for timeout in @currentTimeouts for module in @currentNoteGroup.modules @processNote(note, @currentNoteGroup) for note in module.endNotes() diff --git a/app/views/kinds/CocoView.coffee b/app/views/kinds/CocoView.coffee index 0c13c5f8d..780743391 100644 --- a/app/views/kinds/CocoView.coffee +++ b/app/views/kinds/CocoView.coffee @@ -196,12 +196,12 @@ module.exports = class CocoView extends Backbone.View # Utilities - getQueryVariable: (param) -> + getQueryVariable: (param, defaultValue) -> query = document.location.search.substring 1 pairs = (pair.split("=") for pair in query.split "&") - for pair in pairs - return decodeURIComponent(pair[1]) if pair[0] is param - null + for pair in pairs when pair[0] is param + return {"true": true, "false": false}[pair[1]] ? decodeURIComponent(pair[1]) + defaultValue getRootView: -> view = @ diff --git a/app/views/play/level/tome/tome_view.coffee b/app/views/play/level/tome/tome_view.coffee index 140336419..205b66ded 100644 --- a/app/views/play/level/tome/tome_view.coffee +++ b/app/views/play/level/tome/tome_view.coffee @@ -128,9 +128,9 @@ module.exports = class TomeView extends View spellKey = pathComponents.join '/' @thangSpells[thang.id].push spellKey unless method.cloneOf - skipProtectAPI = @getQueryVariable("skip_protect_api") is "true" or @options.levelID isnt 'brawlwood' - skipProtectAPI = false if @options.levelID is 'dungeon-arena' - skipFlow = @getQueryVariable("skip_flow") is "true" or @options.levelID is 'brawlwood' + skipProtectAPI = @getQueryVariable "skip_protect_api", not @options.ladderGame + skipFlow = @getQueryVariable "skip_flow", @options.levelID is 'brawlwood' + console.log 'skip protect api', skipProtectAPI, 'skip flow', skipFlow spell = @spells[spellKey] = new Spell programmableMethod: method, spellKey: spellKey, pathComponents: pathPrefixComponents.concat(pathComponents), session: @options.session, supermodel: @supermodel, skipFlow: skipFlow, skipProtectAPI: skipProtectAPI, worker: @worker for thangID, spellKeys of @thangSpells thang = world.getThangByID thangID