Gelofy

TorchPlacer

Feb 27th, 2023 (edited)
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.18 KB | Gaming | 0 0
  1. --- initialisation ---
  2.  
  3. print("Please put coal in slot 1 and torches in others slots")
  4. print("how long?")
  5. L = read()
  6. L = math.floor(tonumber(L)/5)
  7. print("how wide?")
  8. W = read()
  9. W = tonumber(W)
  10. slotbase = 2
  11.  
  12. --- function ---
  13. function testSlot()
  14.   while turtle.getItemCount(slotbase) == 0 do
  15.         slotbase = slotbase +1
  16.         if slotbase == 17 then slotbase = 2 end
  17.   end
  18.  
  19. function Job()
  20.   for j = 1, W do
  21.   for i = 1,L do
  22.         if turtle.getItemCount(slotbase) == 0 then testSlot() end
  23.         turtle.forward()
  24.         turtle.forward()
  25.         turtle.forward()
  26.         turtle.forward()
  27.         turtle.forward()
  28.           if turtle.detectDown() == false then
  29.                  turtle.placeDown()
  30.           end
  31.   end
  32.   for i = 1, L do
  33.         turtle.forward()
  34.         turtle.forward()
  35.         turtle.forward()
  36.         turtle.forward()
  37.         turtle.forward()
  38.   end
  39.   end
  40.  
  41. function Fuel()
  42.     if fuelLvL < 2*L*W+10 then
  43.       turtle.select(1)
  44.       if turtle.refuel() == false then
  45.                      print("Please, put fuel in slot 1")
  46.       else
  47.                      turtle.refuel(5)
  48.                      Fuel()
  49.       end
  50.     else
  51.     Job()
  52.   end
  53.  
  54. Fuel()
Add Comment
Please, Sign In to add comment