Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Ghetto tesseract part 2: Discharging.
- -- Needs to be run in parallel with another turtle running part 1.
- -- Use with thermal expansion energy cells.
- -- Place Ender Chest above the turtle and the energy cell below. Make sure the cell plugs into something that will charge it.
- -- Configure all sides of the energy cell to be output, bottom to be input.
- -- Sleep to avoid overlapping grabs.
- os.sleep(1)
- function discharge ()
- -- Wrap the peripheral
- battery = peripheral.wrap("bottom")
- -- This charges the energy cell
- while battery.getEnergyStored() > 0 do
- print("Energy at "..battery.getEnergyStored()..". Picking up.")
- os.sleep(2)
- end
- -- Now pick up the cell and put it into the ender chest.
- turtle.digDown()
- turtle.dropUp()
- os.sleep(10)
- end
- function place_for_discharge()
- -- Take the empty cell from the chest and put it down for recharge
- while not turtle.suckUp() do
- os.sleep(2)
- end
- turtle.placeDown()
- end
- function main()
- while true do
- if turtle.detectDown() then
- discharge()
- else
- place_for_discharge()
- end
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement