CelticCoder

manualQuarry

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