Allow "have" inventory to include non-craftables
This commit is contained in:
@@ -76,13 +76,14 @@ module.exports = class ModPack extends BaseModel
|
||||
result.itemUrl = Url.item result
|
||||
return result
|
||||
|
||||
gatherRecipeNames: (options={})->
|
||||
gatherNames: (options={})->
|
||||
options.includeGatherable ?= false
|
||||
options.includeDisabled ?= false
|
||||
|
||||
nameData = {}
|
||||
for modVersion in @modVersions
|
||||
continue unless modVersion.enabled or options.includeDisabled
|
||||
modVersion.gatherRecipeNames nameData
|
||||
modVersion.gatherNames nameData, options
|
||||
|
||||
result = []
|
||||
names = _.keys(nameData).sort()
|
||||
@@ -102,6 +103,17 @@ module.exports = class ModPack extends BaseModel
|
||||
isLoading: ->
|
||||
return @loading.inspect().state isnt 'pending'
|
||||
|
||||
isValidName: (name, options={})->
|
||||
options.includeDisabled ?= false
|
||||
|
||||
slug = _.slugify name
|
||||
for modVersion in @modVersions
|
||||
continue unless modVersion.enabled or options.includeDisabled
|
||||
name = modVersion.findName slug
|
||||
return true if name
|
||||
|
||||
return false
|
||||
|
||||
loadModVersion: (url)->
|
||||
promise = w.promise (resolve, reject)=>
|
||||
@trigger Event.load.started, this, url
|
||||
|
||||
@@ -53,12 +53,20 @@ module.exports = class ModVersion extends BaseModel
|
||||
findName: (slug)->
|
||||
return @names[slug]
|
||||
|
||||
gatherRecipeNames: (result={})->
|
||||
gatherNames: (result={}, options={})->
|
||||
options.includeGatherable ?= false
|
||||
|
||||
for slug, item of @items
|
||||
continue if result[item.slug]
|
||||
continue unless item.isCraftable
|
||||
if item.isGatherable
|
||||
continue unless options.includeGatherable
|
||||
result[item.slug] = value:item.name, label:"#{item.name} (from #{@name} #{@version})"
|
||||
|
||||
if options.includeGatherable
|
||||
for slug, name of @names
|
||||
continue if result[slug]
|
||||
result[slug] = value:name, label:"#{name} (from #{@name} #{@version})"
|
||||
|
||||
return result
|
||||
|
||||
hasRecipe: (name)->
|
||||
|
||||
Reference in New Issue
Block a user