Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if not turtle then
- write("this program need narrsic turtle")
- shell.exit()
- end
- function isEmptyPhial( target )
- if target and target.display_name and target.display_name == "Glass Phial" then
- return true
- end
- if target and target.damage and target.name
- and target.damage == 0
- and target.name == "Thaumcraft:ItemEssence" then
- return true
- end
- return false
- end
- function pickRefuel( fuel )
- for i = 1, 16 do
- local ans = turtle.getItemDetail(i)
- if ans and fuel and fuel.id and ans.name == fuel.id then
- turtle.select(i)
- turtle.refuel()
- turtle.select(1)
- break
- end
- end
- end
- function init()
- while not turtle.detectDown() do
- turtle.down()
- end
- if peripheral.wrap("bottom") and peripheral.wrap("bottom").getAllStacks then
- local chest = peripheral.wrap("bottom")
- for i = 1, 16 do
- if turtle.getItemCount(i) > 0 then
- chest.pullItem("up",i)
- end
- end
- local phailMany = 0
- for k, v in pairs(chest.getAllStacks()) do
- if turtle.getFuelLevel() < 20 and v.all().burn_time then
- chest.pushItem("up",k)
- pickRefuel( v.all() )
- end
- if isEmptyPhial(v.all()) and phailMany < 64 then
- local chestin = v.all().qty
- chest.pushItem("up",k,64 - phailMany)
- phailMany = phailMany + chestin
- end
- end
- else
- write("need under chest")
- shell.exit()
- end
- end
- function phialTarget()
- for i = 1, 16 do
- if isEmptyPhial( turtle.getItemDetail(i) ) then
- turtle.select(i)
- turtle.place()
- turtle.select(1)
- break
- end
- end
- end
- function isSideThaum(side)
- if peripheral.wrap(side) and peripheral.wrap(side).getAspects then
- return true
- end
- return false
- end
- function Phialing()
- if isSideThaum("front") then
- local asps = peripheral.wrap("front").getAspects()
- if asps[1] and peripheral.wrap("front").getAspectCount( asps[1] ) >= 8 then
- while peripheral.wrap("front").getAspectCount( asps[1] ) >= 8 do
- phialTarget()
- sleep(0.5)
- end
- end
- end
- end
- function isAspectFillLevel(side,lvl)
- if isSideThaum(side) then
- local asps = peripheral.wrap(side).getAspects()
- if asps[1] and peripheral.wrap(side).getAspectCount( asps[1] ) >= lvl then
- return true
- end
- end
- return false
- end
- function WatchWaiting()
- while not isAspectFillLevel("front",8) do
- sleep(1)
- end
- end
- while true do
- init()
- WatchWaiting()
- Phialing()
- for i = 1, 4 do
- if not turtle.up() then
- break
- end
- Phialing()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement