SpecificArticleSchema.properties.body = {type: 'string',title: 'Content',description: 'The body content of the article, in Markdown.',format: 'markdown'}
SpecificArticleSchema.properties.i18n = {type: 'object',format: 'i18n',props: ['name','body'],description: 'Help translate this article'}
EventPrereqSchema = c.object{title: 'Event Prerequisite',format: 'event-prereq',description: 'Script requires that the value of some property on the event triggering it to meet some prerequisite.',required: ['eventProps']},
eventProps: c.array{'default':['thang'],format: 'event-value-chain',maxItems: 10,title: 'Event Property',description: 'A chain of keys in the event, like "thang.pos.x" to access event.thang.pos.x.'},c.shortString(title: 'Property',description: 'A key in the event property key chain.')
equalTo: c.object{type: eventPrereqValueTypes,title: '==',description: 'Script requires the event\'s property chain value to be equal to this value.'}
notEqualTo: c.object{type: eventPrereqValueTypes,title: '!=',description: 'Script requires the event\'s property chain value to *not* be equal to this value.'}
greaterThan: {type: 'number',title: '>',description: 'Script requires the event\'s property chain value to be greater than this value.'}
greaterThanOrEqualTo: {type: 'number',title: '>=',description: 'Script requires the event\'s property chain value to be greater or equal to this value.'}
lessThan: {type: 'number',title: '<',description: 'Script requires the event\'s property chain value to be less than this value.'}
lessThanOrEqualTo: {type: 'number',title: '<=',description: 'Script requires the event\'s property chain value to be less than or equal to this value.'}
containingString: c.shortString(title: 'Contains',description: 'Script requires the event\'s property chain value to be a string containing this string.')
notContainingString: c.shortString(title: 'Does not contain',description: 'Script requires the event\'s property chain value to *not* be a string containing this string.')
containingRegexp: c.shortString(title: 'Contains Regexp',description: 'Script requires the event\'s property chain value to be a string containing this regular expression.')
notContainingRegexp: c.shortString(title: 'Does not contain regexp',description: 'Script requires the event\'s property chain value to *not* be a string containing this regular expression.')
worldEndsAfter: {title: 'World Ends After',description: 'When included, ends the world this many seconds after this goal succeeds or fails.',type: 'number',minimum: 0,exclusiveMinimum: true,maximum: 300,default: 3}
howMany: {title: 'How Many',description: 'When included, require only this many of the listed goal targets instead of all of them.',type: 'integer',minimum: 1}
hiddenGoal: {title: 'Hidden',description: 'Hidden goals don\'t show up in the goals area for the player until they\'re failed. (Usually they\'re obvious, like "don\'t die".)','type':'boolean'}
killThangs: c.array{title: 'Kill Thangs',description: 'A list of Thang IDs the player should kill, or team names.',uniqueItems: true,minItems: 1,'default':['ogres']},thang
saveThangs: c.array{title: 'Save Thangs',description: 'A list of Thang IDs the player should save, or team names',uniqueItems: true,minItems: 1,'default':['Hero Placeholder']},thang
getToLocations: c.object{title: 'Get To Locations',description: 'Will be set off when any of the \"who\" touch any of the \"targets\"',required: ['who','targets']},
who: c.array{title: 'Who',description: 'The Thangs who must get to the target locations.',minItems: 1},thang
targets: c.array{title: 'Targets',description: 'The target locations to which the Thangs must get.',minItems: 1},thang
getAllToLocations: c.array{title: 'Get all to locations',description: 'Similar to getToLocations but now a specific \"who\" can have a specific \"target\", also must be used with the HowMany property for desired effect',required: ['getToLocation']},
c.object{title: '',description: ''},
getToLocation: c.object{title: 'Get To Locations',description: 'TODO: explain',required: ['who','targets']},
who: c.array{title: 'Who',description: 'The Thangs who must get to the target locations.',minItems: 1},thang
targets: c.array{title: 'Targets',description: 'The target locations to which the Thangs must get.',minItems: 1},thang
keepFromLocations: c.object{title: 'Keep From Locations',description: 'TODO: explain',required: ['who','targets']},
who: c.array{title: 'Who',description: 'The Thangs who must not get to the target locations.',minItems: 1},thang
targets: c.array{title: 'Targets',description: 'The target locations to which the Thangs must not get.',minItems: 1},thang
keepAllFromLocations: c.array{title: 'Keep ALL From Locations',description: 'Similar to keepFromLocations but now a specific \"who\" can have a specific \"target\", also must be used with the HowMany property for desired effect',required: ['keepFromLocation']},
c.object{title: '',description: ''},
keepFromLocation: c.object{title: 'Keep From Locations',description: 'TODO: explain',required: ['who','targets']},
who: c.array{title: 'Who',description: 'The Thangs who must not get to the target locations.',minItems: 1},thang
targets: c.array{title: 'Targets',description: 'The target locations to which the Thangs must not get.',minItems: 1},thang
leaveOffSides: c.object{title: 'Leave Off Sides',description: 'Sides of the level to get some Thangs to leave across.',required: ['who','sides']},
who: c.array{title: 'Who',description: 'The Thangs which must leave off the sides of the level.',minItems: 1},thang
sides: c.array{title: 'Sides',description: 'The sides off which the Thangs must leave.',minItems: 1},side
keepFromLeavingOffSides: c.object{title: 'Keep From Leaving Off Sides',description: 'Sides of the level to keep some Thangs from leaving across.',required: ['who','sides']},
who: c.array{title: 'Who',description: 'The Thangs which must not leave off the sides of the level.',minItems: 1},thang
sides: side,{title: 'Sides',description: 'The sides off which the Thangs must not leave.',minItems: 1},side
collectThangs: c.object{title: 'Collect',description: 'Thangs that other Thangs must collect.',required: ['who','targets']},
who: c.array{title: 'Who',description: 'The Thangs which must collect the target items.',minItems: 1},thang
targets: c.array{title: 'Targets',description: 'The target items which the Thangs must collect.',minItems: 1},thang
keepFromCollectingThangs: c.object{title: 'Keep From Collecting',description: 'Thangs that the player must prevent other Thangs from collecting.',required: ['who','targets']},
who: c.array{title: 'Who',description: 'The Thangs which must not collect the target items.',minItems: 1},thang
targets: c.array{title: 'Targets',description: 'The target items which the Thangs must not collect.',minItems: 1},thang
codeProblems: c.array{title: 'Code Problems',description: 'A list of Thang IDs that should not have any code problems, or team names.',uniqueItems: true,minItems: 1,'default':['humans']},thang
linesOfCode: {title: 'Lines of Code',description: 'A mapping of Thang IDs or teams to how many many lines of code should be allowed (well, statements).',type: 'object',default: {humans: 10},additionalProperties: {type: 'integer',description: 'How many lines to allow for this Thang.'}}
html: c.object{title: 'HTML',description: 'A jQuery selector and what its result should be'},
selector: {type: 'string',description: 'jQuery selector to run on the user HTML, like "h1:first-child"'}
valueChecks: c.array{title: 'Value checks',description: 'Logical checks on the resulting value for this goal to pass.',format: 'event-prereqs'},EventPrereqSchema
channel: c.shortString(title: 'Channel',format: 'event-channel',description: 'Channel that this event will be broadcast over, like "level:set-playing".')
SpriteCommandSchema = c.object{title: 'Thang Command',description: 'Make a target Thang move or say something, or select/deselect it.',required: ['id'],default: {id: 'Hero Placeholder'}},
mood: c.shortString(title: 'Mood',description: 'The mood with which the Thang speaks.','enum':['explain','debrief','congrats','attack','joke','tip','alarm'])
preload: {title: 'Preload',description: 'Whether to load this sound file before the level can begin (typically for the first dialogue of a level).',type: 'boolean'}
move: c.object{title: 'Move',description: 'Tell the Thang to move.',required: ['target'],default: {target: {},duration: 500}},
target: _.extend_.cloneDeep(PointSchema),{title: 'Target',description: 'Target point to which the Thang will move.',default: {x: 20,y: 20}}
duration: {title: 'Duration',description: 'Number of milliseconds over which to move, or 0 for an instant move.',type: 'integer',minimum: 0,format: 'milliseconds'}
NoteGroupSchema = c.object{title: 'Note Group',description: 'A group of notes that should be sent out as a result of this script triggering.',displayProperty: 'name'},
name: {title: 'Name',description: 'Short name describing the script, like \"Anya greets the player\", for your convenience.',type: 'string'}
dom: c.object{title: 'DOM',description: 'Manipulate things in the play area DOM, outside of the level area canvas.'},
focus: c.shortString(title: 'Focus',description: 'Set the window focus to this DOM selector string.')
highlight: c.object{title: 'Highlight',description: 'Highlight the target DOM selector string with a big arrow.'},
target: c.shortString(title: 'Target',description: 'Target highlight element DOM selector string.')
delay: {type: 'integer',minimum: 0,title: 'Delay',description: 'Show the highlight after this many milliseconds. Doesn\'t affect the dim shade cutout highlight method.'}
rotation: {type: 'number',minimum: 0,title: 'Rotation',description: 'Rotation of the pointing arrow, in radians. PI / 2 points left, PI points up, etc.',format: 'radians'}
sides: c.array{title: 'Sides',description: 'Which sides of the target element to point at.'},{type: 'string','enum':['left','right','top','bottom'],title: 'Side',description: 'A side of the target element to point at.'}
lock: {title: 'Lock',description: 'Whether the interface should be locked so that the player\'s focus is on the script, or specific areas to lock.',type: ['boolean','array'],items: {type: 'string',enum: ['surface','editor','palette','hud','playback','playback-hover','level']}}
letterbox: {type: 'boolean',title: 'Letterbox',description: 'Turn letterbox mode on or off. Disables surface and playback controls.'}
script: c.object{title: 'Script',description: 'Extra configuration for this action group.'},
duration: {type: 'integer',minimum: 0,title: 'Duration',description: 'How long this script should last in milliseconds. 0 for indefinite.',format: 'milliseconds'}
skippable: {type: 'boolean',title: 'Skippable',description: 'Whether this script shouldn\'t bother firing when the player skips past all current scripts.'}
beforeLoad: {type: 'boolean',title: 'Before Load',description: 'Whether this script should fire before the level is finished loading.'}
sound: c.object{title: 'Sound',description: 'Commands to control sound playback.'},
suppressSelectionSounds: {type: 'boolean',title: 'Suppress Selection Sounds',description: 'Whether to suppress selection sounds made from clicking on Thangs.'}
music: c.object{title: 'Music',description: 'Control music playing'},
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
thangType: c.objectId(links: [{rel: 'db',href: '/db/thang.type/{($)}/version'}],title: 'Thang Type',description: 'A reference to the original Thang template being configured.',format: 'thang-type')
components: c.array{title: 'Components',description: 'Thangs are configured by changing the Components attached to them.',uniqueItems: true,format: 'thang-components-array'},ThangComponentSchema# TODO: uniqueness should be based on 'original', not whole thing
majorVersion: {title: 'Major Version',description: 'Which major version of the Article is being used.',type: 'integer',minimum: 0}#, format: 'hidden'} # hidden?
specificArticles: c.array{title: 'Specific Articles',description: 'Specific documentation articles that live only in this level.',uniqueItems: true},SpecificArticleSchema
generalArticles: c.array{title: 'General Articles',description: 'General documentation articles that can be linked from multiple levels.',uniqueItems: true},GeneralArticleSchema
scripts: c.array{title: 'Scripts',description: 'An array of scripts that trigger based on what the player does and affect things outside of the core level simulation.'},ScriptSchema
thangs: c.array{title: 'Thangs',description: 'An array of Thangs that make up the level.'},LevelThangSchema
systems: c.array{title: 'Systems',description: 'Levels are configured by changing the Systems attached to them.',uniqueItems: true},LevelSystemSchema# TODO: uniqueness should be based on 'original', not whole thing
victory: c.object{title: 'Victory Screen'},{
body: {type: 'string',format: 'markdown',title: 'Body Text',description: 'Inserted into the Victory Modal once this level is complete. Tell the player they did a good job and what they accomplished!'},
i18n: {type: 'object',format: 'i18n',props: ['body'],description: 'Help translate this victory message'}
type: c.shortString(title: 'Type',description: 'What kind of level this is.','enum':['campaign','ladder','ladder-tutorial','hero','hero-ladder','hero-coop','course','course-ladder','game-dev','web-dev'])
replayable: {type: 'boolean',title: 'Replayable',description: 'Whether this (hero) level infinitely scales up its difficulty and can be beaten over and over for greater rewards.'}
shareable: {title: 'Shareable',type: ['string','boolean'],enum: [false,true,'project'],description: 'Whether the level is not shareable, shareable, or a sharing-encouraged project level.'}
campaign: c.shortStringtitle: 'Campaign',description: 'Which campaign this level is part of (like "desert").',format: 'hidden'# Automatically set by campaign editor.
campaignIndex: c.inttitle: 'Campaign Index',description: 'The 0-based index of this level in its campaign.',format: 'hidden'# Automatically set by campaign editor.
c.shortString(title: 'Score Type','enum':['time','damage-taken','damage-dealt','gold-collected','difficulty'])# TODO: good version of LoC; total gear value.