Advertisement
louwding

Clearing Turtle

Oct 4th, 2024 (edited)
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.84 KB | Gaming | 0 0
  1. gps = require("turtle_gps")
  2.  
  3. length = 32
  4. width = 32
  5. height = 1
  6. -- direction = "DOWN"
  7.  
  8.  
  9. function digNow()
  10.     while turtle.detect() do
  11.         turtle.dig()
  12.         --sleep(0.5)
  13.     end
  14. end
  15.  
  16. function refuel_now()
  17.     -- refuel
  18.     turtle.select(15)
  19.     while turtle.getFuelLevel() < 200 do
  20.         -- print("Not enough fuel: "..turtle.getFuelLevel().." / 200")
  21.         -- print("place fuel in slot 16 and Press ENTER to continue...")
  22.         -- read()
  23.         turtle.refuel()
  24.     end
  25. end
  26.  
  27. function main()
  28.     print("How many blocks forward: ")
  29.     length = tonumber(read(), integer)
  30.     print("How many blocks right: ")
  31.     width = tonumber(read(), integer)
  32.     -- print("Mining direction? (UP/DOWN)")
  33.     -- direciton = string.upper(read())
  34.     print("Mining height: ")
  35.     height = tonumber(read(), integer)
  36.  
  37.     term.clear()
  38.     term.setCursorPos(1, 1)
  39.  
  40.     refuel_now()
  41.      
  42.  
  43.     print("Excavating...")
  44.  
  45.     for h = 1, height do
  46.         for i = 1, width do
  47.             if i % 2 == 0 then
  48.                 turnToDirection(Directions.Backwards)
  49.             else
  50.                 turnToDirection(Directions.Forward)
  51.             end
  52.    
  53.             for j = 1, length - 1 do
  54.                 moveForward()
  55.             end
  56.  
  57.             if i < width then
  58.                 if Direction == Directions.Forward then
  59.                     turnToDirection(Directions.Right)
  60.                     moveForward()
  61.                     turnToDirection(Directions.Backwards)
  62.                 else
  63.                     turnToDirection(Directions.Right)
  64.                     moveForward()
  65.                     turnToDirection(Directions.Forward)
  66.                 end
  67.             end
  68.         end
  69.  
  70.         moveTo(0,0,Local_z,"zyx")
  71.         moveDown()
  72.         turnToDirection(Directions.Forward)
  73.         refuel_now()
  74.     end
  75.  
  76. end
  77.  
  78. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement