Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --StripMineMaster
- PROTOCOL = "danetos3"
- shell.run("clear")
- local cardinalDirection, cardinalDirection2, startingOffset, offset, distance, compNum = nil
- local compIDs = {}
- function sendCommands()
- print(" ")
- print("It's diggin' time bois.")
- print(" ")
- rednet.open("back")
- local firstTable = {}
- firstTable[1] = "StripMine"
- firstTable[2] = cardinalDirection
- firstTable[3] = cardinalDirection2
- firstTable[4] = startingOffset
- firstTable[5] = distance
- rednet.send(compIDs[1],firstTable,PROTOCOL)
- if offset == 0 then
- for x=1,(compNum-1) do
- local tempTable = {}
- tempTable[1] = "StripMine"
- tempTable[2] = cardinalDirection
- tempTable[3] = cardinalDirection2
- tempTable[4] = startingOffset
- tempTable[5] = distance
- rednet.send(compIDs[x+1],tempTable,PROTOCOL)
- end
- else
- for x=1,(compNum-1) do
- local tempTable = {}
- tempTable[1] = "StripMine"
- tempTable[2] = cardinalDirection
- tempTable[3] = cardinalDirection2
- tempTable[4] = (startingOffset + x + offset)
- tempTable[5] = distance
- rednet.send(compIDs[x+1],tempTable,PROTOCOL)
- end
- end
- rednet.close()
- end
- --MAIN INSTRUCTIONS GO HERE
- print("Welcome to the DanetOS3 Strip Mine MASTER PROGRAM!")
- print("Take a moment to make sure your turtles and fueled, placed facing north, and have chests below them.")
- print(" ")
- print("Do you want to read from a file, and just set the starting offset? [y\n]")
- local readBoolean = read()
- if readBoolean == "y" then
- local fileData = {}
- for line in io.lines("stripmine.danet") do
- table.insert(fileData,line)
- end
- print("SUCCESS! Data file read to table.")
- --Data parsing minus the startingOffset
- cardinalDirection = fileData[1]
- cardinalDirection2 = fileData[2]
- offset = tonumber(fileData[3])
- distance = tonumber(fileData[4])
- compNum = tonumber(fileData[5])
- for x=1,compNum do
- compIDs[x] = tonumber(fileData[x+5])
- end
- print(" ")
- print("Enter the starting offset.")
- startingOffset = tonumber(read())
- else
- print(" ")
- print("ENTER # of Mining Turtles ready.")
- compNum = tonumber(read())
- compIDs = {}
- for x=1,compNum do
- print("Enter the ID# for Computer " .. x .. ":")
- compIDs[x] = tonumber(read())
- end
- print(" ")
- print("Enter the digging cardinal direction. (north or south)")
- cardinalDirection = read()
- print("Enter the direction you want it to go down the hallway. (east or west)")
- cardinalDirection2 = read()
- print("Enter the starting offset. (How far it's going down the hall)")
- startingOffset = tonumber(read())
- print("Enter the offset increment. (0 = They dig next to eachother.)")
- offset = tonumber(read())
- print("Enter the digging distance.")
- distance = read()
- end
- sendCommands()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement