Advertisement
posicat

/digtunnel_old

Sep 14th, 2024 (edited)
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. --File: /digtunnel_old
  2.  
  3. dofile("/cattech/turtle.lua")
  4. dofile("/cattech/file.lua")
  5. local moves = require("moves")
  6.  
  7. local torchCounter = 7;
  8.  
  9. function checkTorch()
  10. torchCounter = torchCounter +1
  11.  
  12. if (torchCounter > 7) then
  13. print("placing Torch!")
  14. placeLight(1)
  15. torchCounter = 0
  16. end
  17. end
  18.  
  19. config = loadConfigAndDefaults()
  20.  
  21. if #arg >= 1 then
  22. config["maxSteps"] = tonumber(arg[1])
  23. if #arg >= 2 then
  24. config["pathDirection"] = arg[2]
  25. end
  26. else
  27. local continue = getContinue("digtunnel")
  28. if continue ~= nil then
  29. print("Continuing remaining: ",continue)
  30. config["maxSteps"] = continue
  31. end
  32. end
  33.  
  34. print("Going " .. config["pathDirection"] .. " " .. config["maxSteps"] .. " blocks")
  35.  
  36.  
  37. displayHash(config)
  38.  
  39. local spaces = 0
  40. while spaces < config["maxSteps"] do
  41. refuelIfNeeded(30)
  42.  
  43. if (config["pathDirection"] == "down") then
  44. -- Starts 1 above first step
  45. turtle.digDown()
  46. turtle.down()
  47.  
  48. digTunnelSlice(tonumber(config["stairHeight"]))
  49. if config["safeTunnel"] == "yes" then
  50. secureTunnelSlice(tonumber(config["stairHeight"]))
  51. end
  52. checkTorch()
  53.  
  54. goDigForward()
  55. end
  56.  
  57. if (config["pathDirection"] == "up") then
  58. -- Starts on first step.
  59. digTunnelSlice(tonumber(config["stairHeight"]))
  60. if config["safeTunnel"] == "yes" then
  61. secureTunnelSlice(tonumber(config["stairHeight"]))
  62. end
  63. checkTorch()
  64.  
  65. turtle.up()
  66. goDigForward()
  67. end
  68.  
  69. if (config["pathDirection"] == "level") then
  70. -- Starts the ground
  71. digTunnelSlice(tonumber(config["tunnelHeight"]))
  72. if config["safeTunnel"] == "yes" then
  73. secureTunnelSlice(tonumber(config["tunnelHeight"]))
  74. end
  75. checkTorch()
  76.  
  77. goDigForward()
  78. end
  79.  
  80. local remaining = config["maxSteps"] - spaces
  81. updateLine(remaining.."/"..config["maxSteps"])
  82. updateContinue("digtunnel",remaining)
  83.  
  84. local inv = scanInventory()
  85.  
  86. if
  87.  
  88. spaces = spaces + 1
  89. end
  90.  
  91. updateContinue("digtunnel",nil)
  92.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement