From bcf08b0fe3e91b17a582370ef535b8464de5aea6 Mon Sep 17 00:00:00 2001 From: kepler155c Date: Fri, 26 Jan 2018 07:19:42 -0500 Subject: [PATCH] autocrafting fix --- apps/chestManager.lua | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/apps/chestManager.lua b/apps/chestManager.lua index a45c118..9d9095a 100644 --- a/apps/chestManager.lua +++ b/apps/chestManager.lua @@ -1233,21 +1233,22 @@ function craftPage.wizard:eventHandler(event) return UI.Wizard.eventHandler(self, event) end +function craftPage.wizard.pags.resources:enable() + local items = listItems() + local count = tonumber(self.parent.quantity.count.value) + local recipe = Craft.findRecipe(self.item) + local ingredients = Craft.getResourceList4(recipe, items, count) + for _,v in pairs(ingredients) do + v.displayName = itemDB:getName(v) + end + self.grid:setValues(ingredients) + return UI.Window.enable(self) +end + function craftPage:eventHandler(event) if event.type == 'cancel' then UI:setPreviousPage() - elseif event.type == 'enable_view' and event.next then - local items = listItems() - local count = tonumber(self.wizard.pages.quantity.count.value) - local recipe = Craft.findRecipe(self.item) - local ingredients = Craft.getResourceList4(recipe, items, count) - for _,v in pairs(ingredients) do - v.displayName = itemDB:getName(v) - end - self.wizard.pages.resources.grid:setValues(ingredients) - return false - elseif event.type == 'accept' then local key = uniqueKey(self.item) demandCrafting[key] = Util.shallowCopy(self.item)