cleanup
This commit is contained in:
parent
c78597a8fb
commit
760729ee4b
14 changed files with 126 additions and 102 deletions
|
@ -1,11 +1,15 @@
|
|||
pp = require("cc.pretty")
|
||||
require("keep_stocked")
|
||||
require("recipes")
|
||||
sfx = require("sfx")
|
||||
require("pathfinding")
|
||||
use_machine = require("machines")
|
||||
require("inventory")
|
||||
|
||||
keep_stocked = {
|
||||
kelp = 10,
|
||||
flint = 10
|
||||
}
|
||||
|
||||
go_to(vector.new(0,0,0), "south")
|
||||
recipes = load_recipes()
|
||||
|
||||
|
@ -89,15 +93,13 @@ function tryCreating(recipe)
|
|||
if len(missing_ingredients) == 0 then
|
||||
todo[#todo] = nil
|
||||
turtle.select(1)
|
||||
-- todo exclude deploy_tool too and make it get its own tool
|
||||
if recipe.steps[1].machine ~= "craft" then
|
||||
for item, count in pairs(ingredients) do
|
||||
takeItems(item, count)
|
||||
end
|
||||
end
|
||||
doRecipe(current_recipe)
|
||||
-- for item, min_count in pairs(getMissing(keep_stocked)) do
|
||||
-- table.insert(todo, recipes[item])
|
||||
-- end
|
||||
return nil
|
||||
end
|
||||
return missing_ingredients
|
||||
|
@ -113,18 +115,6 @@ while #todo > 0 do
|
|||
pp.pretty_print(ingredients)
|
||||
missing_ingredients = tryCreating(current_recipe)
|
||||
if missing_ingredients then
|
||||
-- missing_ingredients = getMissing(ingredients)
|
||||
-- if len(missing_ingredients) == 0 then
|
||||
-- todo[#todo] = nil
|
||||
-- turtle.select(1)
|
||||
-- for item, count in pairs(ingredients) do
|
||||
-- takeItems(item, count)
|
||||
-- end
|
||||
-- doRecipe(current_recipe)
|
||||
-- for item, min_count in pairs(getMissing(keep_stocked)) do
|
||||
-- table.insert(todo, recipes[item])
|
||||
-- end
|
||||
-- else
|
||||
wait_for = listUncraftable(missing_ingredients)
|
||||
while len(wait_for) > 0 do
|
||||
for name,count in pairs(wait_for) do
|
||||
|
@ -141,15 +131,10 @@ while #todo > 0 do
|
|||
for name, count in pairs(missing_ingredients) do
|
||||
if recipes[name] then
|
||||
print("first making", count, name)
|
||||
-- for i = 1,count do
|
||||
table.insert(todo, recipes[name])
|
||||
-- end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- print("aaa")
|
||||
-- read()
|
||||
end
|
||||
print("done!")
|
||||
sfx.success()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue