Fixed coordinate hover cursors fighting flag cursors. Added suspect code check functionality for scripts to slap hands.

This commit is contained in:
Nick Winter 2014-11-19 13:23:55 -08:00
parent 63c516c5f5
commit 0640f382ba
5 changed files with 38 additions and 12 deletions

View file

@ -10,6 +10,7 @@ module.exports = LevelOptions =
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots'}
restrictedGear: {feet: 'leather-boots'}
requiredCode: ['moveRight']
'gems-in-the-deep':
disableSpaces: true
hidesSubmitUntilRun: true
@ -71,6 +72,7 @@ module.exports = LevelOptions =
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', waist: 'leather-belt'}
restrictedGear: {feet: 'leather-boots'}
requiredCode: ['Brak']
'favorable-odds':
disableSpaces: true
hidesRunShortcut: true
@ -97,6 +99,7 @@ module.exports = LevelOptions =
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'programming-book': 'programmaticon-i'}
restrictedGear: {feet: 'leather-boots'}
requiredCode: ['loop']
'haunted-kithmaze':
hidesRunShortcut: true
hidesHUD: true
@ -105,6 +108,7 @@ module.exports = LevelOptions =
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'programming-book': 'programmaticon-i'}
restrictedGear: {feet: 'leather-boots'}
requiredCode: ['loop']
'descending-further':
hidesHUD: true
hidesSay: true
@ -140,6 +144,8 @@ module.exports = LevelOptions =
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses', torso: 'leather-tunic'}
restrictedGear: {feet: 'leather-boots'}
requiredCode: ['findNearestEnemy']
suspectCode: [{name: 'lone-find-nearest-enemy', pattern: /^[ ]*(self|this|@)?[:.]?findNearestEnemy()/m}]
'lowly-kithmen':
hidesHUD: true
hidesSay: true
@ -147,6 +153,8 @@ module.exports = LevelOptions =
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses', torso: 'leather-tunic'}
restrictedGear: {feet: 'leather-boots'}
requiredCode: ['findNearestEnemy']
suspectCode: [{name: 'lone-find-nearest-enemy', pattern: /^[ ]*(self|this|@)?[:.]?findNearestEnemy()/m}]
'closing-the-distance':
hidesHUD: true
hidesSay: true
@ -154,6 +162,7 @@ module.exports = LevelOptions =
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic', eyes: 'crude-glasses'}
restrictedGear: {feet: 'leather-boots'}
suspectCode: [{name: 'lone-find-nearest-enemy', pattern: /^[ ]*(self|this|@)?[:.]?findNearestEnemy()/m}]
'tactical-strike':
hidesHUD: true
hidesSay: true
@ -161,12 +170,14 @@ module.exports = LevelOptions =
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic', eyes: 'crude-glasses'}
restrictedGear: {feet: 'leather-boots'}
suspectCode: [{name: 'lone-find-nearest-enemy', pattern: /^[ ]*(self|this|@)?[:.]?findNearestEnemy()/m}]
'the-final-kithmaze':
hidesHUD: true
hidesSay: true
hidesCodeToolbar: true
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'}
suspectCode: [{name: 'lone-find-nearest-enemy', pattern: /^[ ]*(self|this|@)?[:.]?findNearestEnemy()/m}]
'the-gauntlet':
hidesHUD: true
hidesSay: true
@ -174,6 +185,7 @@ module.exports = LevelOptions =
hidesRealTimePlayback: true
requiredGear: {feet: 'simple-boots', 'right-hand': 'simple-sword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'}
restrictedGear: {feet: 'leather-boots'}
suspectCode: [{name: 'lone-find-nearest-enemy', pattern: /^[ ]*(self|this|@)?[:.]?findNearestEnemy()/m}]
'kithgard-gates':
hidesSay: true
hidesCodeToolbar: true

View file

@ -6,6 +6,7 @@ module.exports = class CoordinateDisplay extends createjs.Container
'surface:mouse-over': 'onMouseOver'
'surface:stage-mouse-down': 'onMouseDown'
'camera:zoom-updated': 'onZoomUpdated'
'level:flag-color-selected': 'onFlagColorSelected'
constructor: (options) ->
super()
@ -60,6 +61,9 @@ module.exports = class CoordinateDisplay extends createjs.Container
@hide()
@show()
onFlagColorSelected: (e) ->
@placingFlag = Boolean e.color
hide: ->
return unless @label.parent
@removeChild @label
@ -154,6 +158,6 @@ module.exports = class CoordinateDisplay extends createjs.Container
@y = sup.y
@addChild @background
@addChild @label
@addChild @pointMarker
@addChild @pointMarker unless @placingFlag
@updateCache()
Backbone.Mediator.publish 'surface:coordinates-shown', {}

