Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local success, block = turtle.inspectUp()
- local success, bottom = turtle.inspectDown()
- halt = 0
- wait = 0
- up = 0
- local modem = peripheral.wrap("left")
- function imMaster()
- t = peripheral.wrap("front")
- for i = 1,15 do
- turtle.suckUp(1)
- turtle.place()
- peripheral.call("front", "turnOn")
- print("Turtle", i, " deployed!")
- if turtle.place() == false then
- wait = 1
- while wait == 1 do
- sleep(1)
- turtle.detect()
- if turtle.detect() == false then
- wait = 0
- end
- end
- turtle.place()
- end
- end
- turtle.forward()
- turtle.digDown()
- end
- function position()
- while halt == 0 do
- turtle.forward()
- if turtle.detect() == true then
- halt = 1
- end
- end
- halt = 0
- turtle.turnLeft()
- end
- function imSlave()
- if turtle.detectUp() == false then
- up = 1
- while up == 1 do
- turtle.up()
- if turtle.detectUp() == true then
- up = 0
- turtle.turnRight()
- end
- end
- if turtle.detect() == false then
- while halt == 0 do
- turtle.forward()
- if turtle.detect() == true then
- halt = 1
- end
- end
- halt = 0
- end
- turtle.turnLeft()
- turtle.digDown()
- else
- turtle.turnRight()
- if turtle.detect() == false then
- while halt == 0 do
- turtle.forward()
- if turtle.detect() == true then
- halt = 1
- end
- end
- halt = 0
- end
- turtle.turnLeft()
- turtle.digDown()
- end
- end
- if block.name == "minecraft:shulker_box" then
- imMaster()
- else
- imSlave()
- end
- rednet.open("left", 1)
- while true do
- id, msg = rednet.receive()
- print(msg)
- if msg == "tunnel" then
- for i = 1,50 do
- turtle.dig()
- turtle.forward()
- print(i)
- end
- turtle.turnLeft()
- turtle.turnLeft()
- for i = 1,50 do
- turtle.dig()
- turtle.forward()
- print(i)
- end
- sleep(10)
- if turtle.detectDown() == false then
- print("Im on bottom")
- for i = 1,3 do
- turtle.digUp()
- turtle.up()
- end
- for i = 1,3 do
- turtle.down()
- end
- turtle.turnLeft()
- local success, chest = turtle.inspect()
- if chest.name == "minecraft:chest" then
- for i = 1,4 do
- for i = 1,16 do
- turtle.select(i)
- turtle.drop()
- end
- sleep(2)
- end
- turtle.turnLeft()
- turtle.turnLeft()
- for i = 1,3 do
- turtle.dig()
- turtle.forward()
- end
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- turtle.turnRight()
- else
- for i = 1,4 do
- for i = 1,16 do
- turtle.select(i)
- turtle.drop()
- end
- end
- end
- else
- sleep(20)
- end
- end
- end
Add Comment
Please, Sign In to add comment