Hide say() until later levels. Fix bug with identifying correct equipped item ThangTypes in the spell palette.

This commit is contained in:
Nick Winter 2014-11-05 15:43:08 -08:00
parent 46409ef10d
commit f8679dfeca

View file

@ -181,12 +181,12 @@ module.exports = class SpellPaletteView extends CocoView
# Assign any kind of programmable properties to the items that grant them. # Assign any kind of programmable properties to the items that grant them.
@isHero = true @isHero = true
itemThangTypes = {} itemThangTypes = {}
itemThangTypes[tt.get('name')] = tt for tt in @supermodel.getModels ThangType itemThangTypes[tt.get('name')] = tt for tt in @supermodel.getModels ThangType # Also heroes
propsByItem = {} propsByItem = {}
propCount = 0 propCount = 0
itemsByProp = {} itemsByProp = {}
for slot, inventoryID of @thang.inventoryIDs ? {} for slot, thangTypeName of @thang.inventoryThangTypeNames ? {}
if item = itemThangTypes[inventoryID] if item = itemThangTypes[thangTypeName]
unless item.get('components') unless item.get('components')
console.error 'Item', item, 'did not have any components when we went to assemble docs.' console.error 'Item', item, 'did not have any components when we went to assemble docs.'
for component in item.get('components') ? [] when component.config for component in item.get('components') ? [] when component.config
@ -198,13 +198,15 @@ module.exports = class SpellPaletteView extends CocoView
itemsByProp[prop] = item itemsByProp[prop] = item
++propCount ++propCount
else else
console.log @thang.id, "couldn't find item ThangType for", slot, inventoryID console.log @thang.id, "couldn't find item ThangType for", slot, thangTypeName
# Assign any unassigned properties to the hero itself. # Assign any unassigned properties to the hero itself.
for owner, storage of propStorage for owner, storage of propStorage
for prop in _.reject(@thang[storage] ? [], (prop) -> itemsByProp[prop] or prop[0] is '_') # no private properties for prop in _.reject(@thang[storage] ? [], (prop) -> itemsByProp[prop] or prop[0] is '_') # no private properties
if prop is 'say' and @options.level.get('slug') in ['dungeons-of-kithgard', 'gems-in-the-deep', 'forgetful-gemsmith', 'shadow-guard', 'kounter-kithwise', 'crawlways-of-kithgard', 'true-names', 'favorable-odds', 'the-raised-sword', 'the-first-kithmaze', 'haunted-kithmaze', 'descending-further', 'the-second-kithmaze', 'dread-door', 'known-enemy', 'master-of-names', 'lowly-kithmen', 'closing-the-distance', 'tactical-strike', 'the-final-kithmaze', 'the-gauntlet']
continue
propsByItem['Hero'] ?= [] propsByItem['Hero'] ?= []
propsByItem['Hero'].push owner: owner, prop: prop, item: null propsByItem['Hero'].push owner: owner, prop: prop, item: itemThangTypes[@thang.spriteName]
++propCount ++propCount
Backbone.Mediator.publish 'tome:update-snippets', propGroups: propsByItem, allDocs: allDocs, language: @options.language Backbone.Mediator.publish 'tome:update-snippets', propGroups: propsByItem, allDocs: allDocs, language: @options.language