This commit is contained in:
Szabolcs Gelencser 2015-02-26 23:42:37 +01:00
parent 8b721a7c47
commit b138001205

View file

@ -58,6 +58,53 @@ module.exports = class SpellView extends CocoView
events:
'mouseout': 'onMouseOut'
max_expected_player_levels:
'Dungeons of Kithgard': 5
'Gems in the Deep': 6
'Shadow Guard': 6
'Signs And Portents': 7
'Kounter Kithwise': 7
'Crawlways of Kithgard': 7
'Enemy Mine': 7
'Illusory Interruption': 4
'Forgetful Gemsmith': 7
'True Names': 8
'Favorable Odds': 8
'The Prisoner': 8
'Banefire': 8
'The Raised Sword': 9
'Haunted Kithmaze': 9
'Riddling Kithmaze': 9
'Descending Further': 9
'The Second Kithmaze': 10
'Dread Door': 10
'Cupboards of Kithgard': 10
'Hack and Dash': 10
'Breakout': 10
'Known Enemy': 11
'Master of Names': 11
'Lowly Kithmen': 12
'Dueling Grounds': 12
'Closing the Distance': 12
'Tactical Strike': 12
'The Final Kithmaze': 13
'The Gauntlet': 13
'Radiant Aura': 13
'Kithgard Gates': 13
'Destroying Angel': 13
'Kithgard Brawl': 13
'Defense of Plainswood': 4
'Winding Trail': 4
'Thumb Biter': 4
'Gems or Death': 5
'Backwoods Ambush': 5
'Patrol Buster': 5
'Endangered Burl': 5
'Village Guard': 5
'Thornbush Farm': 6
'Back to Back': 6
'Storming the Towers of Areth': 6
constructor: (options) ->
super options
@worker = options.worker
@ -220,7 +267,8 @@ module.exports = class SpellView extends CocoView
name: 'disable-spaces'
bindKey: 'Space'
exec: =>
return @ace.execCommand 'insertstring', ' ' unless @options.level.get 'disableSpaces'
if me.level() > @max_expected_player_levels[@options.level.get 'name'] or @options.level.get('disableSpaces') is false
return @ace.execCommand 'insertstring', ' '
line = @aceDoc.getLine @ace.getCursorPosition().row
return @ace.execCommand 'insertstring', ' ' if @singleLineCommentRegex().test line
@ -259,7 +307,8 @@ module.exports = class SpellView extends CocoView
lockDefaultCode: (force=false) ->
# TODO: Lock default indent for an empty line?
return unless @options.level.get('lockDefaultCode')
if me.level() > @max_expected_player_levels[@options.level.get 'name'] or @options.level.get('lockDefaultCode') is false
return
return unless @spell.source is @spell.originalSource or force
console.info 'Locking down default code.'