S3mpx

stairs

Dec 22nd, 2020 (edited)
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.77 KB | None | 0 0
  1. -- Turtle Programm --
  2. -- Category: Mining --
  3.  
  4. -- [INFORMATION] --
  5. local appName = "Stairs.lua"
  6. local appType = "Turtle"
  7. local category = "Mining"
  8. local version = "1.0"
  9. local author = "S3mpx"
  10. -- print info --
  11. print("["..appName.."]")
  12. print("Programm Type: "..appType)
  13. print("Category: "..category)
  14. print("Version: "..version)
  15. print("written by"..author)
  16. print("")
  17.  
  18. -- [LOCALS] --
  19. local depth = 0
  20. local width = 0
  21.  
  22. -- [FUNKTIONS] --
  23.  
  24. -- dig() --
  25. local function dig()
  26.     turtle.dig()
  27.     turtle.forward()
  28. end
  29.  
  30. -- turn() --
  31. local function turn()
  32.     turtle.turnLeft()
  33. end
  34.  
  35. -- turnAround() --
  36. local function turnAround()
  37.     for i=1, 2 do
  38.         turn()
  39.     end
  40. end
  41.  
  42. -- feedback(x) --
  43. local function feedback(x)
  44.     if x == 1 then
  45.         print("Making the stairs!")
  46.     elseif x == 0 then
  47.         print("Finished the stairs!")
  48.     end
  49. end
  50.  
  51. -- startup() --
  52. local function startup()
  53.     feedback(1)
  54.     turtle.forward()
  55.     turn()
  56. end
  57.  
  58. -- finishup() --
  59. local function finishup()
  60.     turn()
  61.     dig()
  62.     turnAround()
  63.     feedback(0)
  64. end
  65.  
  66. -- stairDown() --
  67. local function stairDown()
  68.     turtle.digDown()
  69.     dig()
  70.     turtle.digDown()
  71.     turtle.down()
  72. end
  73.  
  74. -- stairUp() --
  75.  
  76.  
  77. -- [INPUT FUNKTIONS] --
  78.  
  79. -- depth() --
  80. local function depth()
  81.     print("How deep should the stairs go?")
  82.     depth = io.read()
  83. end
  84.  
  85. -- width() --
  86. local function width()
  87.     print("How many blocks should be inbetween the stairs?")
  88.     width = io.read()
  89. end
  90.  
  91. -- [MAIN FUNKTION] --
  92.  
  93. -- stairs() --
  94. local function stairs()
  95.     depth()
  96.     width()
  97.     startup()
  98.     for i=1, depth/2 do
  99.         for i=1, width + 1 do
  100.             stairDown()
  101.         end
  102.         turn()
  103.     end
  104.     finishup()
  105. end
  106.  
  107. -- [END] --
  108.  
  109. stairs()
Advertisement
Add Comment
Please, Sign In to add comment