Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local debug = false
- local tArgs ={...}
- local debugArg =tArgs[1]
- if debugArg == "debug" then
- debug = true
- end
- local component = require("component")
- local robot = require("robot")
- local term = require("term")
- local computer = require("computer")
- local shafts = 0
- local shaftsQ = 0
- local lenght = 0
- local lenghtQ = 0
- local shaftSpacing = 0
- local shaftSpacingQ = 0
- local startEnter = 0
- function start()
- print("Put Wooden Crate in slot 1")
- print("Put Ender Chest in slot 2")
- print("Torches in slot 3")
- print("When done press ENTER")
- startEnter = tonumber(term.read())
- term.clear()
- print("Lenght of each shaft?")
- lenghtQ = tonumber(term.read())
- if lenghtQ >= 51 then
- print("Shafts can't be longer than 50")
- lenghtQ = tonumber(term.read())
- end
- term.clear()
- print("Number of shafts?")
- print("Only put 2,4,6,8,10 etc")
- shaftsQ = tonumber(term.read())
- term.clear()
- print("Spacing between shafts?")
- print("0 Will make a room")
- shaftSpacingQ = tonumber(term.read())
- shaftSpacingQ = shaftSpacingQ + 1
- term.clear()
- mine()
- end
- function invDrop()
- if debug == true then
- print("invDrop()")
- end
- robot.turnAround()
- robot.select(2)
- robot.place()
- for i=4,16 do
- robot.select(i)
- robot.drop()
- end
- robot.select(2)
- robot.swing()
- robot.turnAround()
- newShaft()
- end
- function recharge()
- if debug == true then
- print("recharge()")
- end
- if computer.energy() <= 17750 then
- if debug == true then
- print("recharging...")
- end
- robot.turnAround()
- robot.select(1)
- robot.place()
- -- Check advanced inventory API to get battery and charger and put it here <<<------
- robot.select(4)
- robot.back()
- robot.place()
- robot.select(5)
- robot.back()
- robot.place()
- while computer.energy ~= 30000 do
- os.sleep(1)
- end
- if computer.energy() == 30000 then
- robot.select(5)
- robot.swing()
- robot.forward()
- robot.sleect(4)
- robot.swing()
- robot.forward()
- end
- robot.select(1)
- robot.swing()
- end
- invDrop()
- end
- function newShaft()
- if debug == true then
- print("newShaft()")
- end
- shaftSpacing = 0
- if shafts%2==0 then
- robot.turnRight()
- while shaftSpacing ~= shaftSpacingQ do
- robot.swing()
- robot.forward()
- shaftSpacing = shaftSpacing + 1
- robot.swingUp()
- robot.swingDown()
- if shaftSpacing == shaftSpacingQ then
- robot.turnRight()
- mine()
- end
- end
- else
- robot.turnLeft()
- while shaftSpacing ~= shaftSpacingQ do
- robot.swing()
- robot.forward()
- shaftSpacing = shaftSpacing + 1
- robot.swingUp()
- robot.swingDown()
- if shaftSpacing == shaftSpacingQ then
- robot.turnLeft()
- mine()
- end
- end
- end
- if shafts == shaftsQ then
- os.shutdown()
- end
- end
- function mine()
- if debug == true then
- print("mine()")
- end
- shafts = shafts + 1
- while lenght ~= lenghtQ do
- robot.swing()
- robot.forward()
- lenght = lenght + 1
- robot.swingUp()
- robot.swingDown()
- if lenght%5==0 then
- robot.select(3)
- robot.placeDown()
- end
- end
- if lenght == lenghtQ then
- recharge()
- end
- end
- -- (Main Stuff) --
- if robot.detectDown == true then
- robot.up()
- end
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement