Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Vars
- local north = colors.yellow
- local east = colors.lime
- local south = colors.pink
- local west = colors.gray
- local up = colors.purple
- local down = colors.blue
- -- Misc Functions
- function clearScreen()
- term.clear()
- term.setCursorPos(1,1)
- end
- function wait(num,what)
- for i=1,num do
- clearScreen()
- print("Waiting for "..what)
- print("Time remaining: "..num-i)
- os.sleep(1)
- end
- end
- -- Setting & Getting functions
- function getDrills()
- clearScreen()
- for i=1,8 do
- print("Retrieving drill #"..i)
- redstone.setBundledOutput("left",colors.lightBlue)
- os.sleep(0.5)
- redstone.setBundledOutput("left",0)
- os.sleep(0.5)
- end
- end
- function setDrills()
- clearScreen()
- for i=1,8 do
- print ("Deploying drill #"..i)
- redstone.setBundledOutput("left",colors.magenta)
- os.sleep(0.5)
- redstone.setBundledOutput("left",0)
- os.sleep(0.5)
- end
- end
- function cleanUpCells()
- clearScreen()
- for i=1,8 do
- print("Retrieving cell #"..i)
- redstone.setBundledOutput("left",colors.brown)
- os.sleep(0.5)
- redstone.setBundledOutput("left",0)
- os.sleep(0.5)
- end
- end
- function setCells()
- clearScreen()
- for i=1,32 do
- print("Deploying cell stack #"..i)
- redstone.setBundledOutput("left",colors.white)
- os.sleep(0.5)
- redstone.setBundledOutput("left",0)
- os.sleep(0.5)
- end
- end
- function coverHoles()
- clearScreen()
- for i=1,64 do
- print("Deploying sand #"..i)
- redstone.setBundledOutput("left",colors.orange)
- os.sleep(1)
- redstone.setBundledOutput("left",0)
- os.sleep(1)
- end
- end
- function mainMiningProgram()
- clearScreen()
- setDrills()
- clearScreen()
- wait(30,"drills")
- for i=1,1800 do
- clearScreen()
- print("Mining...")
- print("Time remaining: "..1800-i)
- if (i % 256 == 0) and (i ~= 0) then
- setCells()
- end
- os.sleep(1)
- end
- getDrills()
- wait(45,"drills")
- cleanUpCells()
- coverHoles()
- end
- function moveTo(dir,num)
- for i=1,num do
- redstone.setBundledOutput("left",dir)
- os.sleep(1.5)
- redstone.setBundledOutput("left",0)
- os.sleep(0.5)
- end
- end
- while true do
- redstone.setBundledOutput("left",0)
- clearScreen()
- print("Frameship Terminal 0.2")
- print("==============================")
- print("1. Main mining program.")
- print("==============================")
- print("2. Retrieve Drills from Miners")
- print("3. Insert Drills into miners")
- print("4. Clean Up Cells")
- print("5: Insert cells into pumps")
- print("6. Cover holes")
- print("==============================")
- print("7. Initialize navigation protocols")
- print("0. Exit")
- write("Command> ")
- local choice = read()
- if (choice == '1') then
- mainMiningProgram()
- elseif (choice == '2') then
- getDrills()
- elseif (choice == '3') then
- setDrills()
- elseif (choice == '4') then
- cleanUpCells()
- elseif (choice == '5') then
- setCells()
- elseif (choice == '6') then
- coverHoles()
- elseif (choice == '7') then
- while true do
- clearScreen()
- print("Navigation Subsystem")
- print("==============================")
- print ("1. Move North")
- print ("2. Move East")
- print ("3. Move South")
- print ("4. Move West")
- print ("5. Move Up")
- print ("6. Move Down")
- print ("0. Return to previous menu")
- write("Command> ")
- local choice = read()
- if (choice ~= '0') then
- print("How many blocks in that direction?")
- write("Command> ")
- local numToMove = read()
- if (choice == '1') then
- moveTo(north, numToMove)
- elseif (choice == '2') then
- moveTo(east, numToMove)
- elseif (choice == '3') then
- moveTo(south, numToMove)
- elseif (choice == '4') then
- moveTo(west, numToMove)
- elseif (choice == '5') then
- moveTo(up, numToMove)
- elseif (choice =='6') then
- moveTo(down, numToMove)
- end
- end
- if (choice == '0') then
- break
- end
- end
- elseif (choice == '0') then
- clearScreen()
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment