Advertisement
Plazter

HouseBuilder

Sep 28th, 2013
1,367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.24 KB | None | 0 0
  1. -- Code by Plazter --
  2. -- 2013 --
  3. -- House builder --
  4. -- Description: This is a turtle program, to build houses as you wish, right now it can only take a even number
  5. --Heres an example on how to start it to build: Build 4=the widht. 3= the height of the house
  6.  
  7. local args = {...}
  8.  
  9. turtle.up()
  10.  
  11. if args[1] == nil or args[1] == "help" then
  12.     print("<program name> <width> <Height>")
  13.     return
  14. end
  15.  
  16. local slot = 1
  17.  
  18. function wall()
  19. for i = 1,args[1] -1 do
  20.  turtle.placeDown()
  21.  while not turtle.forward() do
  22.     turtle.dig()
  23.     sleep(0.8)
  24.  end
  25. if turtle.getItemCount(slot) < 1 then
  26. slot = slot+1
  27.         turtle.select(slot)
  28. end
  29. end
  30.  
  31. --turtle.up()
  32. end
  33.  
  34.  
  35. function right()
  36.     turtle.turnRight()
  37.    
  38.    
  39. end
  40.  
  41. function left()
  42.      turtle.turnLeft()
  43. end
  44.  
  45. function square()
  46.   wall()
  47.    right()
  48.   wall()
  49.    right()
  50.   wall()
  51.   right()
  52.  wall()
  53. right()
  54. end
  55.  
  56. function roof() -- Work in progress
  57. for i = 1,args[1] /2 do
  58.  wall()
  59. right()
  60. turtle.placeDown()
  61. turtle.forward()
  62. right()
  63. wall()
  64. left()
  65. turtle.placeDown()
  66. turtle.forward()
  67. left()
  68. end
  69. turtle.back()
  70. for i = 1,args[2] +1 do
  71. turtle.down()
  72. right()
  73. right()
  74. end
  75. end
  76.  
  77. function layer()
  78. for i = 1, args[2] do
  79.   square()
  80.  turtle.up()
  81. end
  82. end
  83.  
  84. layer()
  85. roof()
  86. print("Done building..")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement