Advertisement
Guest User

slave

a guest
Mar 3rd, 2015
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.40 KB | None | 0 0
  1. if peripheral.isPresent("right") then
  2.   rednet.open("right") print("Enabled the modem on the Right side")
  3.   else
  4.   rednet.open("left") print("Enabled the modem on the Left side")
  5. end
  6.  
  7. local function placeWell()
  8.     while turtle.detect() do
  9.         turtle.select(4)
  10.         turtle.dig()
  11.         sleep(0.3)
  12.     end
  13.  turtle.select(1)
  14.  turtle.place()
  15. end
  16.  
  17. local function placeChest()
  18.     while turtle.detectUp() do
  19.         turtle.select(5)
  20.         turtle.digUp()
  21.         sleep(0.3)
  22.     end
  23.     turtle.up()
  24.     turtle.select(2)
  25.     turtle.placeDown()
  26. end
  27.  
  28. local function placeEnergy()
  29.     while turtle.detect() do
  30.         turtle.select(6)
  31.         turtle.dig()
  32.         sleep(0.3)
  33.     end
  34.     turtle.select(3)
  35.     turtle.place()
  36. end
  37.  
  38. local function unload()
  39.     for e = 4,8 do
  40.         turtle.select(e)
  41.         turtle.dropDown()
  42.     end
  43. end
  44.  
  45. local function workDone()
  46.     turtle.select(3)
  47.     turtle.dig()
  48.     turtle.select(2)
  49.     turtle.digDown()
  50.     turtle.down()
  51.     turtle.select(1)
  52.     turtle.dig()
  53.     turtle.forward()
  54. end
  55.  
  56. while true do
  57.   id,message = rednet.receive()
  58.  
  59.   if message == "start" then
  60.     placeWell()
  61.     placeChest()
  62.     placeEnergy()
  63.   end
  64.  
  65.   if message == "unload" then
  66.     unload()
  67.   end
  68.  
  69.   if message == "done" then
  70.     workDone()
  71.   end
  72.  
  73.   if message == "left" then
  74.     turtle.turnLeft()
  75.   end
  76.  
  77.   if message == "move" then
  78.     while not turtle.forward() do
  79.     sleep(0.1)
  80.     end
  81.   end
  82.  
  83.   if message == "back" then
  84.     turtle.back()
  85.   end
  86.  
  87. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement