SHOW:
|
|
- or go back to the newest paste.
| 1 | os.loadAPI("predictSimpleQuarry.lua")
| |
| 2 | os.loadAPI("userInput.lua")
| |
| 3 | os.loadAPI("getTurtleFuel.lua")
| |
| 4 | os.loadAPI("simpleQuarry.lua")
| |
| 5 | os.loadAPI("turtleChest.lua")
| |
| 6 | - | os.loadAPI("turtleRefuel.lua")
|
| 6 | + | |
| 7 | ||
| 8 | local function clearScreen() | |
| 9 | term.clear() | |
| 10 | term.setCursorPos(1, 1) | |
| 11 | end | |
| 12 | ||
| 13 | - | function fuelcheckandmine(width, length, depth) |
| 13 | + | function volumeCheck(width, length, depth) |
| 14 | - | predictSimpleQuarry.predict(width, length, depth) |
| 14 | + | tw = width |
| 15 | - | fuelcost = predictSimpleQuarry.getFuelCost() |
| 15 | + | tl = length |
| 16 | - | if fuelcost > turtle.getFuelLevel() then |
| 16 | + | td = depth |
| 17 | if tw == 0 then | |
| 18 | - | print("Quarry Fuel Cost = " .. fuelcost)
|
| 18 | + | tw = 1 |
| 19 | - | print("Fuel too Low to Start, Please Insert Buckets")
|
| 19 | + | end |
| 20 | - | choice = tonumber(userInput.getUserInput("Type 1 to Refuel, Type 2 to Re-select Quarry"))
|
| 20 | + | if tl == 0 then |
| 21 | - | if choice == 1 then |
| 21 | + | tl = 1 |
| 22 | - | turtleRefuel.refuelWithLava() |
| 22 | + | end |
| 23 | - | turtle.select(1) |
| 23 | + | if td == 0 then |
| 24 | - | if fuelcost > turtle.getFuelLevel() then |
| 24 | + | td = 1 |
| 25 | - | print("Fuel Still too Low to Start, Terminating Program")
|
| 25 | + | end |
| 26 | - | os.sleep(3) |
| 26 | + | volume = tw * tl * td |
| 27 | - | else |
| 27 | + | width = width - 1 |
| 28 | - | simpleQuarry.quarry(width, length, depth) |
| 28 | + | print("Volume: " .. volume .. " blocks")
|
| 29 | - | end |
| 29 | + | |
| 30 | if volume > 800 then | |
| 31 | print("WARNING! Volume over 800")
| |
| 32 | - | if choice == 1 then |
| 32 | + | print("Max is 1024 with Empty Inventory")
|
| 33 | - | simpleQuarry.quarry(width, length, depth) |
| 33 | + | print("With Stacks of 64.")
|
| 34 | end | |
| 35 | choice = tonumber(userInput.getUserInput("Proceed? 1 for yes, 2 for no"))
| |
| 36 | if choice == 1 then | |
| 37 | return false | |
| 38 | - | function mine() |
| 38 | + | |
| 39 | return true | |
| 40 | - | while choice ~= 1 do |
| 40 | + | |
| 41 | - | invalid = true |
| 41 | + | |
| 42 | - | while invalid do |
| 42 | + | |
| 43 | - | clearScreen() |
| 43 | + | function fuelCheck(width, length, depth, loop) |
| 44 | - | width = tonumber(userInput.getUserInput("Enter Length: "))
|
| 44 | + | x = 0 |
| 45 | - | length = tonumber(userInput.getUserInput("Enter Width: "))
|
| 45 | + | while x < loop do |
| 46 | - | depth = tonumber(userInput.getUserInput("Enter Depth"))
|
| 46 | + | predictSimpleQuarry.predict(width, length, depth) |
| 47 | - | if width == nil then |
| 47 | + | x = x + 1 |
| 48 | - | print("Invalid Length!")
|
| 48 | + | |
| 49 | - | elseif length == nil then |
| 49 | + | fuelcost = predictSimpleQuarry.getFuelCost() |
| 50 | - | print("Invalid Width!")
|
| 50 | + | if fuelcost > turtle.getFuelLevel() then |
| 51 | - | elseif depth == nil then |
| 51 | + | |
| 52 | - | print("Invalid Depth!")
|
| 52 | + | print("Quarry Fuel Cost = " .. fuelcost)
|
| 53 | - | else |
| 53 | + | print("Fuel too Low to Start, Please Insert Buckets")
|
| 54 | - | invalid = false |
| 54 | + | choice = tonumber(userInput.getUserInput("Type 1 to Refuel, Type 2 to Re-select Quarry"))
|
| 55 | - | end |
| 55 | + | if choice == 1 then |
| 56 | turtleRefuel.refuelWithLava() | |
| 57 | - | tw = width |
| 57 | + | turtle.select(1) |
| 58 | - | tl = length |
| 58 | + | if fuelcost > turtle.getFuelLevel() then |
| 59 | - | td = depth |
| 59 | + | print("Fuel Still too Low to Start, Terminating Program")
|
| 60 | - | if tw == 0 then |
| 60 | + | os.sleep(3) |
| 61 | - | tw = 1 |
| 61 | + | end |
| 62 | else | |
| 63 | - | if tl == 0 then |
| 63 | + | return false |
| 64 | - | tl = 1 |
| 64 | + | |
| 65 | end | |
| 66 | - | if td == 0 then |
| 66 | + | return true |
| 67 | - | td = 1 |
| 67 | + | |
| 68 | ||
| 69 | - | volume = tw * tl * td |
| 69 | + | function quarry(loop, choice) |
| 70 | if choice == "left" then | |
| 71 | - | print("Volume: " .. volume .. " blocks")
|
| 71 | + | direction = 0 |
| 72 | elseif choice == "right" then | |
| 73 | - | if volume > 800 then |
| 73 | + | direction = 1 |
| 74 | - | print("WARNING! Volume over 800")
|
| 74 | + | |
| 75 | - | print("Max is 1024 with Empty Inventory")
|
| 75 | + | os.exit(1) |
| 76 | - | print("With Stacks of 64.")
|
| 76 | + | |
| 77 | width = 5 | |
| 78 | - | max = volume > 9000 |
| 78 | + | length = 5 |
| 79 | - | if not max then |
| 79 | + | depth = 27 |
| 80 | - | print("Proceed?")
|
| 80 | + | volume = width * length * depth * loop + (length * loop) |
| 81 | - | choice = tonumber(userInput.getUserInput("Yes = 1, No = 2"))
|
| 81 | + | width = width - 1 |
| 82 | - | fuelcheckandmine(width, length, depth) |
| 82 | + | x = 0 |
| 83 | while x < loop do | |
| 84 | - | print("Volume = " .. volume)
|
| 84 | + | simpleQuarry.quarry(width, length, depth) |
| 85 | - | print("Volume Over 5000, Please Reselect Size Constraints")
|
| 85 | + | turtle.turnLeft() |
| 86 | - | print("continue?")
|
| 86 | + | turtleChest.insertAll() |
| 87 | - | choice = tonumber(userInput.getUserInput("Yes = 1, No = 2"))
|
| 87 | + | turtle.turnRight() |
| 88 | - | if choice == 1 then |
| 88 | + | x = x + 1 |
| 89 | - | fuelcheckandmine(width, length, depth) |
| 89 | + | y = -2 |
| 90 | - | end |
| 90 | + | if direction == 0 then |
| 91 | turtle.turnLeft() | |
| 92 | turtle.turnLeft() | |
| 93 | end | |
| 94 | while y < width do | |
| 95 | turtleForward.moveForward() | |
| 96 | y = y + 1 | |
| 97 | end | |
| 98 | if direction == 0 then | |
| 99 | turtle.turnLeft() | |
| 100 | turtle.turnLeft() | |
| 101 | end | |
| 102 | end | |
| 103 | end | |
| 104 | ||
| 105 | function quarryGetDimensions(loop) | |
| 106 | choice = 0 | |
| 107 | while choice ~= 1 and choice ~= 2 do | |
| 108 | clearScreen() | |
| 109 | print("Move forward or backwards after quarry?")
| |
| 110 | print("1 for Forward, 2 for Backwards\n")
| |
| 111 | choice = tonumber(read()) | |
| 112 | if choice == 2 then | |
| 113 | direction = 0 | |
| 114 | elseif choice == 1 then | |
| 115 | direction = 1 | |
| 116 | else | |
| 117 | print("Incorrect Choice, Try again")
| |
| 118 | os.sleep(1) | |
| 119 | end | |
| 120 | end | |
| 121 | check = true | |
| 122 | while check do | |
| 123 | clearScreen() | |
| 124 | width = tonumber(userInput.getUserInput("Enter Length: "))
| |
| 125 | length = tonumber(userInput.getUserInput("Enter Width: "))
| |
| 126 | depth = tonumber(userInput.getUserInput("Enter Depth: "))
| |
| 127 | volume = width * length * depth * loop + (length * loop) | |
| 128 | width = width - 1 | |
| 129 | check = not fuelCheck(width, length, depth, loop) | |
| 130 | if not check then | |
| 131 | check = volumeCheck(width, length, depth) | |
| 132 | end | |
| 133 | end | |
| 134 | x = 0 | |
| 135 | while x < loop do | |
| 136 | simpleQuarry.quarry(width, length, depth) | |
| 137 | turtle.turnLeft() | |
| 138 | turtleChest.insertAll() | |
| 139 | turtle.turnRight() | |
| 140 | x = x + 1 | |
| 141 | y = -2 | |
| 142 | if direction == 0 then | |
| 143 | turtle.turnLeft() | |
| 144 | turtle.turnLeft() | |
| 145 | end | |
| 146 | while y < width do | |
| 147 | turtleForward.moveForward() | |
| 148 | y = y + 1 | |
| 149 | end | |
| 150 | if direction == 0 then | |
| 151 | turtle.turnLeft() | |
| 152 | turtle.turnLeft() | |
| 153 | end | |
| 154 | end | |
| 155 | end |