diff --git a/src/client/models/crafting/crafting_plan.coffee b/src/client/models/crafting/crafting_plan.coffee index 7103364c0..75535f14a 100644 --- a/src/client/models/crafting/crafting_plan.coffee +++ b/src/client/models/crafting/crafting_plan.coffee @@ -46,16 +46,21 @@ module.exports = class CraftingPlan recipe = step.recipe for stack in step.recipe.output + continue if recipe.isPassThroughFor stack.itemSlug qualifiedSlug = @_modPack.qualifySlug stack.itemSlug - if recipe.isPassThroughFor stack.itemSlug + while @_need.quantityOf(qualifiedSlug) > 0 + @_executeStep step + + if step.multiplier > 0 + for stack in step.recipe.output + qualifiedSlug = @_modPack.qualifySlug stack.itemSlug + continue unless recipe.isPassThroughFor stack.itemSlug + continue if @_made.hasAtLeast qualifiedSlug, 1 continue if @_need.hasAtLeast qualifiedSlug, 1 continue if @_tools.hasAtLeast qualifiedSlug, 1 @_need.add qualifiedSlug, 1 @_tools.add qualifiedSlug, 1 - else - while @_need.quantityOf(qualifiedSlug) > 0 - @_executeStep step @_made.addInventory @_want @_made.addInventory @_tools diff --git a/src/client/models/crafting/crafting_step.coffee b/src/client/models/crafting/crafting_step.coffee index 4eb743558..529f7bffe 100644 --- a/src/client/models/crafting/crafting_step.coffee +++ b/src/client/models/crafting/crafting_step.coffee @@ -31,6 +31,7 @@ module.exports = class CraftingStep completeInto: (targetInventory)-> for stack in @_recipe.output + continue if @_recipe.isPassThroughFor stack.itemSlug quantity = @_recipe.getQuantityProduced stack.itemSlug targetInventory.add stack.itemSlug, quantity * @_multiplier diff --git a/src/client/models/crafting/craftsman.coffee b/src/client/models/crafting/craftsman.coffee index 0eca8bea3..613181454 100644 --- a/src/client/models/crafting/craftsman.coffee +++ b/src/client/models/crafting/craftsman.coffee @@ -40,10 +40,9 @@ module.exports = class Craftsman extends BaseModel @_modPack = modPack reset = _.debounce (=> @reset()), 100 - reevaluatePlans = _.debounce (=> @reevaluatePlans()), 100 @_have = new Inventory modPack:@_modPack - @_have.on c.event.change, reevaluatePlans + @_have.on c.event.change, reset @_want = new Inventory modPack:@_modPack @_want.on c.event.change, reset @@ -55,14 +54,6 @@ module.exports = class Craftsman extends BaseModel # Public Methods ############################################################################### - reevaluatePlans: -> - @_plans = null - @_planEvaluator = null - @stage = @STAGE.WAITING - @stageCount = 0 - - @_scheduleNextWork() - reset: -> @_graphBuilder = null @_planBuilder = null diff --git a/src/client/site/craft_page/craft_page_controller.coffee b/src/client/site/craft_page/craft_page_controller.coffee index 09e8c494d..e7f3871bb 100644 --- a/src/client/site/craft_page/craft_page_controller.coffee +++ b/src/client/site/craft_page/craft_page_controller.coffee @@ -33,10 +33,9 @@ module.exports = class CraftPageController extends PageController @_router = options.router @_storage = options.storage - # c.event Methods ################################################################################ + # Event Methods ################################################################################ onHaveInventoryChanged: -> - logger.warning => "storing have: #{@model.craftsman.have.unparse()}" @_storage.store 'crafting-plan:have', @model.craftsman.have.unparse() onMoveNeedToHave: (itemSlug)-> @@ -89,7 +88,6 @@ module.exports = class CraftPageController extends PageController router: @_router @_haveInventoryController.on c.event.button.first, (controller, itemSlug)=> @onRemoveFromHaveInventory itemSlug - @_haveInventoryController.on c.event.change, (c)=> @onHaveInventoryChanged() @_needInventoryController = @addChild InventoryController, '.need .view__inventory', editable: false @@ -117,6 +115,7 @@ module.exports = class CraftPageController extends PageController onWillRender: -> @model.craftsman.have.clear() @model.craftsman.have.parse @_storage.load('crafting-plan:have') + @model.craftsman.have.on c.event.change, => @onHaveInventoryChanged() super refresh: -> diff --git a/src/client/site/news_page/news_page.jade b/src/client/site/news_page/news_page.jade index 233bb7cef..34ab09467 100644 --- a/src/client/site/news_page/news_page.jade +++ b/src/client/site/news_page/news_page.jade @@ -10,6 +10,19 @@ .view__adsense .right + section + h3 2016-04-16 + .panel + p. + I've been working on adding a new mod, and I ran across a bug which has been in the system for a + while now, but which will cause serious problems with a lot of the recipes in the new mod. So, I put + the mod aside for a bit to fix it. + p. + The bug was that when you are making something like an Oak Wood Cover the saw wouldn't be part of the crafting plan. This isn't + such a big deal for most things, but for this new mod, it would have been a major problem. + section h3 2016-04-14 .panel