123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
comp = require("component")
cap = comp.getPrimary("tile_blockcapacitorbank_name")
ae = comp.getPrimary("tilecontroller")
filesystem = require("filesystem")
toCraft = {
["item.stick"] = 1000 ,
["tile.pistonBase"] = 100 ,
["tile.pistonStickyBase"] = 100,
["enderio.conduitBinder"] = 250,
["tile.chest"] = 128,
["item.blazePowder"] = 64,
["item.goldNugget"] = 400,
["enderio.electricalSteel"] = 64,
["enderio.phasedGold"] = 64,
["enderio.energeticAlloy"] = 64,
["enderio.redstoneAlloy"] = 64,
["item.appliedenergistics2.ItemPart.QuartzFiber"] = 64,
["item.appliedenergistics2.ItemMaterial.FormationCore"] = 32,
["item.appliedenergistics2.ItemMaterial.AnnihilationCore"] = 32,
["tile.appliedenergistics2.BlockInterface"] = 12,
["item.appliedenergistics2.ItemMaterial.FluixPearl"] = 8,
["tile.thermalexpansion.glass.name"] = 128,
["item.thermalfoundation.material.ingotElectrum"] = 128,
["item.thermalfoundation.material.ingotInvar"] = 128,
["item.thermalfoundation.material.ingotSignalum"] = 64,
["item.thermalfoundation.material.ingotEnderium"] = 256
}
crafting = {}
function checkCrafting(name)
if crafting[name] == nil then
return true
elseif crafting[name].isDone() then
print(name,"done")
crafting[name] = nil
return true
else
return false
end
end
function craftingManager()
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) and number-j.getItemStack().size > 0 then
crafting[name] = j.request(number-j.getItemStack().size)
if crafting[name] == nil then
print("failed requesting "..number-j.getItemStack().size .. " x " .. name)
else
print("succesfully requested "..number-j.getItemStack().size .. " x " .. name)
end
end
break;
end
end
end
end
end
function main()
a = true
while true do
craftingManager()
energy = cap.getEnergyStored()
os.sleep(1)
end
end
main()