Mralko99

Costruisci Casa

Feb 4th, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function digDown()
  2.  if turtle.detectDown() == true then
  3.   turtle.digDown()
  4.  end
  5. end
  6.  
  7. function digforward()
  8.  if turtle.detect() == true then
  9.   turtle.dig()
  10.  end
  11. end
  12.  
  13. function forward()
  14.  digDown()
  15.  digforward()
  16.  turtle.placeDown()
  17.  turtle.forward()
  18.  sleep(0.5)
  19. end
  20.  
  21. function line()
  22.  for x=1,8 do
  23.   forward()
  24.  end
  25. end
  26.  
  27. function startingpos()
  28.  turtle.up()
  29.  sleep(0.5)
  30.  turtle.forward()
  31. end
  32.  
  33. function layer()
  34.  line()
  35.  turtle.turnRight()
  36.  line()
  37.  turtle.turnRight()
  38.  line()
  39.  turtle.turnRight()
  40.  line()
  41.  turtle.turnRight()
  42. end
  43.  
  44. function walls()
  45.  turtle.select(1)
  46.  layer()
  47.  turtle.up()
  48.  layer()
  49.  turtle.up()
  50.  turtle.select(2)
  51.  layer()
  52.  turtle.up()
  53.  layer()
  54.  turtle.up()
  55.  turtle.select(3)
  56.  layer()
  57. end
  58.  
  59. function floorpos()
  60.  turtle.forward()
  61.  sleep(0.5)
  62.  turtle.turnRight()
  63.  sleep(0.5)
  64.  turtle.forward()
  65.  sleep(0.5)
  66.  turtle.turnLeft()
  67.  sleep(0.5)
  68.  for x=1,5 do
  69.   turtle.down()
  70.   sleep(0.5)
  71.  end
  72. end
  73.  
  74. function floorline()
  75.  for x=1,6 do
  76.   digDown()
  77.   turtle.placeDown()
  78.   turtle.forward()
  79.   sleep(0.5)
  80.  end
  81. end
  82.  
  83. function right()
  84.  turtle.turnRight()
  85.  digDown()
  86.  turtle.placeDown()
  87.  sleep(0.5)
  88.  turtle.forward()
  89.  sleep(0.5)
  90.  turtle.turnRight()
  91.  sleep(0.5)
  92. end
  93.  
  94. function left()
  95.  turtle.turnLeft()
  96.  digDown()
  97.  turtle.placeDown()
  98.  sleep(0.5)
  99.  turtle.forward()
  100.  sleep(0.5)
  101.  turtle.turnLeft()
  102.  sleep(0.5)
  103. end
  104.  
  105. function floor()
  106.  turtle.select(4)
  107.  floorline()
  108.  right()
  109.  floorline()
  110.  left()
  111.  floorline()
  112.  right()
  113.  floorline()
  114.  left()
  115.  floorline()
  116.  right()
  117.  floorline()
  118.  left()
  119.  floorline()
  120. end
  121.  
  122. function roofpos()
  123.  digDown()
  124.  turtle.placeDown()
  125.  turtle.turnRight()
  126.  sleep(0.5)
  127.  turtle.turnRight()
  128.  sleep(0.5)
  129.  for x=1,5 do
  130.   turtle.up()
  131.   sleep(0.5)
  132.  end
  133. end
  134.  
  135. function rooflineglass()
  136.   turtle.select(5)
  137.   digDown()
  138.   turtle.placeDown()
  139.   turtle.forward()
  140.   sleep(0.5)
  141.   turtle.select(6)
  142.   digDown()
  143.   turtle.placeDown()
  144.   turtle.forward()
  145.   turtle.select(6)
  146.   digDown()
  147.   turtle.placeDown()
  148.   turtle.forward()
  149.   sleep(0.5)
  150.   turtle.select(5)
  151.   digDown()
  152.   turtle.placeDown()
  153.   turtle.forward()
  154.   turtle.select(6)
  155.   digDown()
  156.   turtle.placeDown()
  157.   turtle.forward()
  158.   sleep(0.5)
  159.   turtle.select(6)
  160.   digDown()
  161.   turtle.placeDown()
  162.   turtle.forward()
  163.   sleep(0.5)
  164.   turtle.select(5)
  165.   digDown()
  166.   turtle.placeDown()
  167. end
  168.  
  169. function roofline()
  170.  for x=1,6 do
  171.   turtle.select(5)
  172.   digDown()
  173.   turtle.placeDown()
  174.   turtle.forward()
  175.   sleep(0.5)
  176.  end
  177. end
  178.  
  179. function roof()
  180.  roofline()
  181.  right()
  182.  rooflineglass()
  183.  left()
  184.  rooflineglass()
  185.  right()
  186.  roofline()
  187.  left()
  188.  rooflineglass()
  189.  right()
  190.  rooflineglass()
  191.  left()
  192.  roofline()
  193. end
  194.  
  195. function checkwalls()
  196.  if turtle.getItemCount(1) < 64 then
  197.   print("Mancano blocchi alla posizione 1")
  198.   shell.exit()
  199.  end
  200.  
  201.  if turtle.getItemCount(2) < 64 then
  202.   print("Mancano blocchi alla posizione 2")
  203.   shell.exit()
  204.  end
  205.  
  206.  if turtle.getItemCount(3) < 32 then
  207.   print("Mancano blocchi alla posizione 3")
  208.   shell.exit()
  209.  end
  210. end
  211.  
  212. function checkfloor()
  213.  if turtle.getItemCount(4) < 49 then
  214.   print("Mancano blocchi alla posizionet 4")
  215.   shell.exit()
  216.  end
  217. end
  218.  
  219. function checkroof()
  220.  if turtle.getItemCount(5) < 33 then
  221.   print("Mancano blocchi alla posizione 5")
  222.   shell.exit()
  223.  end
  224. end
  225.  
  226. function checkskylights()
  227.  if turtle.getItemCount(6) < 16 then
  228.   print("Mancano blocchi alla posizione 6")
  229.   shell.exit()
  230.  end
  231. end
  232.  
  233. function checkblockcount()
  234.  checkwalls()
  235.  checkfloor()
  236.  checkroof()
  237.  checkskylights()
  238. end
  239.  
  240. function gohome()
  241.  digDown()
  242.  turtle.placedown()
  243.  turtle.forward()
  244.  sleep(0.5)
  245.  turtle.turnRight()
  246.  sleep(0.5)
  247.  turtle.forward()
  248.  sleep(0.5)
  249.  turtle.turnLeft()
  250.  sleep(0.5)
  251.  turtle.forward()
  252.  sleep(0.5)
  253.  for x=1,5 do
  254.   turtle.down()
  255.  end
  256.  print("Casa completata!")
  257. end
  258.  
  259. print("Benevenuti a la costruzione personalizzata della tua casa!")
  260. print("Non dimenticare di alimentarmi!")
  261. print("Iscriviti al canale youtube di Mr.alko99!")
  262. print("Muri = slots 1,2,3 (2.5 stacks)")
  263. print("Pavimento = slot 4 (49 blocchi)")
  264. print("Soffitto = slot 5 (33 blocchi)")
  265. print("Vetrate = 6 (16 blocchi)")
  266.  
  267. checkblockcount()
  268.  
  269. startingpos()
  270. walls()
  271. floorpos()
  272. floor()
  273. roofpos()
  274. roof()
  275. gohome()
Advertisement
Add Comment
Please, Sign In to add comment