Updates for Aether's protectAPI stuff.

This commit is contained in:
Nick Winter 2014-01-28 15:24:08 -08:00
parent a82a6a4188
commit fb7739727c
5 changed files with 16 additions and 5 deletions

View file

@ -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: ->

View file

@ -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) ->

View file

@ -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

View file

@ -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

View file

@ -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"
},