mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 14:03:28 -04:00
Re-enabled line-by-line highlighting through brute force for hero levels.
This commit is contained in:
parent
1108159603
commit
fcd174ed22
7 changed files with 28 additions and 15 deletions
app
lib
schemas/subscriptions
styles/play/level/tome
views/play/level/tome
|
@ -131,7 +131,9 @@ module.exports = class God extends CocoClass
|
|||
Backbone.Mediator.publish 'god:debug-world-load-progress-changed', progress: event.data.progress
|
||||
|
||||
onNewWorldCreated: (e) ->
|
||||
console.log 'filtering', _.cloneDeep e.world.userCodeMap
|
||||
@currentUserCodeMap = @filterUserCodeMapWhenFromWorld e.world.userCodeMap
|
||||
console.log ' ... filtered into', _.cloneDeep e.world.userCodeMap
|
||||
|
||||
filterUserCodeMapWhenFromWorld: (worldUserCodeMap) ->
|
||||
newUserCodeMap = {}
|
||||
|
|
|
@ -8,7 +8,7 @@ module.exports.createAetherOptions = (options) ->
|
|||
aetherOptions =
|
||||
functionName: options.functionName
|
||||
protectAPI: not options.skipProtectAPI
|
||||
includeFlow: false
|
||||
includeFlow: options.includeFlow
|
||||
yieldConditionally: options.functionName is 'plan'
|
||||
simpleLoops: true
|
||||
globals: ['Vector', '_']
|
||||
|
|
|
@ -442,7 +442,15 @@ module.exports = class World
|
|||
perf = {}
|
||||
perf.t0 = now()
|
||||
nFrames = endFrame - startFrame
|
||||
w = streamingWorld ? new World o.userCodeMap, classMap
|
||||
if streamingWorld
|
||||
w = streamingWorld
|
||||
# Make sure we get any Aether updates from the new frames into the already-deserialized streaming world Aethers.
|
||||
for thangID, methods of o.userCodeMap
|
||||
for methodName, serializedAether of methods
|
||||
for aetherStateKey in ['flow', 'metrics', 'style', 'problems']
|
||||
w.userCodeMap[thangID][methodName][aetherStateKey] = serializedAether[aetherStateKey]
|
||||
else
|
||||
w = new World o.userCodeMap, classMap
|
||||
[w.totalFrames, w.maxTotalFrames, w.frameRate, w.dt, w.scriptNotes, w.victory] = [o.totalFrames, o.maxTotalFrames, o.frameRate, o.dt, o.scriptNotes ? [], o.victory]
|
||||
w[prop] = val for prop, val of o.trackedProperties
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ module.exports =
|
|||
entry: {type: 'object'}
|
||||
|
||||
'tome:spell-statement-index-updated': c.object {title: 'Spell Statement Index Updated', description: 'Published when the spell index is updated', required: ['statementIndex', 'ace']},
|
||||
statementIndex: {type: 'object'}
|
||||
statementIndex: {type: 'integer'}
|
||||
ace: {type: 'object'}
|
||||
|
||||
'tome:spell-beautify': c.object {title: 'Beautify', description: 'Published when you click the \'beautify\' button', required: []},
|
||||
|
|
|
@ -17,8 +17,9 @@
|
|||
.spell-progress
|
||||
position: absolute
|
||||
height: 100%
|
||||
width: 40%
|
||||
left: 45%
|
||||
top: -50px
|
||||
width: 85%
|
||||
left: 10%
|
||||
display: inline-block
|
||||
cursor: pointer
|
||||
box-sizing: border-box
|
||||
|
|
|
@ -19,6 +19,7 @@ module.exports = class Spell
|
|||
@skipProtectAPI = options.skipProtectAPI
|
||||
@worker = options.worker
|
||||
@levelID = options.levelID
|
||||
@levelType = options.level.get('type', true)
|
||||
|
||||
p = options.programmableMethod
|
||||
@languages = p.languages ? {}
|
||||
|
@ -131,7 +132,7 @@ module.exports = class Spell
|
|||
aceConfig = me.get('aceConfig') ? {}
|
||||
writable = @permissions.readwrite.length > 0
|
||||
skipProtectAPI = @skipProtectAPI or not writable
|
||||
aetherOptions = createAetherOptions functionName: @name, codeLanguage: @language, functionParameters: @parameters, skipProtectAPI: skipProtectAPI
|
||||
aetherOptions = createAetherOptions functionName: @name, codeLanguage: @language, functionParameters: @parameters, skipProtectAPI: skipProtectAPI, includeFlow: @levelType is 'hero'
|
||||
aether = new Aether aetherOptions
|
||||
if @worker
|
||||
workerMessage =
|
||||
|
|
|
@ -605,18 +605,20 @@ module.exports = class SpellView extends CocoView
|
|||
@aceSession.removeGutterDecoration row, 'executing'
|
||||
@aceSession.removeGutterDecoration row, 'executed'
|
||||
@decoratedGutter[row] = ''
|
||||
if not executed.length or (@spell.name is 'plan' and @spellThang.castAether.metrics.statementsExecuted < 20)
|
||||
lastExecuted = _.last executed
|
||||
showToolbarView = executed.length and (@spell.name isnt 'plan' or @spellThang.castAether.metrics.statementsExecuted > 20)
|
||||
|
||||
if showToolbarView
|
||||
statementIndex = Math.max 0, lastExecuted.length - 1
|
||||
@toolbarView?.toggleFlow true
|
||||
@toolbarView?.setCallState states[currentCallIndex], statementIndex, currentCallIndex, @spellThang.castAether.metrics
|
||||
lastExecuted = lastExecuted[0 .. @toolbarView.statementIndex] if @toolbarView?.statementIndex?
|
||||
else
|
||||
@toolbarView?.toggleFlow false
|
||||
@debugView?.setVariableStates {}
|
||||
return
|
||||
lastExecuted = _.last executed
|
||||
@toolbarView?.toggleFlow true
|
||||
statementIndex = Math.max 0, lastExecuted.length - 1
|
||||
@toolbarView?.setCallState states[currentCallIndex], statementIndex, currentCallIndex, @spellThang.castAether.metrics
|
||||
marked = {}
|
||||
lastExecuted = lastExecuted[0 .. @toolbarView.statementIndex] if @toolbarView?.statementIndex?
|
||||
gotVariableStates = false
|
||||
for state, i in lastExecuted
|
||||
for state, i in lastExecuted ? []
|
||||
[start, end] = state.range
|
||||
clazz = if i is lastExecuted.length - 1 then 'executing' else 'executed'
|
||||
if clazz is 'executed'
|
||||
|
@ -705,7 +707,6 @@ module.exports = class SpellView extends CocoView
|
|||
@reloadCode true if wasDefault
|
||||
|
||||
onInsertSnippet: (e) ->
|
||||
console.log 'doc', e.doc, e.formatted
|
||||
snippetCode = null
|
||||
if e.doc.snippets?[e.language]?.code
|
||||
snippetCode = e.doc.snippets[e.language].code
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue