Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sendID, msg, prot = rednet.receive()
- function move(direction)
- if direction == "up" then
- while turtle.up() == false do
- turtle.digUp()
- turtle.attackUp()
- end
- elseif direction == "down" then
- while turtle.down() == false do
- turtle.digDown()
- turtle.attackDown()
- end
- elseif direction == "forward" then
- while turtle.forward() == false do
- turtle.dig()
- turtle.attack()
- end
- end
- end
- if msg[1] == "cube" then
- frontBlocks = msg[2]
- rightBlocks = msg[3]
- upBlocks = msg[4]
- turtle.dig()
- move("forward")
- function line()
- for i=1,frontBlocks -1 do
- turtle.dig()
- move("forward")
- end
- end
- function panel()
- line()
- for i=1,upBlocks -1 do
- turtle.digUp()
- move("up")
- turtle.turnRight()
- turtle.turnRight()
- line()
- end
- end
- function turn()
- turtle.turnLeft()
- turtle.dig()
- turtle.select(1)
- turtle.place()
- for i=1,16 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.select(1)
- turtle.dig()
- move("forward")
- turtle.turnLeft()
- end
- function cuboid()
- panel()
- m = 0
- for i=1,rightBlocks -1 do
- m = m + 1
- if m == 1 and upBlocks%2 == 1 then
- m = 0
- turtle.turnRight()
- turtle.turnRight()
- for i=1,frontBlocks - 1 do
- move("forward")
- end
- for i=1,upBlocks - 1 do
- move("down")
- end
- turn()
- panel()
- elseif math.fmod(upBlocks,2) ~= 1 then
- turtle.turnLeft()
- for i=1,upBlocks - 1 do
- move("down")
- end
- turtle.dig()
- move("forward")
- turtle.turnLeft()
- panel()
- end
- end
- end
- cuboid()
- if math.fmod(upBlocks,2) ~= 1 then
- turtle.turnRight()
- for i=1,upBlocks - 1 do
- move("down")
- end
- for i=1,rightBlocks - 1 do
- move("forward")
- end
- else
- turtle.turnRight()
- turtle.turnRight()
- for i=1,frontBlocks - 1 do
- move("forward")
- end
- turtle.turnRight()
- for i=1,upBlocks - 1 do
- move("down")
- end
- for i=1,rightBlocks - 1 do
- move("forward")
- end
- end
- turtle.turnLeft()
- turtle.dig()
- turtle.select(1)
- turtle.place()
- for i=1,16 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.select(1)
- turtle.dig()
- elseif msg[1] == "tree" then
- move("forward")
- moved = 0
- while turtle.digUp() == true do
- move("up")
- moved = moved + 1
- end
- while moved > 0 do
- move("down")
- moved = moved - 1
- end
- elseif msg[1] == "move" then
- moveBlocks = msg[3]
- while moveBlocks > 0 do
- if msg[2] == "up" then
- move("up")
- elseif msg[2] == "down" then
- move("down")
- elseif msg[2] == "forward" then
- move("forward")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement