Advertisement
CelticCoder

smartManualQuarry

Jan 23rd, 2024 (edited)
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
  7. local function clearScreen()
  8.     term.clear()
  9.     term.setCursorPos(1, 1)
  10. end
  11.  
  12. function volumeCheck(width, length, depth)
  13.     tw = width
  14.     tl = length
  15.     td = depth
  16.     if tw == 0 then
  17.         tw = 1
  18.     end
  19.     if tl == 0 then
  20.         tl = 1
  21.     end
  22.     if td == 0 then
  23.         td = 1
  24.     end
  25.     volume = tw * tl * td
  26.     width = width - 1
  27.     print("Volume: " .. volume .. " blocks")
  28.    
  29.     if volume > 800 then
  30.         print("WARNING! Volume over 800")
  31.         print("Max is 1024 with Empty Inventory")
  32.         print("With Stacks of 64.")
  33.     end
  34.     choice = tonumber(userInput.getUserInput("Proceed? 1 for yes, 2 for no"))
  35.     if choice == 1 then
  36.         return false
  37.     else
  38.         return true
  39.     end
  40. end
  41.  
  42. function fuelCheck(width, length, depth)
  43.     predictSimpleQuarry.predict(width, length, depth)
  44.     fuelcost = predictSimpleQuarry.getFuelCost()
  45.     if fuelcost > turtle.getFuelLevel() then
  46.         getTurtleFuel.displayFuelInfo()
  47.         print("Quarry Fuel Cost = " .. fuelcost)
  48.         print("Fuel too Low to Start, Please Insert Buckets")
  49.         choice = tonumber(userInput.getUserInput("Type 1 to Refuel, Type 2 to Re-select Quarry"))
  50.         if choice == 1 then
  51.             turtleRefuel.refuelWithLava()
  52.             turtle.select(1)
  53.             if fuelcost > turtle.getFuelLevel() then
  54.                 print("Fuel Still too Low to Start, Terminating Program")
  55.                 os.sleep(3)
  56.             end
  57.         else
  58.             return false
  59.         end
  60.     end
  61.     return true
  62. end
  63.  
  64. function smartQuarry()
  65.     check = true
  66.     while check do
  67.         clearScreen()
  68.         width = tonumber(userInput.getUserInput("Enter Length: "))
  69.         length = tonumber(userInput.getUserInput("Enter Width: "))
  70.         depth = tonumber(userInput.getUserInput("Enter Depth"))
  71.         tw = width
  72.         tl = length
  73.         td = depth
  74.         if tw == 0 then
  75.             tw = 1
  76.         end
  77.         if tl == 0 then
  78.             tl = 1
  79.         end
  80.         if td == 0 then
  81.             td = 1
  82.         end
  83.         width = width - 1
  84.         check = not fuelCheck(width, length, depth)
  85.         if not check then
  86.             check = volumeCheck(width, length, depth)
  87.         end
  88.     end
  89.     choice = 0
  90.     while choice ~= 1 and choice ~= 2 do
  91.         print("Use a Preset?")
  92.         choice = tonumber(userInput.getUserInput("Yes = 1, No = 2"))
  93.         if choice == 1 then
  94.             choice = tonumber(userInput.getUserInput("1 for sand, 2 for gravel"))
  95.             if choice == 1 then
  96.                 blockname = "minecraft:sand"
  97.             elseif choice == 2 then
  98.                 blockname = "minecraft:gravel"
  99.             else
  100.                 print("Incorrect Input")
  101.             end
  102.         elseif choice == 2 then
  103.             blockname = userInput.getUserInput("Please Input Block ID")
  104.         else
  105.             print("Incorrect Input")
  106.         end
  107.     end
  108.    
  109.     simpleQuarry.smartQuarry(width, length, depth, blockname)
  110. end
  111.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement