Advertisement
King-Skyline

mine qube

May 10th, 2024 (edited)
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. -- Download or load turtle base functionality
  2. local function loadBaseFunctionality()
  3. if pcall(os.loadAPI, 'turtlebasefunctionality') then
  4. -- print('turtlebasefunctionality found, loading...')
  5. else
  6. print('turtlebasefunctionality not found, downloading from pastebin...')
  7. shell.run('pastebin', 'get', 'dw4vqLdf', 'turtlebasefunctionality')
  8. end
  9. end
  10.  
  11. -- Load base functionality
  12. loadBaseFunctionality()
  13.  
  14. -- Load functions from turtle base functionality
  15. loadfile('turtlebasefunctionality')()
  16. dofile('turtlebasefunctionality')
  17.  
  18. -- Check if the number of arguments is correct
  19. local arguments = {...}
  20. if #arguments ~= 3 then
  21. print('Usage: cube_tunnel <width> <height> <depth>')
  22. return
  23. end
  24.  
  25. -- Parse arguments
  26. local width = tonumber(arguments[1])
  27. local height = tonumber(arguments[2])
  28. local depth = tonumber(arguments[3])
  29.  
  30. -- Check if dimensions are valid
  31. if width < 1 or height < 1 or depth < 1 then
  32. print('Dimensions must be positive integers')
  33. return
  34. end
  35.  
  36. -- Calculate ultimate fuel requirements
  37. local function calculateUltimateFuelRequirements()
  38. return width * height * depth
  39. end
  40.  
  41. -- Activate and adjust fuel requirements
  42. activateDiscardExcessFuel()
  43. changeUltimateFuelRequirementsTo(calculateUltimateFuelRequirements())
  44.  
  45. -- Clear the screen and provide instructions
  46. term.clear()
  47. print('The turtle will dig out a cube with dimensions ' .. width .. 'x' .. height .. 'x' .. depth)
  48. print('')
  49. print('Place the turtle at the starting position.')
  50. print('')
  51. pressEnterToContinue()
  52.  
  53. -- Check if fuel level is sufficient
  54. checkIfFuelLevelIsSufficient()
  55.  
  56. -- Dig out the cube
  57. for y = 1, height do
  58. for z = 1, depth do
  59. for x = 1, width - 1 do
  60. breakFront()
  61. go()
  62. end
  63. if z < depth then
  64. breakDown()
  65. end
  66. end
  67. if y < height then
  68. breakUp()
  69. end
  70. end
  71.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement