Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args = {...}
- m = peripheral.wrap("front")
- turtle.select(1)
- placer = args[1] ~= nil and args[1] == "placer"
- function rfPercentage()
- m = peripheral.wrap("front")
- if m == nil then
- return -1
- end
- return math.floor(100 * (m.getEnergyStored() or 0) / m.getRFCapacity())
- end
- function getNew()
- while turtle.suckUp() do end
- slot = 1
- finished = false
- while turtle.getItemCount() > 0 and (not found) do
- turtle.select(slot)
- turtle.place()
- percentage = rfPercentage()
- if (not placer and percentage ~= 100) or (placer and percentage == 100) then
- finished = true
- else
- turtle.dig()
- end
- slot = slot + 1
- if slot == 17 then
- finished = true
- else
- turtle.select(slot)
- end
- end
- for i = 1, 16 do
- turtle.select(i)
- turtle.dropUp()
- end
- end
- print(placer)
- while true do
- percentage = rfPercentage()
- if placer then
- if percentage < 1 then
- turtle.dig()
- getNew()
- end
- else
- if percentage == -1 or percentage == 100 then
- turtle.dig()
- getNew()
- end
- end
- os.sleep(60)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement