Fixes for loading level previews early, creating new Components, and showing names of ShowsNames Thangs.

This commit is contained in:
Nick Winter 2014-09-16 20:19:52 -07:00
parent 687da38667
commit 1f71a1eaf9
6 changed files with 7 additions and 6 deletions

View file

@ -202,7 +202,7 @@ module.exports = class LevelLoader extends CocoClass
thangsToLoad = _.uniq( (t.spriteName for t in @world.thangs when t.exists) ) thangsToLoad = _.uniq( (t.spriteName for t in @world.thangs when t.exists) )
nameModelTuples = ([thangType.get('name'), thangType] for thangType in @thangNames.models) nameModelTuples = ([thangType.get('name'), thangType] for thangType in @thangNames.models)
nameModelMap = _.zipObject nameModelTuples nameModelMap = _.zipObject nameModelTuples
@spriteSheetsToBuild = [] @spriteSheetsToBuild ?= []
for thangTypeName in thangsToLoad for thangTypeName in thangsToLoad
thangType = nameModelMap[thangTypeName] thangType = nameModelMap[thangTypeName]
@ -230,7 +230,7 @@ module.exports = class LevelLoader extends CocoClass
buildLoop: => buildLoop: =>
someLeft = false someLeft = false
for spriteSheetResource, i in @spriteSheetsToBuild for spriteSheetResource, i in @spriteSheetsToBuild ? []
continue if spriteSheetResource.spriteSheetKeys continue if spriteSheetResource.spriteSheetKeys
someLeft = true someLeft = true
thangType = spriteSheetResource.thangType thangType = spriteSheetResource.thangType

View file

@ -79,6 +79,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
@handledDisplayEvents = {} @handledDisplayEvents = {}
@age = 0 @age = 0
@stillLoading = true @stillLoading = true
@setNameLabel @thang.id if @thang?.showsName
if @thangType.isFullyLoaded() if @thangType.isFullyLoaded()
@setUpSprite() @setUpSprite()
else else

View file

@ -186,7 +186,7 @@ module.exports = class Level extends CocoModel
unless isPhysical unless isPhysical
originalComponent = $.extend true, {}, component originalComponent = $.extend true, {}, component
component.config ?= {} component.config ?= {}
TreemaUtils.populateDefaults(component.config, lc.configSchema, tv4) TreemaUtils.populateDefaults(component.config, lc.configSchema ? {}, tv4)
@lastType = 'component' @lastType = 'component'
@lastOriginal = component.original @lastOriginal = component.original
unless isPhysical unless isPhysical

View file

@ -102,7 +102,7 @@ DependencySchema = c.object {
LevelComponentSchema = c.object { LevelComponentSchema = c.object {
title: 'Component' title: 'Component'
description: 'A Component which can affect Thang behavior.' description: 'A Component which can affect Thang behavior.'
required: ['system', 'name', 'description', 'code', 'dependencies', 'propertyDocumentation', 'codeLanguage'] required: ['system', 'name', 'code']
default: default:
system: 'ai' system: 'ai'
name: 'AttacksSelf' name: 'AttacksSelf'

View file

@ -177,7 +177,7 @@ block content
if !editing && !myProfile if !editing && !myProfile
button#contact-candidate.btn.btn-large.btn-inverse.flat-button button#contact-candidate.btn.btn-large.btn-inverse.flat-button
span(data-i18n="account_profile.contact") Contact span(data-i18n="account_profile.contact") Contact
| #{profile.name.split(' ')[0]} | #{(profile.name || user.get('name') || 'Anonymous').split(' ')[0]}
if me.isAdmin() if me.isAdmin()
select#admin-contact.form-control select#admin-contact.form-control
for contact in adminContacts for contact in adminContacts

View file

@ -26,7 +26,7 @@ module.exports = class NewLevelComponentModal extends ModalView
component = new LevelComponent() component = new LevelComponent()
component.set 'system', system component.set 'system', system
component.set 'name', name 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 component.set 'permissions', [{access: 'owner', target: me.id}] # Private until saved in a published Level
res = component.save() res = component.save()
return unless res return unless res