Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local enterPathing = {"south", "goto", 2, 0, 0, "drop-off", "right", "forward", "up", "forward", "eatme"}
- local exitPathing = {"fuel", "forward", "forward", "forward", "forward", "forward"}
- gps.CHANNEL_GPS = 5033
- local modem = peripheral.wrap("left")
- local stationReturn = {
- x = 2,
- y = 0,
- z = -2
- }
- modem.open(5037)
- function makeSendData(destinationX, destinationY, destinationZ)
- parentLocation = {gps.locate()}
- sendData = {
- destination = {
- x = destinationX,
- y = destinationY,
- z = destinationZ,
- direction = 1
- },
- returnPoint = {
- x = stationReturn.x + parentLocation[1],
- y = stationReturn.y + parentLocation[2],
- z = stationReturn.z + parentLocation[3]
- },
- exitPath = exitPathing,
- enterPath = enterPathing,
- parentLocation = parentLocation
- }
- return sendData
- end
- function dispatchBot(sendData)
- turtle.select(findTurtle())
- while turtle.inspect() do
- print("No space to place turtle")
- sleep(0.5)
- end
- while not turtle.inspect() do
- turtle.place()
- sleep(0.5)
- end
- local turtleChild = peripheral.wrap("front")
- turtleChild.turnOn()
- connecting = true
- while connecting do
- print("waiting...")
- messageData = {os.pullEvent('modem_message')}
- if messageData[5] == 'created' then
- print("created")
- connecting = false
- modem.transmit(messageData[4], messageData[3], sendData)
- sleep(2)
- return true
- end
- end
- end
- function findTurtle()
- for i=1, 16, 1 do
- data = turtle.getItemDetail(i)
- if data.name == "computercraft:turtle_advanced" then
- return i
- end
- end
- print("no turtles in inventory")
- return nil
- end
- print("What Y value would you like the ceiling to be?: ")
- ceiling = io.read()
- print(ceiling)
- print("How many slices deep would you like to go? (each slice is 3 blocks): ")
- slices = io.read()
- print(slices)
- if slices == 0 then
- print("You specified a depth of zero therefor nothing will be done... (exiting)")
- exit()
- end
- currentLocation = {gps.locate()}
- for x=1, 5, 1 do
- dispatchX = x*16-16+(currentLocation[1]-40)
- for y=1, 5, 1 do
- dispatchZ = x*16-16+(currentLocation[3]-40)
- for i=1, slices, 1 do
- dispatchY = (ceiling-(slices*3)-1)+(i*3)
- dispatchBot(makeSendData(dispatchX, dispatchY, dispatchZ))
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement