Advertisement
gur111

comptuercraft platform

Jun 1st, 2025 (edited)
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. -- Function to select a slot with blocks
  2. function selectBlock()
  3.   for i = 1, 16 do
  4.     if turtle.getItemCount(i) > 0 then
  5.       turtle.select(i)
  6.       return true
  7.     end
  8.   end
  9.   return false
  10. end
  11.  
  12. -- Fill platform of given width and length
  13. function fillPlatform(width, length)
  14.   local turnRight = true
  15.  
  16.   for row = 1, length do
  17.     for col = 1, width do
  18.       if not selectBlock() then
  19.         print("Out of blocks!")
  20.         return
  21.       end
  22.       turtle.placeDown()
  23.       if col < width then
  24.         turtle.forward()
  25.       end
  26.     end
  27.  
  28.     if row < length then
  29.       if turnRight then
  30.         turtle.turnRight()
  31.         turtle.forward()
  32.         turtle.turnRight()
  33.       else
  34.         turtle.turnLeft()
  35.         turtle.forward()
  36.         turtle.turnLeft()
  37.       end
  38.       turnRight = not turnRight
  39.     end
  40.   end
  41. end
  42.  
  43. -- Replace these with desired dimensions
  44. local width = 5
  45. local length = 4
  46.  
  47. -- Start the filling
  48. fillPlatform(width, length)
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement