Ubidibity

floor.lua

Apr 23rd, 2025 (edited)
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | Gaming | 0 0
  1. -- generic add floor to cleared chunk
  2. height=4
  3. mats=0
  4. slot=1
  5. flip=1
  6. alternate=0 -- set
  7.  
  8. -- position turtle on right side of room in the corner facing wall, it'll dig down and proceed to zig zag the floor 'height' blocks down
  9. -- (Height+1 to offset the floor we just passed through)
  10. for x=1,height+1 do
  11. turtle.digDown()
  12. turtle.down()
  13. end
  14.  
  15. for x=1,16 do
  16. turtle.digDown()
  17. turtle.placeDown()
  18.  
  19. for y=1,15 do -- since the first slot is occupied by the turtle's first move into the row
  20. -- assumes first four slots are filled with 64 blocks each
  21. -- with alternate=1 you need 8 slots of 32 (generally with alternating color scheme i.e. blk/wht, red/green, etc)
  22. mats=mats+1
  23. if alternate==2 then
  24. slot=slot-4
  25. alternate=1
  26. print("Color 2 selecting slot ",slot)
  27. elseif alternate==1 then
  28. alternate=2
  29. slot=slot+4
  30. print("Color 1 selecting slot ",slot)
  31. else -- alternate=0
  32. print("No color alternation, staying on slot ",slot," placing item ",mats)
  33. end
  34. -- turtle.select(slot)
  35. if mats==64 then
  36. mats=0
  37. slot=slot+1
  38. -- turtle.select(slot)
  39. end
  40. turtle.select(slot) -- consolidate the two above
  41. turtle.digUp()
  42. turtle.dig()
  43. while not turtle.forward() do -- covers unlikely scenario where there's a row of gravel/sand)
  44. turtle.dig()
  45. end
  46. turtle.digDown() --seems to skip this on the end of the row
  47. turtle.placeDown()
  48. end
  49. if flip==0 then
  50. turtle.turnRight()
  51. turtle.dig()
  52. turtle.forward()
  53. turtle.turnRight()
  54. flip=1
  55. else
  56. flip=0
  57. turtle.turnLeft()
  58. turtle.dig()
  59. turtle.forward()
  60. turtle.turnLeft()
  61. end
  62. turtle.placeDown()
  63. end
Add Comment
Please, Sign In to add comment