Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Make sure this is an accurate number
- local turtleCount = 26
- local enderChest = peripheral.wrap( "right" )
- local rsLocation = "back"
- -- Check for items in our "Ender Controller"
- -- If items are found, the system is active
- function checkState()
- enderChest.condenseItems()
- if enderChest.getStackInSlot(1) ~= NIL then
- return true
- else
- return false
- end
- end
- -- Move chunk loaders and primary rig unit
- function moveSingle()
- rs.setBundledOutput( rsLocation, colors.white )
- sleep( 1 )
- rs.setBundledOutput( rsLocation, 0 )
- end
- -- Move Everythign except primary rig unit and backup chunk loaders
- function moveAll()
- rs.setBundledOutput( rsLocation, colors.orange )
- sleep( 1 )
- rs.setBundledOutput( rsLocation, 0 )
- end
- -- Check if we're enabled or not, if not wait 5 seconds then try again
- while not checkState() do
- sleep( 5 )
- end
- --moveSingle()
- print( 'moveSingle()' )
- -- Start by opening the rednet controller
- rednet.open( "left" )
- -- Send the dig command to all systems
- rednet.broadcast( "cycle" )
- -- Don't do anything while we wait for all the turtles to finish
- while turtleCount > 0 do
- senderID, message, distance = rednet.receive()
- if message == 'cycleDone' then
- turtleCount = turtleCount - 1
- print( "Unit completed, " .. turtleCount .. " to go!" )
- end
- end
- -- Turtles done, move the rig!
- --moveAll()
- print( 'moveAll()' )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement