mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-17 19:12:33 -05:00
Fixes for loading level previews early, creating new Components, and showing names of ShowsNames Thangs.
This commit is contained in:
parent
687da38667
commit
1f71a1eaf9
6 changed files with 7 additions and 6 deletions
|
@ -202,7 +202,7 @@ module.exports = class LevelLoader extends CocoClass
|
|||
thangsToLoad = _.uniq( (t.spriteName for t in @world.thangs when t.exists) )
|
||||
nameModelTuples = ([thangType.get('name'), thangType] for thangType in @thangNames.models)
|
||||
nameModelMap = _.zipObject nameModelTuples
|
||||
@spriteSheetsToBuild = []
|
||||
@spriteSheetsToBuild ?= []
|
||||
|
||||
for thangTypeName in thangsToLoad
|
||||
thangType = nameModelMap[thangTypeName]
|
||||
|
@ -230,7 +230,7 @@ module.exports = class LevelLoader extends CocoClass
|
|||
|
||||
buildLoop: =>
|
||||
someLeft = false
|
||||
for spriteSheetResource, i in @spriteSheetsToBuild
|
||||
for spriteSheetResource, i in @spriteSheetsToBuild ? []
|
||||
continue if spriteSheetResource.spriteSheetKeys
|
||||
someLeft = true
|
||||
thangType = spriteSheetResource.thangType
|
||||
|
|
|
@ -79,6 +79,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
|||
@handledDisplayEvents = {}
|
||||
@age = 0
|
||||
@stillLoading = true
|
||||
@setNameLabel @thang.id if @thang?.showsName
|
||||
if @thangType.isFullyLoaded()
|
||||
@setUpSprite()
|
||||
else
|
||||
|
|
|
@ -186,7 +186,7 @@ module.exports = class Level extends CocoModel
|
|||
unless isPhysical
|
||||
originalComponent = $.extend true, {}, component
|
||||
component.config ?= {}
|
||||
TreemaUtils.populateDefaults(component.config, lc.configSchema, tv4)
|
||||
TreemaUtils.populateDefaults(component.config, lc.configSchema ? {}, tv4)
|
||||
@lastType = 'component'
|
||||
@lastOriginal = component.original
|
||||
unless isPhysical
|
||||
|
|
|
@ -102,7 +102,7 @@ DependencySchema = c.object {
|
|||
LevelComponentSchema = c.object {
|
||||
title: 'Component'
|
||||
description: 'A Component which can affect Thang behavior.'
|
||||
required: ['system', 'name', 'description', 'code', 'dependencies', 'propertyDocumentation', 'codeLanguage']
|
||||
required: ['system', 'name', 'code']
|
||||
default:
|
||||
system: 'ai'
|
||||
name: 'AttacksSelf'
|
||||
|
|
|
@ -177,7 +177,7 @@ block content
|
|||
if !editing && !myProfile
|
||||
button#contact-candidate.btn.btn-large.btn-inverse.flat-button
|
||||
span(data-i18n="account_profile.contact") Contact
|
||||
| #{profile.name.split(' ')[0]}
|
||||
| #{(profile.name || user.get('name') || 'Anonymous').split(' ')[0]}
|
||||
if me.isAdmin()
|
||||
select#admin-contact.form-control
|
||||
for contact in adminContacts
|
||||
|
|
|
@ -26,7 +26,7 @@ module.exports = class NewLevelComponentModal extends ModalView
|
|||
component = new LevelComponent()
|
||||
component.set 'system', system
|
||||
component.set 'name', name
|
||||
component.set 'code', component.get('code').replace(/AttacksSelf/g, name)
|
||||
component.set 'code', component.get('code', true).replace(/AttacksSelf/g, name)
|
||||
component.set 'permissions', [{access: 'owner', target: me.id}] # Private until saved in a published Level
|
||||
res = component.save()
|
||||
return unless res
|
||||
|
|
Loading…
Reference in a new issue