Advertisement
CelticCoder

manualQuarry

Nov 13th, 2023 (edited)
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.08 KB | None | 0 0
  1. os.loadAPI("predictSimpleQuarry.lua")
  2. os.loadAPI("userInput.lua")
  3. os.loadAPI("getTurtleFuel.lua")
  4. os.loadAPI("simpleQuarry.lua")
  5. os.loadAPI("turtleForward.lua")
  6. os.loadAPI("turtleRefuel.lua")
  7.  
  8.  
  9. function mine()
  10.     choice = 0
  11.     while choice ~= 1 do
  12.         invalid = true
  13.         while invalid do
  14.             width = tonumber(userInput.getUserInput("Enter Length: "))
  15.             length = tonumber(userInput.getUserInput("Enter Width: "))
  16.             depth = tonumber(userInput.getUserInput("Enter Depth"))
  17.             if width == nil then
  18.                 print("Invalid Length!")
  19.             elseif length == nil then
  20.                 print("Invalid Width!")
  21.             elseif depth == nil then
  22.                 print("Invalid Depth!")
  23.             else
  24.                 invalid = false
  25.             end
  26.         end
  27.         tw = width
  28.         tl = length
  29.         td = depth
  30.         if tw == 0 then
  31.             tw = 1
  32.         end
  33.         if tl == 0 then
  34.             tl = 1
  35.         end
  36.         if td == 0 then
  37.             td = 1
  38.         end
  39.         volume = tw * tl * td
  40.         width = width - 1
  41.         print("Volume: " .. volume .. " blocks")
  42.  
  43.         if volume > 800 then
  44.             print("WARNING! Volume over 800")
  45.             print("Max is 1024 with Empty Inventory")
  46.             print("With Stacks of 64.")
  47.         end
  48.         max = volume > 9000
  49.         if not max then
  50.             print("Proceed?")
  51.             choice = tonumber(userInput.getUserInput("Yes = 1, No = 2"))
  52.  
  53.             predictSimpleQuarry.predict(width, length, depth)
  54.             fuelcost = predictSimpleQuarry.getFuelCost()
  55.             if fuelcost > turtle.getFuelLevel() then
  56.                 getTurtleFuel.displayFuelInfo()
  57.                 print("Quarry Fuel Cost = " .. fuelcost)
  58.                 print("Fuel too Low to Start, Please Insert Buckets")
  59.                 choice = tonumber(userInput.getUserInput("Type 1 to Refuel, Type 2 to Re-select Quarry"))
  60.                 if choice == 1 then
  61.                     turtleRefuel.refuelWithLava()
  62.                     turtle.select(1)
  63.                     if fuelcost > turtle.getFuelLevel() then
  64.                         print("Fuel Still too Low to Start, Terminating Program")
  65.                         os.sleep(3)
  66.                     else
  67.                         simpleQuarry.quarry(width, length, depth)
  68.                     end
  69.                 end
  70.             else
  71.                 if choice == 1 then
  72.                     simpleQuarry.quarry(width, length, depth)
  73.                 end
  74.             end
  75.         else
  76.             print("Volume = " .. volume)
  77.             print("Volume Over 5000, Please Reselect Size Constraints")
  78.             choice = 2
  79.         end
  80.     end
  81. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement