comp = require("component")
cap = comp.getPrimary("tile_blockcapacitorbank_name")
ae = comp.getPrimary("tilecontroller")
filesystem = require("filesystem")
tocraft = { ["tile.pistonBase"] = 100 }
crafting = {}
function checkCrafting(name)
if crafting[name] == nil then
return true
elseif crafting[name].isDone() then
crafting[name] = nil
return true
else
return false
end
end
function crafting()
local craftables = ae.getCraftables()
for name,number in pairs(tocraft) do
for i,j in pairs(craftables) do
if not(i == "n") then
if (j.getItemStack().name == name) then
if checkCrafting(name) then
crafting[name] = j.request(number-j.getItemStack().size)
end
break;
end
end
end
end
end
function main()
a = true
while true do
crafting()
energy = cap.getEnergyStored()
os.sleep(1)
end
end
main()