Advertisement
LDDestroier

Improved Miner SERVER

Dec 16th, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.34 KB | None | 0 0
  1. mineshaftLength = 12
  2. cellLength = 1
  3. print("This turtle is under my control!")
  4.  
  5. rednet.open("left")
  6. while true do
  7.   id, msg = rednet.receive()
  8.  --Movement commands
  9.   if msg == "left" then
  10.     turtle.turnLeft()
  11.   end
  12.   if msg == "right" then
  13.     turtle.turnRight()
  14.   end
  15.   if msg == "forward" then
  16.     turtle.forward()
  17.   end
  18.   if msg == "backward" then
  19.     turtle.back()
  20.   end
  21.   if msg == "up" then
  22.     turtle.up()
  23.   end
  24.   if msg == "down" then
  25.     turtle.down()
  26.   end
  27.  --Mining commands
  28.   if msg == "digForward" then
  29.     turtle.dig()
  30.   end
  31.   if msg == "digUp" then
  32.     turtle.digUp()
  33.   end
  34.   if msg == "digDown" then
  35.     turtle.digDown()
  36.   end
  37.  --Placing commands
  38.   if msg == "placeForward" then
  39.     turtle.place()
  40.   end
  41.   if msg == "placeUp" then
  42.     turtle.placeUp()
  43.   end
  44.   if msg == "placeDown" then
  45.     turtle.placeDown()
  46.   end
  47.  --Attacking commands
  48.   if msg == "attackForward" then
  49.     turtle.attack()
  50.   end
  51.   if msg == "attackUp" then
  52.     turtle.attackUp()
  53.   end
  54.   if msg == "attackDown" then
  55.     turtle.attackDown()
  56.   end
  57.  --Sucking commands
  58.   if msg == "suckForward" then
  59.     turtle.suck()
  60.   end
  61.   if msg == "suckUp" then
  62.     turtle.suckUp()
  63.   end
  64.   if msg == "suckDown" then
  65.     turtle.suckDown()
  66.   end
  67. end
  68.  --Special Actions
  69.   for a = 1, 9, 1 do
  70.     if tonumber(msg) == a then
  71.       cellLength = a
  72.       write(cellLength)
  73.     end
  74.   end
  75.   if msg == "tunnelDown" then
  76.     for a = 1, mineshaftLength, 1 do
  77.       for b = 1, cellLength, 1 do
  78.         turtle.dig()
  79.         turtle.forward()
  80.         turtle.digUp()
  81.         turtle.digDown()
  82.         turtle.turnLeft()
  83.         turtle.dig()
  84.         turtle.forward()
  85.         turtle.digUp()
  86.         turtle.digDown()
  87.         turtle.turnLeft()
  88.         turtle.turnLeft()
  89.         turtle.forward()
  90.         turtle.dig()
  91.         turtle.forward()
  92.         turtle.digUp()
  93.         turtle.digDown()
  94.         turtle.turnLeft()
  95.         turtle.turnLeft()
  96.         turtle.forward()
  97.         turtle.turnRight()
  98.       end
  99.       turtle.digDown()
  100.       turtle.down()
  101.     end
  102.   end
  103.   if msg == "tunnelForward" then
  104.     for a = 1, mineshaftLength, 1 do
  105.       for b = 1, cellLength, 1 do
  106.         turtle.dig()
  107.         turtle.forward()
  108.         turtle.digUp()
  109.         turtle.digDown()
  110.         turtle.turnLeft()
  111.         turtle.dig()
  112.         turtle.forward()
  113.         turtle.digUp()
  114.         turtle.digDown()
  115.         turtle.turnLeft()
  116.         turtle.turnLeft()
  117.         turtle.forward()
  118.         turtle.dig()
  119.         turtle.forward()
  120.         turtle.digUp()
  121.         turtle.digDown()
  122.         turtle.turnLeft()
  123.         turtle.turnLeft()
  124.         turtle.forward()
  125.         turtle.turnRight()
  126.       end
  127.     end
  128.   end
  129.   if msg == "tunnelUp" then
  130.     for a = 1, mineshaftLength, 1 do
  131.       for b = 1, cellLength, 1 do
  132.         turtle.dig()
  133.         turtle.forward()
  134.         turtle.digUp()
  135.         turtle.digDown()
  136.         turtle.turnLeft()
  137.         turtle.dig()
  138.         turtle.forward()
  139.         turtle.digUp()
  140.         turtle.digDown()
  141.         turtle.turnLeft()
  142.         turtle.turnLeft()
  143.         turtle.forward()
  144.         turtle.dig()
  145.         turtle.forward()
  146.         turtle.digUp()
  147.         turtle.digDown()
  148.         turtle.turnLeft()
  149.         turtle.turnLeft()
  150.         turtle.forward()
  151.         turtle.turnRight()
  152.       end
  153.       turtle.digUp()
  154.       turtle.up()
  155.     end
  156.   end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement