Hide guide and select-a-thang message when not needed. Updated commonThisMethods. Restricted script IDs a bit.

This commit is contained in:
Nick Winter 2014-10-14 22:38:22 -07:00
parent 7cbb5ac45d
commit 5c40f99d99
6 changed files with 10 additions and 6 deletions

View file

@ -149,7 +149,7 @@ ScriptSchema = c.object {
required: ['channel']
'default': {channel: 'world:won', noteChain: []}
},
id: c.shortString(title: 'ID', description: 'A unique ID that other scripts can rely on in their Happens After prereqs, for sequencing.') # uniqueness?
id: c.shortString(title: 'ID', description: 'A unique ID that other scripts can rely on in their Happens After prereqs, for sequencing.', pattern: '^[a-zA-Z 0-9:\'"_!-]+$') # uniqueness? Ideally this would be just ids-like-this but we have a lot of legacy data.
channel: c.shortString(title: 'Event', format: 'event-channel', description: 'Event channel this script might trigger for, like "world:won".')
eventPrereqs: c.array {title: 'Event Checks', description: 'Logical checks on the event for this script to trigger.', format: 'event-prereqs'}, EventPrereqSchema
repeats: {title: 'Repeats', description: 'Whether this script can trigger more than once during a level.', enum: [true, false, 'session']}

View file

@ -21,7 +21,8 @@ h4.title
button.btn.btn-xs.btn-inverse.banner#game-menu-button(title="Show game menu", data-i18n="play_level.game_menu") Game Menu
button.btn.btn-xs.btn-success.banner#docs-button(title="Show level instructions", data-i18n="play_level.guide") Guide
if showsGuide
button.btn.btn-xs.btn-success.banner#docs-button(title="Show level instructions", data-i18n="play_level.guide") Guide
if spectateGame
button.btn.btn-xs.btn-inverse.banner#next-game-button(title="Next Game", data-i18n="play_level.next-game") Next game!

View file

@ -69,6 +69,8 @@ module.exports = class ControlBarView extends CocoView
c.multiplayerSession = @multiplayerSession if @multiplayerSession
c.multiplayerPlayers = @multiplayerPlayers if @multiplayerPlayers
c.meID = me.id
docs = @level.get('documentation') ? {}
c.showsGuide = docs.specificArticles?.length or docs.generalArticles?.length
c
afterRender: ->

View file

@ -85,7 +85,8 @@ module.exports = class LevelHUDView extends CocoView
clearTimeout @hintNextSelectionTimeout
@$el.find('.no-selection-message').hide()
if not @thang
@hintNextSelectionTimeout = _.delay((=> @$el.find('.no-selection-message').slideDown('slow')), 10000)
unless @options.level.get('type', true) is 'hero'
@hintNextSelectionTimeout = _.delay((=> @$el.find('.no-selection-message').slideDown('slow')), 10000)
return
@createAvatar thangType, @thang
@createProperties()

View file

@ -272,7 +272,7 @@ module.exports = class PlayLevelView extends RootView
@insertSubView new GoalsView {}
@insertSubView new LevelFlagsView world: @world if @levelID is 'sky-span' # TODO: figure out when flags are available
@insertSubView new GoldView {}
@insertSubView new HUDView {}
@insertSubView new HUDView {level: @level}
@insertSubView new ChatView levelID: @levelID, sessionID: @session.id, session: @session
worldName = utils.i18n @level.attributes, 'name'
@controlBar = @insertSubView new ControlBarView {worldName: worldName, session: @session, level: @level, supermodel: @supermodel}

View file

@ -182,7 +182,7 @@ module.exports = class Spell
@updateLanguageAether e.codeLanguage
else
console.error 'Spell onNewOpponentCode did not receive code', e
createProblemContext: (thang) ->
# Create problemContext Aether can use to craft better error messages
# stringReferences: values that should be referred to as a string instead of a variable (e.g. "Brak", not Brak)
@ -195,7 +195,7 @@ module.exports = class Spell
@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']
@problemContext.commonThisMethods = ['moveRight', 'moveLeft', 'moveUp', 'moveDown', 'attack', 'findNearestEnemy', 'buildXY', 'moveXY', 'say', 'move', 'distance', 'findEnemies', 'getFriends', 'addFlag', 'getFlag', 'removeFlag', 'getFlags', 'attackRange', 'cast', 'buildTypes', 'jump', 'jumpTo', 'attackXY']
return @problemContext unless thang?
# Populate stringReferences