Fix crafting algo. to avoid cycles #47
* Adjust recipes in Thermal Expansion to likewise avoid cycles
This commit is contained in:
@@ -278,14 +278,6 @@ item: Copper Gear
|
|||||||
tools: Crafting Table
|
tools: Crafting Table
|
||||||
|
|
||||||
item: Copper Ingot
|
item: Copper Ingot
|
||||||
recipe:
|
|
||||||
input: Pulverized Copper, furnace fuel
|
|
||||||
pattern: .0. ... .1.
|
|
||||||
tools: Furnace
|
|
||||||
recipe:
|
|
||||||
input: Pulverized Copper
|
|
||||||
pattern: ... .0. ...
|
|
||||||
tools: Redstone Furnace
|
|
||||||
recipe:
|
recipe:
|
||||||
input: Copper Ore, furnace fuel
|
input: Copper Ore, furnace fuel
|
||||||
pattern: .0. ... .1.
|
pattern: .0. ... .1.
|
||||||
@@ -294,6 +286,14 @@ item: Copper Ingot
|
|||||||
input: Copper Ore
|
input: Copper Ore
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
tools: Redstone Furnace
|
tools: Redstone Furnace
|
||||||
|
recipe:
|
||||||
|
input: Pulverized Copper, furnace fuel
|
||||||
|
pattern: .0. ... .1.
|
||||||
|
tools: Furnace
|
||||||
|
recipe:
|
||||||
|
input: Pulverized Copper
|
||||||
|
pattern: ... .0. ...
|
||||||
|
tools: Redstone Furnace
|
||||||
recipe:
|
recipe:
|
||||||
extras: Gold Ingot
|
extras: Gold Ingot
|
||||||
input: Cinnabar, Copper Ore
|
input: Cinnabar, Copper Ore
|
||||||
@@ -1089,14 +1089,6 @@ item: Lead Gear
|
|||||||
tools: Crafting Table
|
tools: Crafting Table
|
||||||
|
|
||||||
item: Lead Ingot
|
item: Lead Ingot
|
||||||
recipe:
|
|
||||||
input: Pulverized Lead, furnace fuel
|
|
||||||
pattern: .0. ... .1.
|
|
||||||
tools: Furnace
|
|
||||||
recipe:
|
|
||||||
input: Pulverized Lead
|
|
||||||
pattern: ... .0. ...
|
|
||||||
tools: Redstone Furnace
|
|
||||||
recipe:
|
recipe:
|
||||||
input: Lead Ore, furnace fuel
|
input: Lead Ore, furnace fuel
|
||||||
pattern: .0. ... .1.
|
pattern: .0. ... .1.
|
||||||
@@ -1105,6 +1097,14 @@ item: Lead Ingot
|
|||||||
input: Lead Ore
|
input: Lead Ore
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
tools: Redstone Furnace
|
tools: Redstone Furnace
|
||||||
|
recipe:
|
||||||
|
input: Pulverized Lead, furnace fuel
|
||||||
|
pattern: .0. ... .1.
|
||||||
|
tools: Furnace
|
||||||
|
recipe:
|
||||||
|
input: Pulverized Lead
|
||||||
|
pattern: ... .0. ...
|
||||||
|
tools: Redstone Furnace
|
||||||
recipe:
|
recipe:
|
||||||
extras: Silver Ingot
|
extras: Silver Ingot
|
||||||
input: Cinnabar, Lead Ore
|
input: Cinnabar, Lead Ore
|
||||||
@@ -2031,14 +2031,6 @@ item: Silver Gear
|
|||||||
tools: Crafting Table
|
tools: Crafting Table
|
||||||
|
|
||||||
item: Silver Ingot
|
item: Silver Ingot
|
||||||
recipe:
|
|
||||||
input: Pulverized Silver, furnace fuel
|
|
||||||
pattern: .0. ... .1.
|
|
||||||
tools: Furnace
|
|
||||||
recipe:
|
|
||||||
input: Pulverized Silver
|
|
||||||
pattern: ... .0. ...
|
|
||||||
tools: Redstone Furnace
|
|
||||||
recipe:
|
recipe:
|
||||||
input: Silver Ore, furnace fuel
|
input: Silver Ore, furnace fuel
|
||||||
pattern: .0. ... .1.
|
pattern: .0. ... .1.
|
||||||
@@ -2047,6 +2039,14 @@ item: Silver Ingot
|
|||||||
input: Silver Ore
|
input: Silver Ore
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
tools: Redstone Furnace
|
tools: Redstone Furnace
|
||||||
|
recipe:
|
||||||
|
input: Pulverized Silver, furnace fuel
|
||||||
|
pattern: .0. ... .1.
|
||||||
|
tools: Furnace
|
||||||
|
recipe:
|
||||||
|
input: Pulverized Silver
|
||||||
|
pattern: ... .0. ...
|
||||||
|
tools: Redstone Furnace
|
||||||
recipe:
|
recipe:
|
||||||
extras: Lead Ingot
|
extras: Lead Ingot
|
||||||
input: Cinnabar, Silver Ore
|
input: Cinnabar, Silver Ore
|
||||||
@@ -2149,14 +2149,6 @@ item: Tin Gear
|
|||||||
tools: Crafting Table
|
tools: Crafting Table
|
||||||
|
|
||||||
item: Tin Ingot
|
item: Tin Ingot
|
||||||
recipe:
|
|
||||||
input: Pulverized Tin, furnace fuel
|
|
||||||
pattern: .0. ... .1.
|
|
||||||
tools: Furnace
|
|
||||||
recipe:
|
|
||||||
input: Pulverized Tin
|
|
||||||
pattern: ... .0. ...
|
|
||||||
tools: Redstone Furnace
|
|
||||||
recipe:
|
recipe:
|
||||||
input: Tin Ore, furnace fuel
|
input: Tin Ore, furnace fuel
|
||||||
pattern: .0. ... .1.
|
pattern: .0. ... .1.
|
||||||
@@ -2165,6 +2157,14 @@ item: Tin Ingot
|
|||||||
input: Tin Ore
|
input: Tin Ore
|
||||||
pattern: ... .0. ...
|
pattern: ... .0. ...
|
||||||
tools: Redstone Furnace
|
tools: Redstone Furnace
|
||||||
|
recipe:
|
||||||
|
input: Pulverized Tin, furnace fuel
|
||||||
|
pattern: .0. ... .1.
|
||||||
|
tools: Furnace
|
||||||
|
recipe:
|
||||||
|
input: Pulverized Tin
|
||||||
|
pattern: ... .0. ...
|
||||||
|
tools: Redstone Furnace
|
||||||
recipe:
|
recipe:
|
||||||
extras: Iron Ingot
|
extras: Iron Ingot
|
||||||
input: Cinnabar, Tin Ore
|
input: Cinnabar, Tin Ore
|
||||||
|
|||||||
@@ -47,9 +47,11 @@ module.exports = class CraftingPlan extends BaseModel
|
|||||||
@result.addInventory @have
|
@result.addInventory @have
|
||||||
|
|
||||||
@steps = {}
|
@steps = {}
|
||||||
|
@_reservedSteps = {}
|
||||||
@want.each (stack)=>
|
@want.each (stack)=>
|
||||||
@_findSteps stack.slug
|
@_findSteps stack.slug
|
||||||
@need.add stack.slug, stack.quantity
|
@need.add stack.slug, stack.quantity
|
||||||
|
@_reservedSteps = null
|
||||||
|
|
||||||
@steps = _.values @steps
|
@steps = _.values @steps
|
||||||
@_resolveNeeds()
|
@_resolveNeeds()
|
||||||
@@ -89,7 +91,6 @@ module.exports = class CraftingPlan extends BaseModel
|
|||||||
# Private Methods ##############################################################################
|
# Private Methods ##############################################################################
|
||||||
|
|
||||||
_addStep: (recipe)->
|
_addStep: (recipe)->
|
||||||
return if @_hasStep recipe.slug
|
|
||||||
logger.verbose "adding step: #{recipe.slug}"
|
logger.verbose "adding step: #{recipe.slug}"
|
||||||
@steps[recipe.slug] = recipe:recipe
|
@steps[recipe.slug] = recipe:recipe
|
||||||
|
|
||||||
@@ -97,6 +98,7 @@ module.exports = class CraftingPlan extends BaseModel
|
|||||||
return item.getPrimaryRecipe()
|
return item.getPrimaryRecipe()
|
||||||
|
|
||||||
_findSteps: (slug)->
|
_findSteps: (slug)->
|
||||||
|
logger.debug "finding steps for #{slug}"
|
||||||
item = @modPack.findItem slug
|
item = @modPack.findItem slug
|
||||||
return unless item?
|
return unless item?
|
||||||
return unless item.isCraftable
|
return unless item.isCraftable
|
||||||
@@ -109,13 +111,19 @@ module.exports = class CraftingPlan extends BaseModel
|
|||||||
if not @_hasStep toolStack.slug
|
if not @_hasStep toolStack.slug
|
||||||
@_findSteps toolStack.slug
|
@_findSteps toolStack.slug
|
||||||
|
|
||||||
|
return if @_hasStep item.slug
|
||||||
|
logger.debug "reserving: #{item.slug}"
|
||||||
|
@_reservedSteps[item.slug] = recipe
|
||||||
|
|
||||||
for inputStack in recipe.input
|
for inputStack in recipe.input
|
||||||
@_findSteps inputStack.slug
|
@_findSteps inputStack.slug
|
||||||
|
|
||||||
@_addStep recipe
|
@_addStep recipe
|
||||||
|
|
||||||
_hasStep: (slug)->
|
_hasStep: (slug)->
|
||||||
return @steps[slug]?
|
return true if @steps[slug]?
|
||||||
|
return true if @_reservedSteps[slug]?
|
||||||
|
return false
|
||||||
|
|
||||||
_removeExtraSteps: ->
|
_removeExtraSteps: ->
|
||||||
result = (step for step in @steps when step.multiplier > 0)
|
result = (step for step in @steps when step.multiplier > 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user