mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-01 00:15:00 -04:00
Hide guide and select-a-thang message when not needed. Updated commonThisMethods. Restricted script IDs a bit.
This commit is contained in:
parent
7cbb5ac45d
commit
5c40f99d99
6 changed files with 10 additions and 6 deletions
app
schemas/models
templates/play/level
views/play/level
|
@ -149,7 +149,7 @@ ScriptSchema = c.object {
|
||||||
required: ['channel']
|
required: ['channel']
|
||||||
'default': {channel: 'world:won', noteChain: []}
|
'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".')
|
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
|
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']}
|
repeats: {title: 'Repeats', description: 'Whether this script can trigger more than once during a level.', enum: [true, false, 'session']}
|
||||||
|
|
|
@ -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-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
|
if spectateGame
|
||||||
button.btn.btn-xs.btn-inverse.banner#next-game-button(title="Next Game", data-i18n="play_level.next-game") Next game!
|
button.btn.btn-xs.btn-inverse.banner#next-game-button(title="Next Game", data-i18n="play_level.next-game") Next game!
|
||||||
|
|
|
@ -69,6 +69,8 @@ module.exports = class ControlBarView extends CocoView
|
||||||
c.multiplayerSession = @multiplayerSession if @multiplayerSession
|
c.multiplayerSession = @multiplayerSession if @multiplayerSession
|
||||||
c.multiplayerPlayers = @multiplayerPlayers if @multiplayerPlayers
|
c.multiplayerPlayers = @multiplayerPlayers if @multiplayerPlayers
|
||||||
c.meID = me.id
|
c.meID = me.id
|
||||||
|
docs = @level.get('documentation') ? {}
|
||||||
|
c.showsGuide = docs.specificArticles?.length or docs.generalArticles?.length
|
||||||
c
|
c
|
||||||
|
|
||||||
afterRender: ->
|
afterRender: ->
|
||||||
|
|
|
@ -85,7 +85,8 @@ module.exports = class LevelHUDView extends CocoView
|
||||||
clearTimeout @hintNextSelectionTimeout
|
clearTimeout @hintNextSelectionTimeout
|
||||||
@$el.find('.no-selection-message').hide()
|
@$el.find('.no-selection-message').hide()
|
||||||
if not @thang
|
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
|
return
|
||||||
@createAvatar thangType, @thang
|
@createAvatar thangType, @thang
|
||||||
@createProperties()
|
@createProperties()
|
||||||
|
|
|
@ -272,7 +272,7 @@ module.exports = class PlayLevelView extends RootView
|
||||||
@insertSubView new GoalsView {}
|
@insertSubView new GoalsView {}
|
||||||
@insertSubView new LevelFlagsView world: @world if @levelID is 'sky-span' # TODO: figure out when flags are available
|
@insertSubView new LevelFlagsView world: @world if @levelID is 'sky-span' # TODO: figure out when flags are available
|
||||||
@insertSubView new GoldView {}
|
@insertSubView new GoldView {}
|
||||||
@insertSubView new HUDView {}
|
@insertSubView new HUDView {level: @level}
|
||||||
@insertSubView new ChatView levelID: @levelID, sessionID: @session.id, session: @session
|
@insertSubView new ChatView levelID: @levelID, sessionID: @session.id, session: @session
|
||||||
worldName = utils.i18n @level.attributes, 'name'
|
worldName = utils.i18n @level.attributes, 'name'
|
||||||
@controlBar = @insertSubView new ControlBarView {worldName: worldName, session: @session, level: @level, supermodel: @supermodel}
|
@controlBar = @insertSubView new ControlBarView {worldName: worldName, session: @session, level: @level, supermodel: @supermodel}
|
||||||
|
|
|
@ -182,7 +182,7 @@ module.exports = class Spell
|
||||||
@updateLanguageAether e.codeLanguage
|
@updateLanguageAether e.codeLanguage
|
||||||
else
|
else
|
||||||
console.error 'Spell onNewOpponentCode did not receive code', e
|
console.error 'Spell onNewOpponentCode did not receive code', e
|
||||||
|
|
||||||
createProblemContext: (thang) ->
|
createProblemContext: (thang) ->
|
||||||
# Create problemContext Aether can use to craft better error messages
|
# 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)
|
# 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: [] }
|
@problemContext = { stringReferences: [], thisMethods: [], thisProperties: [] }
|
||||||
# TODO: These should be read from the database
|
# 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?
|
return @problemContext unless thang?
|
||||||
|
|
||||||
# Populate stringReferences
|
# Populate stringReferences
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue