diff --git a/app/lib/LevelLoader.coffee b/app/lib/LevelLoader.coffee index ff7135f2d..df5b6b28d 100644 --- a/app/lib/LevelLoader.coffee +++ b/app/lib/LevelLoader.coffee @@ -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 diff --git a/app/lib/surface/CocoSprite.coffee b/app/lib/surface/CocoSprite.coffee index 0ce99bb5f..277f70497 100644 --- a/app/lib/surface/CocoSprite.coffee +++ b/app/lib/surface/CocoSprite.coffee @@ -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 diff --git a/app/models/Level.coffee b/app/models/Level.coffee index 31e4ebcd8..a08e814af 100644 --- a/app/models/Level.coffee +++ b/app/models/Level.coffee @@ -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 diff --git a/app/schemas/models/level_component.coffee b/app/schemas/models/level_component.coffee index 1bf647015..6a4b8fa72 100644 --- a/app/schemas/models/level_component.coffee +++ b/app/schemas/models/level_component.coffee @@ -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' diff --git a/app/templates/account/profile.jade b/app/templates/account/profile.jade index bbe9daba6..c18a85917 100644 --- a/app/templates/account/profile.jade +++ b/app/templates/account/profile.jade @@ -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 diff --git a/app/views/editor/level/components/NewLevelComponentModal.coffee b/app/views/editor/level/components/NewLevelComponentModal.coffee index a65b5c921..42db1c6e0 100644 --- a/app/views/editor/level/components/NewLevelComponentModal.coffee +++ b/app/views/editor/level/components/NewLevelComponentModal.coffee @@ -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