Pass common 'this' methods to Aether
This commit is contained in:
parent
ce14f92979
commit
7cbb5ac45d
2 changed files with 4 additions and 1 deletions
app/views/play/level/tome
|
@ -188,11 +188,14 @@ module.exports = class Spell
|
||||||
# stringReferences: values that should be referred to as a string instead of a variable (e.g. "Brak", not Brak)
|
# stringReferences: values that should be referred to as a string instead of a variable (e.g. "Brak", not Brak)
|
||||||
# thisMethods: methods available on the 'this' object
|
# thisMethods: methods available on the 'this' object
|
||||||
# thisProperties: properties available on the 'this' object
|
# thisProperties: properties available on the 'this' object
|
||||||
|
# commonThisMethods: methods that are available sometimes, but not awlays
|
||||||
|
|
||||||
# NOTE: Assuming the first createProblemContext call has everything we need, and we'll use that forevermore
|
# NOTE: Assuming the first createProblemContext call has everything we need, and we'll use that forevermore
|
||||||
return @problemContext if @problemContext?
|
return @problemContext if @problemContext?
|
||||||
|
|
||||||
@problemContext = { stringReferences: [], thisMethods: [], thisProperties: [] }
|
@problemContext = { stringReferences: [], thisMethods: [], thisProperties: [] }
|
||||||
|
# TODO: These should be read from the database
|
||||||
|
@problemContext.commonThisMethods = ['moveRight', 'moveLeft', 'moveUp', 'moveDown', 'attackNearbyEnemy', 'say', 'move', 'attackNearestEnemy', 'shootAt', 'rotateTo', 'shoot', 'distance', 'getNearestEnemy', 'getEnemies', 'attack', 'setAction', 'setTarget', 'getFriends', 'patrol']
|
||||||
return @problemContext unless thang?
|
return @problemContext unless thang?
|
||||||
|
|
||||||
# Populate stringReferences
|
# Populate stringReferences
|
||||||
|
|
|
@ -477,7 +477,7 @@ module.exports = class SpellView extends CocoView
|
||||||
endOfLine = cursorPosition.column >= currentLine.length # just typed a semicolon or brace, for example
|
endOfLine = cursorPosition.column >= currentLine.length # just typed a semicolon or brace, for example
|
||||||
beginningOfLine = not currentLine.substr(0, cursorPosition.column).trim().length # uncommenting code, for example
|
beginningOfLine = not currentLine.substr(0, cursorPosition.column).trim().length # uncommenting code, for example
|
||||||
incompleteThis = /^(s|se|sel|self|t|th|thi|this)$/.test currentLine.trim()
|
incompleteThis = /^(s|se|sel|self|t|th|thi|this)$/.test currentLine.trim()
|
||||||
#console.log 'finished?', valid, endOfLine, beginningOfLine, cursorPosition, currentLine.length, aether, new Date() - 0, currentLine
|
# console.log "finished=#{valid and (endOfLine or beginningOfLine) and not incompleteThis}", valid, endOfLine, beginningOfLine, incompleteThis, cursorPosition, currentLine.length, aether, new Date() - 0, currentLine
|
||||||
if valid and (endOfLine or beginningOfLine) and not incompleteThis
|
if valid and (endOfLine or beginningOfLine) and not incompleteThis
|
||||||
if @autocastDelay > 60000
|
if @autocastDelay > 60000
|
||||||
@preload()
|
@preload()
|
||||||
|
|
Reference in a new issue