From fb7739727c7e3f6b82be7431be241e95b5ff1b47 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Tue, 28 Jan 2014 15:24:08 -0800 Subject: [PATCH] Updates for Aether's protectAPI stuff. --- app/lib/world/rectangle.coffee | 2 ++ app/lib/world/vector.coffee | 1 + app/views/play/level/tome/spell.coffee | 14 +++++++++++--- app/views/play/level/tome/tome_view.coffee | 2 +- bower.json | 2 +- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/lib/world/rectangle.coffee b/app/lib/world/rectangle.coffee index e439761df..f4f5400a4 100644 --- a/app/lib/world/rectangle.coffee +++ b/app/lib/world/rectangle.coffee @@ -8,6 +8,8 @@ class Rectangle Rectangle[name] = (a, b) -> a.copy()[name](b) + apiProperties: ['x', 'y', 'width', 'height', 'rotation', 'getPos', 'vertices', 'touchesRect', 'touchesPoint', 'distanceToPoint', 'containsPoint', 'copy'] + constructor: (@x=0, @y=0, @width=0, @height=0, @rotation=0) -> copy: -> diff --git a/app/lib/world/vector.coffee b/app/lib/world/vector.coffee index c067a83f7..93ac08e1f 100644 --- a/app/lib/world/vector.coffee +++ b/app/lib/world/vector.coffee @@ -8,6 +8,7 @@ class Vector a.copy()[name](b, useZ) isVector: true + apiProperties: ['x', 'y', 'z', 'magnitude', 'heading', 'distance', 'dot', 'equals', 'copy'] constructor: (@x=0, @y=0, @z=0) -> diff --git a/app/views/play/level/tome/spell.coffee b/app/views/play/level/tome/spell.coffee index 1757ae8c9..19f2416ee 100644 --- a/app/views/play/level/tome/spell.coffee +++ b/app/views/play/level/tome/spell.coffee @@ -7,8 +7,15 @@ module.exports = class Spell view: null entryView: null - constructor: (programmableMethod, @spellKey, @pathComponents, @session, @supermodel) -> - p = programmableMethod + constructor: (options) -> + @spellKey = options.spellKey + @pathComponents = options.pathComponents + @session = options.session + @supermodel = options.supermodel + @skipFlow = options.skipFlow + @skipProtectAPI = options.skipProtectAPI + p = options.programmableMethod + @name = p.name @source = @session.getSourceFor(@spellKey) ? p.source @originalSource = p.source @@ -63,7 +70,8 @@ module.exports = class Spell functionParameters: @parameters yieldConditionally: thang.plan? requiresThis: thang.requiresThis - includeFlow: true + protectAPI: not (@skipProtectAPI or window.currentView?.level.get('name').match("Gridmancer")) + includeFlow: not @skipFlow #callIndex: 0 #timelessVariables: ['i'] #statementIndex: 9001 diff --git a/app/views/play/level/tome/tome_view.coffee b/app/views/play/level/tome/tome_view.coffee index b34be2243..c7acd31a5 100644 --- a/app/views/play/level/tome/tome_view.coffee +++ b/app/views/play/level/tome/tome_view.coffee @@ -82,7 +82,7 @@ module.exports = class TomeView extends View spellKey = pathComponents.join '/' @thangSpells[thang.id].push spellKey unless method.cloneOf - spell = @spells[spellKey] = new Spell method, spellKey, pathPrefixComponents.concat(pathComponents), @options.session, @supermodel + spell = @spells[spellKey] = new Spell programmableMethod: method, spellKey: spellKey, pathComponents: pathPrefixComponents.concat(pathComponents), session: @options.session, supermodel: @supermodel, skipFlow: @getQueryVariable("skip_flow") is "true", skipProtectAPI: @getQueryVariable("skip_protect_api") is "true" for thangID, spellKeys of @thangSpells thang = world.getThangByID(thangID) @spells[spellKey].addThang thang for spellKey in spellKeys diff --git a/bower.json b/bower.json index 47ce4555c..c89a39fa9 100644 --- a/bower.json +++ b/bower.json @@ -32,7 +32,7 @@ "firepad": "~0.1.2", "marked": "~0.3.0", "moment": "~2.5.0", - "aether": "~0.0.7", + "aether": "~0.0.9", "underscore.string": "~2.3.3", "firebase": "~1.0.2" },