mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-02 08:53:38 -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
|
Backbone.Mediator.publish 'god:debug-world-load-progress-changed', progress: event.data.progress
|
||||||
|
|
||||||
onNewWorldCreated: (e) ->
|
onNewWorldCreated: (e) ->
|
||||||
|
console.log 'filtering', _.cloneDeep e.world.userCodeMap
|
||||||
@currentUserCodeMap = @filterUserCodeMapWhenFromWorld e.world.userCodeMap
|
@currentUserCodeMap = @filterUserCodeMapWhenFromWorld e.world.userCodeMap
|
||||||
|
console.log ' ... filtered into', _.cloneDeep e.world.userCodeMap
|
||||||
|
|
||||||
filterUserCodeMapWhenFromWorld: (worldUserCodeMap) ->
|
filterUserCodeMapWhenFromWorld: (worldUserCodeMap) ->
|
||||||
newUserCodeMap = {}
|
newUserCodeMap = {}
|
||||||
|
|
|
@ -8,7 +8,7 @@ module.exports.createAetherOptions = (options) ->
|
||||||
aetherOptions =
|
aetherOptions =
|
||||||
functionName: options.functionName
|
functionName: options.functionName
|
||||||
protectAPI: not options.skipProtectAPI
|
protectAPI: not options.skipProtectAPI
|
||||||
includeFlow: false
|
includeFlow: options.includeFlow
|
||||||
yieldConditionally: options.functionName is 'plan'
|
yieldConditionally: options.functionName is 'plan'
|
||||||
simpleLoops: true
|
simpleLoops: true
|
||||||
globals: ['Vector', '_']
|
globals: ['Vector', '_']
|
||||||
|
|
|
@ -442,7 +442,15 @@ module.exports = class World
|
||||||
perf = {}
|
perf = {}
|
||||||
perf.t0 = now()
|
perf.t0 = now()
|
||||||
nFrames = endFrame - startFrame
|
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.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
|
w[prop] = val for prop, val of o.trackedProperties
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ module.exports =
|
||||||
entry: {type: 'object'}
|
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']},
|
'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'}
|
ace: {type: 'object'}
|
||||||
|
|
||||||
'tome:spell-beautify': c.object {title: 'Beautify', description: 'Published when you click the \'beautify\' button', required: []},
|
'tome:spell-beautify': c.object {title: 'Beautify', description: 'Published when you click the \'beautify\' button', required: []},
|
||||||
|
|
|
@ -17,8 +17,9 @@
|
||||||
.spell-progress
|
.spell-progress
|
||||||
position: absolute
|
position: absolute
|
||||||
height: 100%
|
height: 100%
|
||||||
width: 40%
|
top: -50px
|
||||||
left: 45%
|
width: 85%
|
||||||
|
left: 10%
|
||||||
display: inline-block
|
display: inline-block
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
box-sizing: border-box
|
box-sizing: border-box
|
||||||
|
|
|
@ -19,6 +19,7 @@ module.exports = class Spell
|
||||||
@skipProtectAPI = options.skipProtectAPI
|
@skipProtectAPI = options.skipProtectAPI
|
||||||
@worker = options.worker
|
@worker = options.worker
|
||||||
@levelID = options.levelID
|
@levelID = options.levelID
|
||||||
|
@levelType = options.level.get('type', true)
|
||||||
|
|
||||||
p = options.programmableMethod
|
p = options.programmableMethod
|
||||||
@languages = p.languages ? {}
|
@languages = p.languages ? {}
|
||||||
|
@ -131,7 +132,7 @@ module.exports = class Spell
|
||||||
aceConfig = me.get('aceConfig') ? {}
|
aceConfig = me.get('aceConfig') ? {}
|
||||||
writable = @permissions.readwrite.length > 0
|
writable = @permissions.readwrite.length > 0
|
||||||
skipProtectAPI = @skipProtectAPI or not writable
|
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
|
aether = new Aether aetherOptions
|
||||||
if @worker
|
if @worker
|
||||||
workerMessage =
|
workerMessage =
|
||||||
|
|
|
@ -605,18 +605,20 @@ module.exports = class SpellView extends CocoView
|
||||||
@aceSession.removeGutterDecoration row, 'executing'
|
@aceSession.removeGutterDecoration row, 'executing'
|
||||||
@aceSession.removeGutterDecoration row, 'executed'
|
@aceSession.removeGutterDecoration row, 'executed'
|
||||||
@decoratedGutter[row] = ''
|
@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
|
@toolbarView?.toggleFlow false
|
||||||
@debugView?.setVariableStates {}
|
@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 = {}
|
marked = {}
|
||||||
lastExecuted = lastExecuted[0 .. @toolbarView.statementIndex] if @toolbarView?.statementIndex?
|
|
||||||
gotVariableStates = false
|
gotVariableStates = false
|
||||||
for state, i in lastExecuted
|
for state, i in lastExecuted ? []
|
||||||
[start, end] = state.range
|
[start, end] = state.range
|
||||||
clazz = if i is lastExecuted.length - 1 then 'executing' else 'executed'
|
clazz = if i is lastExecuted.length - 1 then 'executing' else 'executed'
|
||||||
if clazz is 'executed'
|
if clazz is 'executed'
|
||||||
|
@ -705,7 +707,6 @@ module.exports = class SpellView extends CocoView
|
||||||
@reloadCode true if wasDefault
|
@reloadCode true if wasDefault
|
||||||
|
|
||||||
onInsertSnippet: (e) ->
|
onInsertSnippet: (e) ->
|
||||||
console.log 'doc', e.doc, e.formatted
|
|
||||||
snippetCode = null
|
snippetCode = null
|
||||||
if e.doc.snippets?[e.language]?.code
|
if e.doc.snippets?[e.language]?.code
|
||||||
snippetCode = e.doc.snippets[e.language].code
|
snippetCode = e.doc.snippets[e.language].code
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue