Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Advanced StripMine API for DanetOS3
- local tArgs = { ... }
- if #tArgs == nil then
- print("Strip Mine ERROR: Incorrect Usage. StripMine <direction> <direction2> <offset> <distance>")
- return
- end
- function dropoffItems()
- turtle.select(1)
- if turtle.refuel(0) then --Skip the fuel if there is any
- print("SUCCESS! Fuel Detected. Not Dropping.")
- else
- turtle.dropDown()
- end
- for x=3,16 do --Drop items into chest below
- turtle.select(x)
- turtle.dropDown()
- end
- end
- --MAIN INSTRUCTIONS GO HERE
- cardinalDirection = tArgs[1]
- cardinalDirection2 = tArgs[2]
- offset = tonumber(tArgs[3])
- distance = tonumber(tArgs[4])
- local fuelNeeded = offset * 2
- shell.run("TurtleRefuel " .. offset) --Refuel for the movement trip
- if cardinalDirection == "north" or cardinalDirection == "south" then
- turtle.up()
- shell.run("TurnToFace " .. cardinalDirection) --Turn the turtle to face the direction it's going to be going
- else
- print("Strip Mine ERROR! Must define a valid direction. Please use north or south.")
- os.wait(10)
- shell.run("reboot")
- end
- while not turtle.forward() do sleep(0.5) end --Go one forward
- if cardinalDirection2 == "east" or cardinalDirection2 == "west" then
- shell.run("TurnToFace " .. cardinalDirection2) --Turn to face the hallway direction to go in
- for x=0,offset do --Go that many blocks down the hallway
- while not turtle.forward() do sleep(0.5) end
- end
- else
- print("Strip Mine ERROR! Must define a valid 2nd direction. Please use east or west.")
- os.wait(10)
- shell.run("reboot")
- end
- --DIG TIME!
- shell.run("TurnToFace " .. cardinalDirection) --Turn to face the first cardinal direction.
- shell.run("BasicDig " .. distance .. " 4 true")
- --TIME TO GO BACK!
- if cardinalDirection2 == "east" then
- shell.run("TurnToFace west")
- else
- shell.run("TurnToFace east")
- end
- for x=0,offset do --Go that many blocks down the hallway
- while not turtle.forward() do sleep(0.5) end
- end
- if cardinalDirection == "north" then
- shell.run("TurnToFace south")
- else
- shell.run("TurnToFace north")
- end
- while not turtle.forward() do sleep(0.5) end --Go one forward
- shell.run("TurnToFace north") --Always end up turning north
- turtle.down()
- dropoffItems()
- print("SUCCESS! StripMine Complete.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement