diff --git a/app/lib/surface/SpriteBoss.coffee b/app/lib/surface/SpriteBoss.coffee index 3480d61a5..d9ecf8ed0 100644 --- a/app/lib/surface/SpriteBoss.coffee +++ b/app/lib/surface/SpriteBoss.coffee @@ -230,7 +230,7 @@ module.exports = class SpriteBoss extends CocoClass @selectedSprite = sprite alive = sprite?.thang.health > 0 - Backbone.Mediator.publish "surface:sprite-selected", + Backbone.Mediator.publish 'surface:sprite-selected', thang: if sprite then sprite.thang else null sprite: sprite spellName: spellName ? e?.spellName diff --git a/app/views/editor/level/thangs_tab_view.coffee b/app/views/editor/level/thangs_tab_view.coffee index 15fa9c6c7..454b4d4f0 100644 --- a/app/views/editor/level/thangs_tab_view.coffee +++ b/app/views/editor/level/thangs_tab_view.coffee @@ -320,7 +320,7 @@ module.exports = class ThangsTabView extends View physical.config.pos = x: pos.x, y: pos.y, z: physical.config.pos.z if physical thang = thangType: thangType.get('original'), id: thangID, components: components @thangsTreema.insert '', thang - @supermodel.populateModel @level # Make sure we grab any new data for the thang we just added + @supermodel.populateModel thangType # Make sure we grab any new data for the thang we just added editThang: (e) -> if e.target # click event @@ -346,19 +346,21 @@ class ThangsNode extends TreemaNode.nodeMap.array valueClass: 'treema-array-replacement' getChildren: -> children = super(arguments...) - # uncomment this if you want to hide all the walls in the the thangs treema - #children = (c for c in children when not _.string.startsWith(c[1].thangType, 'dungeon_wall')) + # TODO: add some filtering to only work with certain types of units at a time return children class ThangNode extends TreemaObjectNode valueClass: 'treema-thang' collection: false + @thangNameMap: {} buildValueForDisplay: (valEl) -> pos = _.find(@data.components, (c) -> c.config?.pos?)?.config.pos # TODO: hack s = "#{@data.thangType}" if isObjectID s - thangType = _.find @settings.supermodel.getModels(ThangType), (m) -> m.get('original') is s - s = thangType.get('name') + unless name = ThangNode.thangNameMap[s] + thangType = _.find @settings.supermodel.getModels(ThangType), (m) -> m.get('original') is s + name = ThangNode.thangNameMap[s] = thangType.get 'name' + s = name s += " - " + @data.id if @data.id isnt s if pos s += " (#{Math.round(pos.x)}, #{Math.round(pos.y)})"