mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-31 07:12:49 -04:00
Added heroClass and gem fields to the ThangTypes, and a new Hero kind. Fixed adding new ThangType properties in the Thang Editor.
This commit is contained in:
parent
a123fb4b08
commit
98fe639010
3 changed files with 13 additions and 5 deletions
app
server/levels/thangs
|
@ -105,9 +105,10 @@ _.extend ThangTypeSchema.properties,
|
|||
shapes: c.object {title: 'Shapes', additionalProperties: ShapeObjectSchema}
|
||||
containers: c.object {title: 'Containers', additionalProperties: ContainerObjectSchema}
|
||||
animations: c.object {title: 'Animations', additionalProperties: RawAnimationObjectSchema}
|
||||
kind: c.shortString {enum: ['Unit', 'Floor', 'Wall', 'Doodad', 'Misc', 'Mark', 'Item'], default: 'Misc', title: 'Kind'}
|
||||
kind: c.shortString {enum: ['Unit', 'Floor', 'Wall', 'Doodad', 'Misc', 'Mark', 'Item', 'Hero'], default: 'Misc', title: 'Kind'}
|
||||
terrains: c.array {title: 'Terrains', description: 'If specified, limits this ThangType to levels with matching terrains.', uniqueItems: true}, c.terrainString
|
||||
|
||||
gems: {type: 'integer', minimum: 0, title: 'Gem Cost', description: 'How many gems this item or hero costs.'}
|
||||
heroClass: {type: 'string', enum: ['Warrior', 'Ranger', 'Wizard'], title: 'Hero Class', description: 'What class this is (if a hero) or is restricted to (if an item). Leave undefined for most items.'}
|
||||
actions: c.object {title: 'Actions', additionalProperties: {$ref: '#/definitions/action'}}
|
||||
soundTriggers: c.object {title: 'Sound Triggers', additionalProperties: c.array({}, {$ref: '#/definitions/sound'})},
|
||||
say: c.object {format: 'slug-props', additionalProperties: {$ref: '#/definitions/sound'}},
|
||||
|
|
|
@ -354,7 +354,7 @@ module.exports = class ThangTypeEditView extends RootView
|
|||
newThangType = if e.major then @thangType.cloneNewMajorVersion() else @thangType.cloneNewMinorVersion()
|
||||
newThangType.set('commitMessage', e.commitMessage)
|
||||
newThangType.updateI18NCoverage() if newThangType.get('i18nCoverage')
|
||||
|
||||
|
||||
res = newThangType.save()
|
||||
return unless res
|
||||
modal = $('#save-version-modal')
|
||||
|
@ -406,9 +406,14 @@ module.exports = class ThangTypeEditView extends RootView
|
|||
|
||||
pushChangesToPreview: =>
|
||||
return if @temporarilyIgnoringChanges
|
||||
keysProcessed = {}
|
||||
for key of @thangType.attributes
|
||||
keysProcessed[key] = true
|
||||
continue if key is 'components'
|
||||
@thangType.set(key, @treema.data[key])
|
||||
for key, value of @treema.data when not keysProcessed[key]
|
||||
@thangType.set(key, value)
|
||||
|
||||
@updateSelectBox()
|
||||
@refreshAnimation()
|
||||
@updateDots()
|
||||
|
|
|
@ -38,6 +38,8 @@ ThangTypeHandler = class ThangTypeHandler extends Handler
|
|||
'i18nCoverage'
|
||||
'i18n'
|
||||
'description'
|
||||
'gems'
|
||||
'heroClass'
|
||||
]
|
||||
|
||||
hasAccess: (req) ->
|
||||
|
@ -45,7 +47,7 @@ ThangTypeHandler = class ThangTypeHandler extends Handler
|
|||
|
||||
hasAccessToDocument: (req, document, method=null) ->
|
||||
method = (method or req.method).toLowerCase()
|
||||
return true if method is 'get'
|
||||
return true if method is 'get'
|
||||
return true if req.user?.isAdmin()
|
||||
return true if method is 'put' and @isJustFillingTranslations(req, document)
|
||||
return
|
||||
|
@ -63,7 +65,7 @@ ThangTypeHandler = class ThangTypeHandler extends Handler
|
|||
query.original = {$in: _.values heroes} # TODO: replace with some sort of ThangType property later
|
||||
else if req.query.view is 'i18n-coverage'
|
||||
query.i18nCoverage = {$exists: true}
|
||||
|
||||
|
||||
q = ThangType.find(query, projection)
|
||||
skip = parseInt(req.query.skip)
|
||||
if skip? and skip < 1000000
|
||||
|
|
Loading…
Add table
Reference in a new issue