Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Number of neighbouring turtles
- numberNeighbours = 2
- -- Open up modem to receive wireless broadcasts
- rednet.open("right")
- -- Wait until neighbouring turtles are ready
- function waitForNeighbours(localRowsProgressed)
- local remoteTurtleID, remoteRowsProgressed
- -- Wait for all neighbours to have done same number of rows as master
- for i=1, numberNeighbours do
- repeat
- -- Find how many rows the current remote turtle has done
- remoteTurtleID, remoteRowsProgressed, _ = rednet.receive()
- remoteRowsProgressed = string.match( remoteRowsProgressed, "ROW<%d+>" )
- remoteRowsProgressed = string.match( remoteRowsProgressed, "%d+" )
- remoteRowsProgressed = tonumber( remoteRowsProgressed )
- -- If this is a valid rednet message, and remote turtle is lagging behind, tell him to continue
- if (remoteRowsProgressed ~= nil) and (remoteRowsProgressed < localRowsProgressed) then
- rednet.send(remoteTurtleID, "You are authorised to proceed")
- end
- until localRowsProgressed == remoteRowsProgressed
- end
- rednet.broadcast("You are authorised to proceed")
- end
- bool=true
- while bool==true do
- if rs.getInput("back", true) then
- print ("Waiting")
- sleep (1)
- else
- print ("Let's Roll!")
- bool=false
- end
- end
- X=3
- print ("Startup Functions Activating")
- print ("Going to lowest point")
- turtle.select(3)
- turtle.back()
- for a = 1, X do
- turtle.digDown()
- turtle.attackDown()
- turtle.attackDown()
- turtle.attackDown()
- turtle.attackDown()
- turtle.attackDown()
- turtle.attackDown()
- turtle.attackDown()
- turtle.attackDown()
- turtle.attackDown()
- turtle.attackDown()
- turtle.attackDown()
- turtle.attackDown()
- turtle.attackDown()
- turtle.attackDown()
- turtle.attackDown()
- turtle.attackDown()
- turtle.attackDown()
- turtle.attackDown()
- turtle.attackDown()
- turtle.attackDown()
- turtle.down()
- end
- for b = 1, X do
- turtle.digUp()
- while not turtle.up() do
- turtle.attackUp()
- end
- end
- print ("Calibrated level for a flat bedrock world.")
- print ("---------------------------")
- print ("Starting World Eating Scripts!")
- print ("---------------------------")
- turtle.dig()
- while not turtle.forward() do
- turtle.attack()
- end
- while true do
- for i = 1, 2 do
- for c = 1, X do
- turtle.dig()
- turtle.digDown()
- while not turtle.down() do
- turtle.attackDown()
- end
- end
- for d = 1, X do
- turtle.dig()
- turtle.digUp()
- while not turtle.up() do
- turtle.attackUp()
- end
- end
- for r = 1, 2 do
- turtle.dig()
- while not turtle.forward() do
- turtle.attack()
- end
- end
- Fuel = turtle.getFuelLevel()
- print ("Fuel level is: "..Fuel)
- if Fuel >= 8192 then
- print ("Fuel level is above minimum safe limit.")
- print ("Refueling anyway")
- turtle.select(1)
- for slot = 3, 16 do
- result = turtle.compareTo(slot)
- if result == true then
- turtle.select(slot)
- turtle.refuel()
- turtle.select(1)
- print ("Refueled on slot "..slot)
- else
- end
- end
- else
- print ("Fuel is below safe limit! Not collecting enough coal!")
- turtle.select(1)
- for slot = 3, 16 do
- result = turtle.compareTo(slot)
- if result == true then
- turtle.select(slot)
- turtle.refuel()
- turtle.select(1)
- print ("Refueled on slot "..slot)
- else
- end
- end
- end
- turtle.select(2)
- print ("Dropping off items")
- turtle.dig()
- while not turtle.place() do
- turtle.attack()
- end
- for dropslot = 3, 16 do
- turtle.select(dropslot)
- turtle.drop()
- end
- waitForNeighbours()
- turtle.select(2)
- turtle.dig()
- turtle.select(3)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement