Advertisement
Clorith

Untitled

Mar 15th, 2014
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.37 KB | None | 0 0
  1. -- Make sure this is an accurate number
  2. local turtleCount = 26
  3. local enderChest  = peripheral.wrap( "right" )
  4. local rsLocation  = "back"
  5.  
  6. -- Check for items in our "Ender Controller"
  7. -- If items are found, the system is active
  8. function checkState()
  9.     enderChest.condenseItems()
  10.     if enderChest.getStackInSlot(1) ~= NIL then
  11.         return true
  12.     else
  13.         return false
  14.     end
  15. end
  16.  
  17. -- Move chunk loaders and primary rig unit
  18. function moveSingle()
  19.     rs.setBundledOutput( rsLocation, colors.white )
  20.     sleep( 1 )
  21.     rs.setBundledOutput( rsLocation, 0 )
  22. end
  23.  
  24. -- Move Everythign except primary rig unit and backup chunk loaders
  25. function moveAll()
  26.     rs.setBundledOutput( rsLocation, colors.orange )
  27.     sleep( 1 )
  28.     rs.setBundledOutput( rsLocation, 0 )
  29. end
  30.  
  31. -- Check if we're enabled or not, if not wait 5 seconds then try again
  32. while not checkState() do
  33.     sleep( 5 )
  34. end
  35.  
  36. --moveSingle()
  37. print( 'moveSingle()' )
  38.  
  39. -- Start by opening the rednet controller
  40. rednet.open( "left" )
  41.  
  42. -- Send the dig command to all systems
  43. rednet.broadcast( "cycle" )
  44.  
  45. -- Don't do anything while we wait for all the turtles to finish
  46. while turtleCount > 0 do
  47.     senderID, message, distance = rednet.receive()
  48.     if message == 'cycleDone' then
  49.         turtleCount = turtleCount - 1
  50.         print( "Unit completed, " .. turtleCount .. " to go!" )
  51.     end
  52. end
  53.  
  54. -- Turtles done, move the rig!
  55. --moveAll()
  56. print( 'moveAll()' )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement