brewing station auto learn

This commit is contained in:
kepler155c
2018-10-28 03:24:32 -04:00
parent 763f6bb27a
commit b96c064431
5 changed files with 64 additions and 22 deletions

View File

@@ -1,4 +1,3 @@
local Craft = require('turtle.craft')
local itemDB = require('itemDB')
local Milo = require('milo')
local UI = require('ui')
@@ -8,8 +7,6 @@ local colors = _G.colors
local device = _G.device
local turtle = _G.turtle
local MACHINE_LOOKUP = 'usr/config/machine_crafting.db'
local context = Milo:getContext()
local machineLearnWizard = UI.Page {
@@ -117,17 +114,7 @@ function pages.confirmation:validate()
recipe.ingredients[k] = Milo:uniqueKey(v)
end
local key = Milo:uniqueKey(result)
-- save the recipe
context.userRecipes[key] = recipe
Util.writeTable(Milo.RECIPES_FILE, context.userRecipes)
-- save the machine association
Craft.machineLookup[key] = machine.name
Util.writeTable(MACHINE_LOOKUP, Craft.machineLookup)
Craft.loadRecipes()
Milo:saveMachineRecipe(recipe, result, machine.name)
local listingPage = UI:getPage('listing')
local displayName = itemDB:getName(result)