Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --L-tunnel
- --This code will create a tunnel directly down and then in straight across in the direction it is facing, placing whatever is in slot one along the way, if it runs out of items in slot one, it moves to slot two, then slot three.. etc.
- print("What's my y-coordinate boss?")
- yi=read()
- print("What's my goal y-coordinate boss?")
- yf=read()
- print("Am I facing North/South/East/West? (N/S/E/W)")
- dir=read()
- print("What's my coordinate in the direction I'm facing?")
- xi=read()
- print("What's my goal coordinate in the direction I'm facing?")
- xf=read()
- z=1
- deltay=yi-yf
- for k=1, deltay do
- t.down()
- turtle.select(z)
- turtle.placeUp()
- if turtle.getItemCount(z)==0 then
- z=z+1
- end
- end
- deltax=math.abs(xi-xf)
- if dir=="N" or dir=="W" then
- for j=1, deltax do
- t.forward()
- turtle.select(z)
- t.right()
- t.right()
- turtle.place()
- t.right()
- t.right()
- if turtle.getItemCount(z)==0 then
- z=z+1
- end
- end
- end
- deltax=math.abs(xi-xf)
- if dir=="S" or dir=="E" then
- for j=1, deltax do
- t.forward()
- turtle.select(z)
- t.right()
- t.right()
- turtle.place()
- t.right()
- t.right()
- if turtle.getItemCount(z)==0 then
- z=z+1
- end
- end
- end
- modem.transmit(channel, 128, "Minion "..os.getComputerLabel().." has finished L-tunnel")
Advertisement
Add Comment
Please, Sign In to add comment