View file

@ -122,6 +122,10 @@ module.exports =
'tome:required-code-fragment-deleted': c.object {title: 'Required Code Fragment Deleted', description: 'Published when a required code fragment is deleted from the sample code.', required: ['codeFragment']},
codeFragment: {type: 'string'}
'tome:suspect-code-fragment-added': c.object {title: 'Suspect Code Fragment Added', description: 'Published when a suspect code fragment is added to the sample code.', required: ['codeFragment']},
codeFragment: {type: 'string'}
codeLanguage: {type: 'string'}
'tome:winnability-updated': c.object {title: 'Winnability Updated', description: 'When we think we can now win (or can no longer win), we may want to emphasize the submit button versus the run button (or vice versa), so this fires when we get new goal states (even preloaded goal states) suggesting success or failure change.', required: ['winnable']},
winnable: {type: 'boolean'}

View file

@ -86,7 +86,7 @@ module.exports = class InventoryModal extends ModalView
locked = not (item.get('original') in me.items())
locked = false if me.get('slug') is 'nick'
if not item.getFrontFacingStats().props.length and not _.size item.getFrontFacingStats().stats # Temp: while there are placeholder items
if not item.getFrontFacingStats().props.length and not _.size(item.getFrontFacingStats().stats) and not locked # Temp: while there are placeholder items
null # Don't put into a collection
else if locked and item.get('slug') isnt 'simple-boots'
@itemGroups.lockedItems.add(item)

View file

@ -450,7 +450,8 @@ module.exports = class SpellView extends CocoView
_.throttle @updateLines, 500
_.throttle @hideProblemAlert, 500
]
onSignificantChange.push _.debounce @checkRequiredCode, 1500 if requiredCodePerLevel[@options.level.get('slug')]
onSignificantChange.push _.debounce @checkRequiredCode, 750 if LevelOptions[@options.level.get('slug')]?.requiredCode
onSignificantChange.push _.debounce @checkSuspectCode, 750 if LevelOptions[@options.level.get('slug')]?.suspectCode
@onCodeChangeMetaHandler = =>
return if @eventsSuppressed
Backbone.Mediator.publish 'audio-player:play-sound', trigger: 'code-change', volume: 0.5
@ -881,13 +882,26 @@ module.exports = class SpellView extends CocoView
checkRequiredCode: =>
return if @destroyed
source = @getSource().replace @singleLineCommentRegex(), ''
for requiredCodeFragment in requiredCodePerLevel[@options.level.get('slug')]
requiredCodeFragments = LevelOptions[@options.level.get('slug')].requiredCode
for requiredCodeFragment in requiredCodeFragments
# Could make this obey regular expressions like suspectCode if needed
if source.indexOf(requiredCodeFragment) is -1
@warnedCodeFragments ?= {}
unless @warnedCodeFragments[requiredCodeFragment]
Backbone.Mediator.publish 'tome:required-code-fragment-deleted', codeFragment: requiredCodeFragment
@warnedCodeFragments[requiredCodeFragment] = true
checkSuspectCode: =>
return if @destroyed
source = @getSource().replace @singleLineCommentRegex(), ''
suspectCodeFragments = LevelOptions[@options.level.get('slug')].suspectCode
for suspectCodeFragment in suspectCodeFragments
if suspectCodeFragment.pattern.test source
@warnedCodeFragments ?= {}
unless @warnedCodeFragments[suspectCodeFragment.name]
Backbone.Mediator.publish 'tome:suspect-code-fragment-added', codeFragment: suspectCodeFragment.name, codeLanguage: @spell.language
@warnedCodeFragments[suspectCodeFragment] = true
destroy: ->
$(@ace?.container).find('.ace_gutter').off 'click', '.ace_error, .ace_warning, .ace_info', @onAnnotationClick
$(@ace?.container).find('.ace_gutter').off 'click', @onGutterClick
@ -900,11 +914,3 @@ module.exports = class SpellView extends CocoView
@debugView?.destroy()
$(window).off 'resize', @onWindowResize
super()
requiredCodePerLevel =
'dungeons-of-kithgard': ['moveRight']
'true-names': ['Brak']
'the-first-kithmaze': ['loop']
'haunted-kithmaze': ['loop']
'lowly-kithmen': ['findNearestEnemy']