Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --this code is for the computercrafted turtles (this mod is used in modpacks like ftb revelations and tekkit)
- --to run this program you need to type the name followed by how long how deep and how wide(to the left) you want to make it and if you want it to go up or down (1 = up -1 = down)
- --as an example "excavate 10 5 6 1" here I make the hole 10 long 5 deep and 6 wide to the left and go up
- local tArgs = {...}
- if #tArgs~=4 then
- print("specefie x, y and z and what direction (1 = up -1 = down)")
- local xc, yc, zc, direct = read()
- else
- xc = tonumber(tArgs[1])-1
- yc = tonumber(tArgs[2])-1
- zc = tonumber(tArgs[3])-1
- direct = tonumber(tArgs[4])
- end
- function info()
- print("fuel: "..turtle.getFuelLevel())
- print(" x: "..xc+1)
- print(" y: "..yc+1)
- print(" z: "..zc+1)
- print("program by: wv1106 on reddit and pastebin")
- end
- function nl()
- if direct==1 then
- turtle.digUp()
- turtle.up()
- elseif direct ==-1 then
- turtle.digDown()
- turtle.down()
- else
- print("1 = up -1 = down")
- end
- end
- function mine()
- while turtle.detect() do
- turtle.dig()
- end
- end
- function move()
- while not turtle.forward() do
- if turtle.attack() then
- turtle.suck()
- else
- if turtle.getFuelLevel()<10 then
- turtle.refuel()
- end
- end
- end
- end
- function lturn()
- turtle.turnLeft()
- mine()
- move()
- turtle.turnLeft()
- end
- function rturn()
- turtle.turnRight()
- mine()
- move()
- turtle.turnRight()
- end
- function ehome()
- turtle.turnRight()
- for b=1,zc do
- move()
- end
- turtle.turnRight()
- end
- function ohome()
- turtle.turnLeft()
- for b=1,zc do
- move()
- end
- turtle.turnLeft()
- for l=1,xc do
- move()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function layer()
- for b=1,zc do
- for l=1,xc do
- mine()
- move()
- end
- if (b % 2 == 0) then
- lturn()
- else
- rturn()
- end
- end
- for l=1,xc do
- mine()
- move()
- end
- if (zc % 2 == 0) then
- ohome()
- else
- ehome()
- end
- end
- --here startts the actual program
- info()
- for d=1,yc do
- layer()
- nl()
- end
- layer()
- for d=1,yc do
- if direct==1 then
- while not turtle.down() do
- turtle.attackUp()
- end
- elseif direct==-1 then
- while not turtle.up() do
- turtle.attackUp()
- end
- else
- print("error direction not specefied")
- end
- end
- print("finished!")
Add Comment
Please, Sign In to add comment