Fix bugs in reformat script from recent refactor
This commit is contained in:
+1
-1
@@ -41,7 +41,7 @@ try
|
|||||||
text = fs.readFileSync sourceFileName, 'UTF-8'
|
text = fs.readFileSync sourceFileName, 'UTF-8'
|
||||||
parser = new ModVersionParser model:new ModVersion modSlug:'', version:''
|
parser = new ModVersionParser model:new ModVersion modSlug:'', version:''
|
||||||
modVersion = parser.parse text
|
modVersion = parser.parse text
|
||||||
text = parser.unparse modVersion
|
text = parser.unparse(modVersion).trim().replace(/^\s\s*$/gm, '')
|
||||||
|
|
||||||
if targetFileName is '-'
|
if targetFileName is '-'
|
||||||
console.log text
|
console.log text
|
||||||
|
|||||||
@@ -94,98 +94,95 @@ group: Agriculture
|
|||||||
recipe:
|
recipe:
|
||||||
input: Steak, Tin Can
|
input: Steak, Tin Can
|
||||||
pattern: 101 111 111
|
pattern: 101 111 111
|
||||||
tools: Canning Machine
|
|
||||||
quantity: 8
|
quantity: 8
|
||||||
|
tools: Canning Machine
|
||||||
recipe:
|
recipe:
|
||||||
input: Cooked Porkchop, Tin Can
|
input: Cooked Porkchop, Tin Can
|
||||||
pattern: 101 111 111
|
pattern: 101 111 111
|
||||||
tools: Canning Machine
|
|
||||||
quantity: 8
|
quantity: 8
|
||||||
|
tools: Canning Machine
|
||||||
recipe:
|
recipe:
|
||||||
input: Baked Potato, Tin Can
|
input: Baked Potato, Tin Can
|
||||||
pattern: .0. 111 111
|
pattern: .0. 111 111
|
||||||
tools: Canning Machine
|
|
||||||
quantity: 6
|
quantity: 6
|
||||||
|
tools: Canning Machine
|
||||||
recipe:
|
recipe:
|
||||||
input: Cooked Chicken, Tin Can
|
input: Cooked Chicken, Tin Can
|
||||||
pattern: .0. 111 111
|
pattern: .0. 111 111
|
||||||
tools: Canning Machine
|
|
||||||
quantity: 6
|
quantity: 6
|
||||||
|
tools: Canning Machine
|
||||||
recipe:
|
recipe:
|
||||||
input: Pumpkin Pie, Tin Can
|
input: Pumpkin Pie, Tin Can
|
||||||
pattern: .0. 111 111
|
pattern: .0. 111 111
|
||||||
tools: Canning Machine
|
|
||||||
quantity: 6
|
quantity: 6
|
||||||
|
tools: Canning Machine
|
||||||
recipe:
|
recipe:
|
||||||
input: Mushroom Stew, Tin Can
|
input: Mushroom Stew, Tin Can
|
||||||
pattern: .0. 111 111
|
pattern: .0. 111 111
|
||||||
tools: Canning Machine
|
|
||||||
quantity: 6
|
quantity: 6
|
||||||
|
tools: Canning Machine
|
||||||
recipe:
|
recipe:
|
||||||
input: Bread, Tin Can
|
input: Bread, Tin Can
|
||||||
pattern: ... 101 111
|
pattern: ... 101 111
|
||||||
tools: Canning Machine
|
|
||||||
quantity: 5
|
quantity: 5
|
||||||
|
tools: Canning Machine
|
||||||
recipe:
|
recipe:
|
||||||
input: Cooked Fish, Tin Can
|
input: Cooked Fish, Tin Can
|
||||||
pattern: ... 101 111
|
pattern: ... 101 111
|
||||||
tools: Canning Machine
|
|
||||||
quantity: 5
|
quantity: 5
|
||||||
|
tools: Canning Machine
|
||||||
recipe:
|
recipe:
|
||||||
input: Carrot, Tin Can
|
input: Carrot, Tin Can
|
||||||
pattern: ... .01 111
|
pattern: ... .01 111
|
||||||
tools: Canning Machine
|
|
||||||
quantity: 4
|
quantity: 4
|
||||||
|
tools: Canning Machine
|
||||||
recipe:
|
recipe:
|
||||||
input: Apple, Tin Can
|
input: Apple, Tin Can
|
||||||
pattern: ... .01 111
|
pattern: ... .01 111
|
||||||
tools: Canning Machine
|
|
||||||
quantity: 4
|
quantity: 4
|
||||||
|
tools: Canning Machine
|
||||||
recipe:
|
recipe:
|
||||||
input: Raw Beef, Tin Can
|
input: Raw Beef, Tin Can
|
||||||
pattern: ... .0. 111
|
pattern: ... .0. 111
|
||||||
tools: Canning Machine
|
|
||||||
quantity: 3
|
quantity: 3
|
||||||
|
tools: Canning Machine
|
||||||
recipe:
|
recipe:
|
||||||
input: Raw Porkchop, Tin Can
|
input: Raw Porkchop, Tin Can
|
||||||
pattern: ... .0. 111
|
pattern: ... .0. 111
|
||||||
tools: Canning Machine
|
|
||||||
quantity: 3
|
quantity: 3
|
||||||
|
tools: Canning Machine
|
||||||
recipe:
|
recipe:
|
||||||
input: Melon, Tin Can
|
input: Melon, Tin Can
|
||||||
pattern: ... .0. 1.1
|
pattern: ... .0. 1.1
|
||||||
tools: Canning Machine
|
|
||||||
quantity: 2
|
quantity: 2
|
||||||
|
tools: Canning Machine
|
||||||
recipe:
|
recipe:
|
||||||
input: Cookie, Tin Can
|
input: Cookie, Tin Can
|
||||||
pattern: ... .0. 1.1
|
pattern: ... .0. 1.1
|
||||||
tools: Canning Machine
|
|
||||||
quantity: 2
|
quantity: 2
|
||||||
|
tools: Canning Machine
|
||||||
recipe:
|
recipe:
|
||||||
input: Raw Chicken, Tin Can
|
input: Raw Chicken, Tin Can
|
||||||
pattern: ... .0. 1.1
|
pattern: ... .0. 1.1
|
||||||
tools: Canning Machine
|
|
||||||
quantity: 2
|
quantity: 2
|
||||||
|
tools: Canning Machine
|
||||||
recipe:
|
recipe:
|
||||||
input: Raw Fish, Tin Can
|
input: Raw Fish, Tin Can
|
||||||
pattern: ... .0. 1.1
|
pattern: ... .0. 1.1
|
||||||
tools: Canning Machine
|
|
||||||
quantity: 2
|
quantity: 2
|
||||||
|
tools: Canning Machine
|
||||||
recipe:
|
recipe:
|
||||||
input: Potato, Tin Can
|
input: Potato, Tin Can
|
||||||
pattern: ... .0. .1.
|
pattern: ... .0. .1.
|
||||||
tools: Canning Machine
|
tools: Canning Machine
|
||||||
quantity: 1
|
|
||||||
recipe:
|
recipe:
|
||||||
input: Poisonous Potato, Tin Can
|
input: Poisonous Potato, Tin Can
|
||||||
pattern: .0. .0. .1.
|
pattern: .0. .0. .1.
|
||||||
tools: Canning Machine
|
tools: Canning Machine
|
||||||
quantity: 1
|
|
||||||
recipe:
|
recipe:
|
||||||
input: Rotten Flesh, Tin Can
|
input: Rotten Flesh, Tin Can
|
||||||
pattern: .0. .0. .1.
|
pattern: .0. .0. .1.
|
||||||
tools: Canning Machine
|
tools: Canning Machine
|
||||||
quantity: 1
|
|
||||||
|
|
||||||
item: Grin Powder
|
item: Grin Powder
|
||||||
recipe:
|
recipe:
|
||||||
@@ -566,10 +563,10 @@ group: Energy: Transmission
|
|||||||
|
|
||||||
item: Copper Cable
|
item: Copper Cable
|
||||||
recipe:
|
recipe:
|
||||||
tools: Cutter
|
|
||||||
input: Copper Plate
|
input: Copper Plate
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
quantity: 2
|
quantity: 2
|
||||||
|
tools: Cutter
|
||||||
recipe:
|
recipe:
|
||||||
input: Copper Ingot
|
input: Copper Ingot
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
@@ -607,10 +604,10 @@ group: Energy: Transmission
|
|||||||
|
|
||||||
item: Gold Cable
|
item: Gold Cable
|
||||||
recipe:
|
recipe:
|
||||||
tools: Cutter
|
|
||||||
input: Gold Plate
|
input: Gold Plate
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
quantity: 4
|
quantity: 4
|
||||||
|
tools: Cutter
|
||||||
recipe:
|
recipe:
|
||||||
input: Gold Ingot
|
input: Gold Ingot
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
@@ -674,10 +671,10 @@ group: Energy: Transmission
|
|||||||
|
|
||||||
item: Tin Cable
|
item: Tin Cable
|
||||||
recipe:
|
recipe:
|
||||||
tools: Cutter
|
|
||||||
input: Tin Plate
|
input: Tin Plate
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
quantity: 3
|
quantity: 3
|
||||||
|
tools: Cutter
|
||||||
recipe:
|
recipe:
|
||||||
input: Tin Ingot
|
input: Tin Ingot
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
@@ -735,10 +732,10 @@ group: Machine Parts
|
|||||||
|
|
||||||
item: Bronze Item Casing
|
item: Bronze Item Casing
|
||||||
recipe:
|
recipe:
|
||||||
tools: Forge Hammer
|
|
||||||
input: Bronze Plate
|
input: Bronze Plate
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
quantity: 2
|
quantity: 2
|
||||||
|
tools: Forge Hammer
|
||||||
recipe:
|
recipe:
|
||||||
input: Bronze Plate
|
input: Bronze Plate
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
@@ -747,9 +744,9 @@ group: Machine Parts
|
|||||||
|
|
||||||
item: Bronze Plate
|
item: Bronze Plate
|
||||||
recipe:
|
recipe:
|
||||||
tools: Forge Hammer
|
|
||||||
input: Bronze Ingot
|
input: Bronze Ingot
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
|
tools: Forge Hammer
|
||||||
recipe:
|
recipe:
|
||||||
input: Bronze Ingot
|
input: Bronze Ingot
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
@@ -786,10 +783,10 @@ group: Machine Parts
|
|||||||
|
|
||||||
item: Copper Item Casing
|
item: Copper Item Casing
|
||||||
recipe:
|
recipe:
|
||||||
tools: Forge Hammer
|
|
||||||
input: Copper Plate
|
input: Copper Plate
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
quantity: 2
|
quantity: 2
|
||||||
|
tools: Forge Hammer
|
||||||
recipe:
|
recipe:
|
||||||
input: Copper Plate
|
input: Copper Plate
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
@@ -798,9 +795,9 @@ group: Machine Parts
|
|||||||
|
|
||||||
item: Copper Plate
|
item: Copper Plate
|
||||||
recipe:
|
recipe:
|
||||||
tools: Forge Hammer
|
|
||||||
input: Copper Ingot
|
input: Copper Ingot
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
|
tools: Forge Hammer
|
||||||
recipe:
|
recipe:
|
||||||
input: Copper Ingot
|
input: Copper Ingot
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
@@ -909,10 +906,10 @@ group: Machine Parts
|
|||||||
|
|
||||||
item: Gold Item Casing
|
item: Gold Item Casing
|
||||||
recipe:
|
recipe:
|
||||||
tools: Forge Hammer
|
|
||||||
input: Gold Plate
|
input: Gold Plate
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
quantity: 2
|
quantity: 2
|
||||||
|
tools: Forge Hammer
|
||||||
recipe:
|
recipe:
|
||||||
input: Gold Plate
|
input: Gold Plate
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
@@ -921,9 +918,9 @@ group: Machine Parts
|
|||||||
|
|
||||||
item: Gold Plate
|
item: Gold Plate
|
||||||
recipe:
|
recipe:
|
||||||
tools: Forge Hammer
|
|
||||||
input: Gold Ingot
|
input: Gold Ingot
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
|
tools: Forge Hammer
|
||||||
recipe:
|
recipe:
|
||||||
input: Gold Ingot
|
input: Gold Ingot
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
@@ -941,10 +938,10 @@ group: Machine Parts
|
|||||||
|
|
||||||
item: Iron Item Casing
|
item: Iron Item Casing
|
||||||
recipe:
|
recipe:
|
||||||
tools: Forge Hammer
|
|
||||||
input: Iron Plate
|
input: Iron Plate
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
quantity: 2
|
quantity: 2
|
||||||
|
tools: Forge Hammer
|
||||||
recipe:
|
recipe:
|
||||||
input: Iron Plate
|
input: Iron Plate
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
@@ -953,9 +950,9 @@ group: Machine Parts
|
|||||||
|
|
||||||
item: Iron Plate
|
item: Iron Plate
|
||||||
recipe:
|
recipe:
|
||||||
tools: Forge Hammer
|
|
||||||
input: Iron Ingot
|
input: Iron Ingot
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
|
tools: Forge Hammer
|
||||||
recipe:
|
recipe:
|
||||||
input: Iron Ingot
|
input: Iron Ingot
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
@@ -1012,11 +1009,6 @@ group: Machine Parts
|
|||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
quantity: 9
|
quantity: 9
|
||||||
tools: Block Cutting Machine
|
tools: Block Cutting Machine
|
||||||
recipe:
|
|
||||||
input: Lapis Lazuli Block
|
|
||||||
pattern: ... .0. ...
|
|
||||||
quantity: 9
|
|
||||||
tools: Block Cutting Machine
|
|
||||||
|
|
||||||
item: Lapotron Crystal
|
item: Lapotron Crystal
|
||||||
recipe:
|
recipe:
|
||||||
@@ -1026,10 +1018,10 @@ group: Machine Parts
|
|||||||
|
|
||||||
item: Lead Item Casing
|
item: Lead Item Casing
|
||||||
recipe:
|
recipe:
|
||||||
tools: Forge Hammer
|
|
||||||
input: Lead Plate
|
input: Lead Plate
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
quantity: 2
|
quantity: 2
|
||||||
|
tools: Forge Hammer
|
||||||
recipe:
|
recipe:
|
||||||
input: Lead Plate
|
input: Lead Plate
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
@@ -1038,9 +1030,9 @@ group: Machine Parts
|
|||||||
|
|
||||||
item: Lead Plate
|
item: Lead Plate
|
||||||
recipe:
|
recipe:
|
||||||
tools: Forge Hammer
|
|
||||||
input: Lead Ingot
|
input: Lead Ingot
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
|
tools: Forge Hammer
|
||||||
recipe:
|
recipe:
|
||||||
input: Lead Ingot
|
input: Lead Ingot
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
@@ -1068,11 +1060,6 @@ group: Machine Parts
|
|||||||
input: Obsidian Dust
|
input: Obsidian Dust
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
tools: Compressor
|
tools: Compressor
|
||||||
recipe:
|
|
||||||
input: Obsidian
|
|
||||||
pattern: ... .0. ...
|
|
||||||
quantity: 9
|
|
||||||
tools: Block Cutting Machine
|
|
||||||
|
|
||||||
item: Overclocker Upgrade
|
item: Overclocker Upgrade
|
||||||
recipe:
|
recipe:
|
||||||
@@ -1230,10 +1217,10 @@ group: Machine Parts
|
|||||||
|
|
||||||
item: Tin Item Casing
|
item: Tin Item Casing
|
||||||
recipe:
|
recipe:
|
||||||
tools: Forge Hammer
|
|
||||||
input: Tin Plate
|
input: Tin Plate
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
quantity: 2
|
quantity: 2
|
||||||
|
tools: Forge Hammer
|
||||||
recipe:
|
recipe:
|
||||||
input: Tin Plate
|
input: Tin Plate
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
@@ -1242,9 +1229,9 @@ group: Machine Parts
|
|||||||
|
|
||||||
item: Tin Plate
|
item: Tin Plate
|
||||||
recipe:
|
recipe:
|
||||||
tools: Forge Hammer
|
|
||||||
input: Tin Ingot
|
input: Tin Ingot
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
|
tools: Forge Hammer
|
||||||
recipe:
|
recipe:
|
||||||
input: Tin Ingot
|
input: Tin Ingot
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
@@ -2549,8 +2536,8 @@ group: Nuclear Reactor
|
|||||||
|
|
||||||
item: Coolant Cell
|
item: Coolant Cell
|
||||||
recipe:
|
recipe:
|
||||||
input: Distilled Water, Lapis Lazuli Dust, Empty Cell
|
input: Distilled Water, Empty Cell, Lapis Lazuli Dust
|
||||||
pattern: .0. .1. .2.
|
pattern: .0. .2. .1.
|
||||||
tools: Fluid/Solid Canning Machine
|
tools: Fluid/Solid Canning Machine
|
||||||
|
|
||||||
item: Dual Fuel Rod (Depleted MOX)
|
item: Dual Fuel Rod (Depleted MOX)
|
||||||
@@ -3102,10 +3089,12 @@ update: Iron Ingot
|
|||||||
input: Crushed Iron Ore, furnace fuel
|
input: Crushed Iron Ore, furnace fuel
|
||||||
pattern: .0. ... .1.
|
pattern: .0. ... .1.
|
||||||
tools: Furnace
|
tools: Furnace
|
||||||
|
|
||||||
recipe:
|
recipe:
|
||||||
input: Purified Crushed Iron Ore, furnace fuel
|
input: Purified Crushed Iron Ore, furnace fuel
|
||||||
pattern: .0. ... .1.
|
pattern: .0. ... .1.
|
||||||
tools: Furnace
|
tools: Furnace
|
||||||
|
|
||||||
recipe:
|
recipe:
|
||||||
input: Iron Dust, furnace fuel
|
input: Iron Dust, furnace fuel
|
||||||
pattern: .0. ... .1.
|
pattern: .0. ... .1.
|
||||||
@@ -3115,4 +3104,4 @@ update: Diamond
|
|||||||
recipe:
|
recipe:
|
||||||
input: Coal Chunk
|
input: Coal Chunk
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
tools: Compressor
|
tools: Compressor
|
||||||
@@ -95,9 +95,9 @@ module.exports = class Mod extends BaseModel
|
|||||||
return unless @_activeModVersion?
|
return unless @_activeModVersion?
|
||||||
@_activeModVersion.findName itemSlug
|
@_activeModVersion.findName itemSlug
|
||||||
|
|
||||||
findRecipes: (itemSlug, result=[])->
|
findRecipes: (itemSlug, result=[], options={})->
|
||||||
return result unless @_activeModVersion?
|
return result unless @_activeModVersion?
|
||||||
@_activeModVersion.findRecipes itemSlug, result
|
@_activeModVersion.findRecipes itemSlug, result, options
|
||||||
|
|
||||||
# Property Methods #############################################################################
|
# Property Methods #############################################################################
|
||||||
|
|
||||||
|
|||||||
@@ -81,12 +81,12 @@ module.exports = class ModPack extends BaseModel
|
|||||||
|
|
||||||
return null
|
return null
|
||||||
|
|
||||||
findRecipes: (itemSlug, result=[])->
|
findRecipes: (itemSlug, result=[], options={})->
|
||||||
return null unless itemSlug?
|
return null unless itemSlug?
|
||||||
|
|
||||||
for mod in @_mods
|
for mod in @_mods
|
||||||
continue unless mod.enabled
|
continue unless mod.enabled
|
||||||
mod.findRecipes itemSlug, result
|
mod.findRecipes itemSlug, result, options
|
||||||
|
|
||||||
result.sort (a, b)-> Recipe.compareFor a, b, itemSlug
|
result.sort (a, b)-> Recipe.compareFor a, b, itemSlug
|
||||||
|
|
||||||
|
|||||||
@@ -117,23 +117,24 @@ module.exports = class ModVersion extends BaseModel
|
|||||||
|
|
||||||
addRecipe: (recipe)->
|
addRecipe: (recipe)->
|
||||||
recipe.modVersion = this
|
recipe.modVersion = this
|
||||||
|
if @_recipes[recipe.slug]? then throw new Error "duplicate recipe: #{recipe.slug}"
|
||||||
for stack in recipe.output
|
@_recipes[recipe.slug] = recipe
|
||||||
recipeList = @_recipes[stack.itemSlug.item]
|
|
||||||
if not recipeList?
|
|
||||||
recipeList = @_recipes[stack.itemSlug.item] = []
|
|
||||||
recipeList.push recipe
|
|
||||||
|
|
||||||
return this
|
return this
|
||||||
|
|
||||||
eachRecipe: (callback)->
|
eachRecipe: (callback)->
|
||||||
for itemSlugText, recipeList of @_recipes
|
recipes = _.values(@_recipes).sort (a, b)-> a.compareTo b
|
||||||
for recipe in recipeList
|
for recipe in recipes
|
||||||
callback recipe
|
callback recipe
|
||||||
|
return this
|
||||||
|
|
||||||
findRecipes: (itemSlug, result=[])->
|
findRecipes: (itemSlug, result=[], options={})->
|
||||||
for k, recipeList of @_recipes
|
options.onlyPrimary ?= false
|
||||||
for recipe in recipeList
|
|
||||||
|
for k, recipe of @_recipes
|
||||||
|
if options.onlyPrimary
|
||||||
|
if recipe.itemSlug.matches itemSlug
|
||||||
|
result.push recipe
|
||||||
|
else
|
||||||
if recipe.produces itemSlug
|
if recipe.produces itemSlug
|
||||||
result.push recipe
|
result.push recipe
|
||||||
|
|
||||||
@@ -141,20 +142,19 @@ module.exports = class ModVersion extends BaseModel
|
|||||||
|
|
||||||
findExternalRecipes: ->
|
findExternalRecipes: ->
|
||||||
result = {}
|
result = {}
|
||||||
for itemSlug in @_slugs
|
for k, recipe of @_recipes
|
||||||
continue if itemSlug.isQualified
|
continue if recipe.itemSlug.isQualified
|
||||||
recipes = @_recipes[itemSlug.item]
|
|
||||||
continue unless recipes? and recipes.length > 0
|
|
||||||
|
|
||||||
resultList = result[itemSlug] = []
|
recipeList = result[recipe.itemSlug]
|
||||||
for recipe in recipes
|
if not recipeList then recipeList = result[recipe.itemSlug] = []
|
||||||
resultList.push recipe
|
|
||||||
|
recipeList.push recipe
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
hasRecipes: (itemSlug)->
|
hasRecipes: (itemSlug)->
|
||||||
recipeList = @_recipes[itemSlug.item]
|
for k, recipe of @_recipes
|
||||||
return true if recipeList? and recipeList.length > 0
|
return true if recipe.produces itemSlug
|
||||||
return false
|
return false
|
||||||
|
|
||||||
# Backbone.Model Overrides #####################################################################
|
# Backbone.Model Overrides #####################################################################
|
||||||
|
|||||||
@@ -215,8 +215,9 @@ module.exports = class ModVersionParserV1 extends CommandParserVersionBase
|
|||||||
builder
|
builder
|
||||||
.line 'update: ', modVersion.findName ItemSlug.slugify(itemSlugText)
|
.line 'update: ', modVersion.findName ItemSlug.slugify(itemSlugText)
|
||||||
.indent()
|
.indent()
|
||||||
.loop(recipeList, delimiter:'\n\n', onEach:(b, r)=> @_unparseRecipe(b, r))
|
.loop(recipeList, delimiter:'\n', onEach:(b, r)=> @_unparseRecipe(b, r))
|
||||||
.outdent()
|
.outdent()
|
||||||
|
.line()
|
||||||
|
|
||||||
_unparseGroup: (builder, modVersion, group)->
|
_unparseGroup: (builder, modVersion, group)->
|
||||||
if group isnt Item.Group.Other
|
if group isnt Item.Group.Other
|
||||||
@@ -233,7 +234,7 @@ module.exports = class ModVersionParserV1 extends CommandParserVersionBase
|
|||||||
builder.outdent()
|
builder.outdent()
|
||||||
|
|
||||||
_unparseItem: (builder, modVersion, item)->
|
_unparseItem: (builder, modVersion, item)->
|
||||||
recipes = modVersion.findRecipes item.slug
|
recipes = modVersion.findRecipes item.slug, [], onlyPrimary:true
|
||||||
|
|
||||||
builder
|
builder
|
||||||
.line 'item: ', item.name
|
.line 'item: ', item.name
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ All rights reserved.
|
|||||||
###
|
###
|
||||||
|
|
||||||
BaseModel = require './base_model'
|
BaseModel = require './base_model'
|
||||||
|
{Event} = require '../constants'
|
||||||
Stack = require './stack'
|
Stack = require './stack'
|
||||||
StringBuilder = require './string_builder'
|
StringBuilder = require './string_builder'
|
||||||
|
|
||||||
@@ -32,6 +33,8 @@ module.exports = class Recipe extends BaseModel
|
|||||||
options.logEvents ?= false
|
options.logEvents ?= false
|
||||||
super attributes, options
|
super attributes, options
|
||||||
|
|
||||||
|
@on Event.change + ':modVersion', => @_slug = null
|
||||||
|
|
||||||
# Class Methods ################################################################################
|
# Class Methods ################################################################################
|
||||||
|
|
||||||
@compareFor: (a, b, itemSlug)->
|
@compareFor: (a, b, itemSlug)->
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ module.exports = class StringBuilder
|
|||||||
return this
|
return this
|
||||||
|
|
||||||
line: (args...)->
|
line: (args...)->
|
||||||
@push.apply this, args
|
@push.apply(this, args) if args.length > 0
|
||||||
@push '\n'
|
@push '\n'
|
||||||
|
|
||||||
loop: (list, options={})->
|
loop: (list, options={})->
|
||||||
|
|||||||
Reference in New Issue
Block a user