Advertisement
Darknio

TurtlefarmMC

Aug 19th, 2014
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.38 KB | None | 0 0
  1. local inst = "on"    ---- nach dem Bau auf off stellen
  2.  
  3. auswahl = 0
  4. shutdown = 10
  5. --Bauprogramm Variable
  6. lang = 17
  7. breit = 12
  8. matOne = 1
  9. matTwo = 10
  10. matThree = 14
  11. turn = 1 -- Left Turn = 0 | Right Turn = 1
  12. matOneCount = 64
  13. matTwoCount = 64
  14. matThreeCount = 64
  15. matFourCount = 13
  16.  
  17. --Farmprogramm Variable
  18. item = 1
  19. ItemCount =64
  20. turnFarm = 0
  21.  
  22. benzin = turtle.getFuelLevel()
  23.  
  24.  
  25.  
  26. function Header()
  27. shell.run("clear")
  28. print("_______________________________________")
  29. print()
  30. print("      Farmprogramm by Darknio          ")
  31. print("_______________________________________")
  32. print()
  33. end
  34.  
  35. function Auswahl()
  36.  
  37. print("Bitte waehlen:")
  38. print()
  39. print(" [1]: Tutorial")
  40. print(" [2]: Bauprogramm")
  41. print(" [3]: Farmprogram")
  42. print ()
  43. write(" Bitte Waehlen sie jetzt: ")
  44. auswahl = io.read()
  45. end
  46.  
  47. function Tutorial()
  48. shell.run("clear")
  49. Header()
  50. print ("     Wilkommen zum Tutorial des ")
  51. print("         FarmE-Programms MKI")
  52. print()
  53. sleep(5)
  54. TutorialMats()
  55. sleep(10)
  56. end
  57.  
  58. function TutorialMats()
  59. shell.run("clear")
  60. print("Fuer das Bauprogramm (Auswahl 2) ")
  61. print("Bitte folgendes einlegen:")
  62. print("_______________________________________")
  63. print("Slot 1-6 je ein Stack Stein")
  64. print("Slot 7 einen Lavaeimer")
  65. print("Slot 8 einen Hebel")
  66. print("Slot 9 zwei Truhen")
  67. print("Slot 10+11 je ein Stack Erde")
  68. print("Slot 12 eine Redstonefackel")
  69. print("Slot 13 einen Kolben")
  70. print("Slot 14-16 je einen Wassereimer")
  71. print("Programm mit der Auswahl 2 starten")
  72. sleep(10)
  73. TutorialFarmTwo()
  74. end
  75.  
  76. function TutorialFarmOne()
  77. shell.run("clear")
  78. benzin = turtle.getFuelLevel()
  79. print("   Fuer das Farmprogram (Auswahl 3)")
  80. print("_______________________________________")
  81. print(" Bitte in die Kiste zur rechten Seite")
  82. print("    der Turtle Brennstoff einlegen")
  83. print()
  84. print("Setzlinge 5 Moves")
  85. print("Bretter und Staemme je 15 Moves")
  86. print("Kohle und Holzkohle je 80 Moves")
  87. print("Lavaeimer 1000 Moves")
  88. print()
  89. write("Momentan sind ")
  90. write(benzin)
  91. print(" Moves vorhanden")
  92. print("Es werden 125 Moves pro durchlauf benoetigt")
  93. sleep(10)
  94. Hinweis()
  95. end
  96.  
  97. function TutorialFarmTwo()
  98. shell.run("clear")
  99. print("   Fuer das Farmprogram (Auswahl 3)")
  100. print("_______________________________________")
  101. print(" Bitte in die Kiste zur linken Seite")
  102. print("    der Turtle Farmmaterial einlegen")
  103. print()
  104. print("Diese Farm kann folgendes verarbeiten")
  105. print("            Kartoffeln ")
  106. print("            Weizensamen")
  107. print("             Karotten")
  108. print()
  109. sleep(5)
  110. TutorialFarmThree()
  111. end
  112.  
  113. function TutorialFarmThree()
  114. shell.run("clear")
  115. print("   Fuer das Farmprogram (Auswahl 3)")
  116. print("_______________________________________")
  117. print(" Bitte in die Kiste zur linken Seite")
  118. print("    der Turtle Farmmaterial einlegen")
  119. print()
  120. print("    Fuer Samen aus Mods wird keine ")
  121. print("         Haftung Uebernommen")
  122. print("             das die Farm ")
  123. print("      ordnungsgemaes funktioniert")
  124. sleep(10)
  125. TutorialFarmOne()
  126. end
  127.  
  128. function Hinweis()
  129. shell.run("clear")
  130. print("  Am Schluss noch ein paar Hinweise:")
  131. print("_______________________________________")
  132. print("     Bei einer normalen Turtle")
  133. print("     Bitte das Feld vorackern")
  134. print("     Bei einer Farming Turtle")
  135. print("         Einfach Starten")
  136. print()
  137. print("  Nach einem DC bitte Turtle abbauen ")
  138. print(" und auf die Ausgangsposition stellen")
  139. print("      mit der Front nach Vorne")
  140. sleep(10)
  141. HinweisTwo()
  142. end
  143. function HinweisTwo()
  144. shell.run("clear")
  145. print("              Wichtig")
  146. print("    Zum Bau der Farm benoetige ich ")
  147. print(" eine gerade Flaeche mit festen Boden")
  148. print("")
  149. print("    Bitte machen sie mir Platz")
  150. print("  Breit wird die Farm 11 Bloecke")
  151. print("    Lang wird sie 17 Bloecke")
  152. print("    Hoch wird sie 8 Bloecke")
  153. sleep(15)
  154. Header()
  155. Auswahl()
  156. end
  157.  
  158.  
  159.  
  160. -- Anfang Bauprogramm
  161.  
  162.  
  163. function TankOne()
  164. if benzin < 700 then
  165.  
  166. turtle.select (7)
  167. turtle.refuel()
  168. turtle.select (1)
  169.  
  170.  
  171. end
  172. end
  173.  
  174. function Turn()
  175. if turn == 0 then
  176. turtle.turnLeft()
  177. turtle.forward()
  178. turtle.turnLeft()
  179. turtle.forward()
  180. turn = 1
  181.  
  182.  
  183. elseif turn == 1 then
  184. turtle.turnRight()
  185. turtle.forward()
  186. turtle.turnRight()
  187. turtle.forward()
  188. turn = 0
  189. end
  190.  
  191. end
  192.  
  193. function Place()
  194. turtle.placeDown()
  195. turtle.forward()
  196. end
  197.  
  198. function Double()
  199. matOneCount = turtle.getItemCount(matOne)
  200. if matOneCount == 0 then
  201. matOne = matOne + 1
  202. end
  203. turtle.select(matOne)
  204. turtle.placeDown()
  205. turtle.up()
  206. matOneCount = turtle.getItemCount(matOne)
  207. if matOneCount == 0 then
  208. matOne = matOne + 1
  209. end
  210. turtle.select(matOne)
  211. turtle.placeDown()
  212. turtle.forward()
  213. turtle.down()
  214. end
  215.  
  216. function PlaceZero()
  217. turtle.forward()
  218. end
  219.  
  220. function MatOne()
  221. matOneCount = turtle.getItemCount(matOne)
  222. if matOneCount == 0 then
  223. matOne = matOne + 1
  224. end
  225. turtle.select(matOne)
  226. Place()
  227.  
  228. end
  229.  
  230. function MatTwo()
  231. matTwoCount = turtle.getItemCount(matTwo)
  232. if matTwoCount == 0 then
  233. matTwo = matTwo + 1
  234. end
  235. turtle.select(matTwo)
  236. Place()
  237.  
  238. end
  239.  
  240. function MatThree()
  241.  
  242. turtle.select(matThree)
  243. turtle.placeDown()
  244. matThree = matThree + 1
  245.  
  246. end
  247.  
  248. function ZeileOne()
  249. MatOne()
  250. PlaceZero()
  251. for i = 1,7 do
  252. MatTwo()
  253. end
  254. PlaceZero()
  255. MatOne()
  256. end
  257.  
  258. function ZeileTwo()
  259. for j = 1,6 do
  260. MatOne()
  261. for i = 1,7 do
  262. PlaceZero()
  263. end
  264. MatOne()
  265. Turn()
  266. end
  267. end
  268.  
  269. function MatOneEbene()
  270. for i = 1,11 do
  271. MatOne()
  272. end
  273. Turn()
  274. end
  275.  
  276. function EbeneOne()
  277. sleep(0.5)
  278. turtle.up()
  279. for c = 1,11 do
  280. MatOne()
  281. end
  282. Turn()
  283. MatOne()
  284. MatOne()
  285. for k = 1,7 do
  286. PlaceZero()
  287. end
  288. MatOne()
  289. MatOne()
  290. Turn()
  291.  
  292. for i = 1,7 do
  293. ZeileOne()
  294. Turn()
  295. end
  296. MatOne()
  297. PlaceZero()
  298. for u = 1,7 do
  299. MatOne()
  300. end
  301. PlaceZero()
  302. MatOne()
  303. Turn()
  304.  
  305.  
  306.  
  307. for c = 1,7 do
  308. MatOneEbene()
  309. end
  310. end
  311.  
  312. function EbeneTwo()
  313. turtle.up()
  314. turtle.turnRight()
  315. turtle.forward()
  316. turtle.turnLeft()
  317. turn = 1
  318. for i = 1,11 do
  319. MatOne()
  320. end
  321. Turn()
  322.  
  323.  
  324. for u = 1,7 do
  325. ZeileOne()
  326. Turn()
  327. end
  328.  
  329. for t = 1,7 do
  330. MatOne()
  331. MatOne()
  332. for i = 1,7 do
  333. PlaceZero()
  334. end
  335. MatOne()
  336. MatOne()
  337. Turn()
  338. end
  339.  
  340.  
  341. end
  342.  
  343. function EbeneThree()
  344. turn = 1
  345. turtle.forward()
  346. turtle.turnRight()
  347. turtle.up()
  348. for i = 1,8 do
  349. turtle.forward()
  350. end
  351. turtle.turnLeft()
  352. ZeileTwo()
  353.  
  354. turtle.down()
  355. MatThree()
  356. sleep(0.25)
  357. turtle.up()
  358. sleep(0.25)
  359. MatOne()
  360.  
  361. for t = 1,7 do
  362. PlaceZero()
  363. end
  364.  
  365. turtle.down()
  366. MatThree()
  367. sleep(0.25)
  368. turtle.up()
  369. sleep(0.25)
  370. MatOne()
  371. Turn()
  372.  
  373.  
  374. for z = 1,9 do
  375. MatOne()
  376. end
  377.  
  378. turtle.turnLeft()
  379. turtle.turnLeft()
  380.  
  381. end
  382.    
  383. function EbeneFour()
  384. turn = 0
  385.  
  386. turtle.up()
  387. turtle.forward()
  388.  
  389. for i = 1,9 do
  390. MatOne()
  391. end
  392. Turn()
  393. MatOne()
  394. PlaceZero()
  395. PlaceZero()
  396. MatOne()
  397. PlaceZero()
  398. MatOne()
  399. PlaceZero()
  400. PlaceZero()
  401. MatOne()
  402. Turn()
  403. MatOne()
  404. for i = 1,7 do
  405. PlaceZero()
  406. end
  407. MatOne()
  408. end
  409.  
  410. function EbeneFife()
  411. turn = 0
  412. turtle.turnLeft()
  413. turtle.turnLeft()
  414. turtle.forward()
  415. turtle.up()
  416.  
  417. for i = 1,9 do
  418. MatOne()
  419. end
  420. Turn()
  421. MatOne()
  422. for z = 1,7 do
  423. PlaceZero()
  424. end
  425. MatOne()
  426. Turn()
  427. for i = 1,9 do
  428. MatOne()
  429. end
  430. end
  431.  
  432. function EbeneSix()
  433. turtle.turnRight()
  434. turtle.turnRight()
  435. turtle.up()
  436.  
  437. turtle.forward()
  438. turtle.forward()
  439. turn = 0
  440. for i = 1,7 do
  441. Double()
  442. end
  443. Turn()
  444. Double()
  445. turtle.forward()
  446. turtle.forward()
  447. turtle.select(13)
  448. turtle.placeDown()
  449. turtle.forward()
  450. turtle.forward()
  451. turtle.forward()
  452. Double()
  453. Turn()
  454. Double()
  455. Double()
  456. Double()
  457. turtle.select(12)
  458. turtle.placeDown()
  459. turtle.up()
  460. turtle.select(matOne)
  461. turtle.placeDown()
  462. turtle.forward()
  463. turtle.down()
  464. Double()
  465. Double()
  466. Double()
  467. end
  468.  
  469. function EbeneSeven()
  470. turtle.up()
  471. turtle.turnLeft()
  472. turtle.turnLeft()
  473. turtle.up()
  474. turn = 0
  475. turtle.forward()
  476. turtle.forward()
  477. for i = 1,5 do
  478. MatOne()
  479. end
  480. Turn()
  481. MatOne()
  482. MatOne()
  483. PlaceZero()
  484. MatOne()
  485. MatOne()
  486. Turn()
  487. for i = 1,5 do
  488. MatOne()
  489. end
  490. for i = 1,3 do
  491. turtle.back()
  492. end
  493. turtle.turnRight()
  494. turtle.forward()
  495. MatThree()
  496.  
  497. end
  498.  
  499. function BauHome()
  500. turtle.up()
  501. turtle.select(6)
  502. turtle.placeDown()
  503. turtle.select(1)
  504. for i = 1,3 do
  505. turtle.forward()
  506. end
  507. turtle.turnLeft()
  508. turtle.turnLeft()
  509. for d = 1,5 do
  510. turtle.down()
  511. end
  512.  
  513. turtle.select(8)
  514. turtle.place()
  515. turtle.turnLeft()
  516. turtle.turnLeft()
  517. for i = 1,12 do
  518. turtle.forward()
  519. end
  520. for u = 1,2 do
  521. turtle.down()
  522. end
  523. turtle.select(9)
  524. turtle.placeDown()
  525. turtle.turnLeft()
  526. for e = 1,4 do
  527. turtle.forward()
  528. end
  529. turtle.select(9)
  530. turtle.placeDown()
  531. item = 1
  532.  
  533.  
  534. for i = 1,16 do
  535. turtle.select(item)
  536. turtle.dropDown()
  537. item = item + 1
  538. end
  539. turtle.back()
  540. turtle.turnLeft()
  541. turtle.down()
  542. end
  543.  
  544. function BauprogrammFunc()
  545. TankOne()
  546. turtle.turnLeft()
  547. EbeneOne()
  548. EbeneTwo()
  549. EbeneThree()
  550. EbeneFour()
  551. EbeneFife()
  552. EbeneSix()
  553. EbeneSeven()
  554. BauHome()
  555. turtle.select(1)
  556. --Ende Bauprogramm
  557. end
  558.  
  559. function BauStart()
  560. print("Bitte folgendes einlegen:")
  561. print("Slot 1-6 je ein Stack Stein")
  562. print(" Slot 6 ein Glowstone ggf. Stein")
  563. print("Slot 7 einen Lavaeimer")
  564. print("Slot 8 einen Hebel")
  565. print("Slot 9 zwei Truhen")
  566. print("Slot 10+11 je ein Stack Erde")
  567. print("Slot 12 eine Redstonefackel")
  568. print("Slot 13 einen Kolben")
  569. print("Slot 14-16 je einen Wassereimer")
  570. write("Wollen sie das Programm starten y/n: ")
  571. start = io.read()
  572. if start == "y" then
  573. BauprogrammFunc()
  574. os.reboot()
  575. else
  576. shell.run("clear")
  577. print()
  578. print()
  579. print("         Falsche Eingabe")
  580. print(" Das System wird herruntergefahren")
  581. for i = 1,11 do
  582. shell.run("clear")
  583. print()
  584. print()
  585. print("         Falsche Eingabe")
  586. print(" Das System wird herruntergefahren")
  587. print()
  588. write("                  ")
  589. print(shutdown)
  590. shutdown = shutdown-1
  591. sleep(1)
  592. end
  593. os.shutdown()
  594. end
  595. end
  596. --Anfang Farmprogramm
  597.  
  598.  
  599.  
  600.  
  601. function Tanktwo()
  602. if benzin < 125 then
  603.  
  604. turtle.select(16)
  605. turtle.refuel()
  606. turtle.select(1)
  607.  
  608.  
  609. end
  610. end
  611.  
  612. function Samen()
  613.  
  614. ItemCount = turtle.getItemCount(item)
  615.  
  616. if ItemCount == 0 then
  617.  
  618. item = item + 1
  619. end
  620. turtle.select(item)
  621. turtle.digDown()
  622. turtle.placeDown()
  623. turtle.forward()
  624.  
  625. end
  626.  
  627. function StartFarm()
  628. print("2")
  629. turtle.turnLeft()
  630. turtle.forward()
  631. turtle.forward()
  632. turtle.suck()
  633. turtle.suck()
  634. turtle.back()
  635. turtle.back()
  636. turtle.turnRight()
  637. turtle.up()
  638. turtle.forward()
  639. turtle.forward()
  640. turtle.turnLeft()
  641. end
  642.  
  643. function ZeileFarm()
  644. for i = 1,6 do
  645. Samen()
  646. end
  647. end
  648.  
  649. function TurnFarm()
  650. if turnFarm == 0 then
  651. turtle.select(item)
  652. turtle.digDown()
  653. turtle.placeDown()
  654. turtle.turnRight()
  655. turtle.forward()
  656. turtle.turnRight()
  657. turnFarm = 1
  658.  
  659. elseif turnFarm == 1 then
  660. turtle.select(item)
  661. turtle.digDown()
  662. turtle.placeDown()
  663. turtle.turnLeft()
  664. turtle.forward()
  665. turtle.turnLeft()
  666. turnFarm = 0
  667. end
  668. end
  669.  
  670. function EbeneOneFarm()
  671.  
  672. for i = 1,6 do
  673. ZeileFarm()
  674. TurnFarm()
  675. end
  676.  
  677. ZeileFarm()
  678. turtle.select(item)
  679. turtle.digDown()
  680. turtle.placeDown()
  681. turtle.up()
  682.  
  683. TurnFarm()
  684.  
  685. end
  686.  
  687. function EbeneTwoFarm()
  688.  
  689. for i = 1,6 do
  690. ZeileFarm()
  691. TurnFarm()
  692. end
  693.  
  694. end
  695.  
  696. function DropFarm()
  697. item = 1
  698. for i = 1,16 do
  699. turtle.select(item)
  700. turtle.dropDown()
  701. item = item +1
  702. end
  703. item = 1
  704. turtle.select(item)
  705. end
  706.  
  707. function HomeFarm()
  708.  
  709. turtle.turnRight()
  710. for i = 1,15 do
  711. turtle.forward()
  712. end
  713. turtle.down()
  714. turtle.turnLeft()
  715. turtle.forward()
  716. turtle.forward()
  717. turtle.forward()
  718. DropFarm()
  719. turtle.forward()
  720. turtle.forward()
  721. turtle.forward()
  722. turtle.turnLeft()
  723. turtle.down()
  724. end
  725.  
  726. function FarmprogrammFunc()
  727. Tanktwo()
  728. StartFarm()
  729. EbeneOneFarm()
  730. EbeneTwoFarm()
  731. HomeFarm()
  732. os.reboot()
  733. end
  734.  
  735. --Ende Farmprogramm
  736. if inst =="on" then
  737.  
  738. Header()
  739. Auswahl()
  740. if auswahl == "1" then
  741. Tutorial()
  742. elseif auswahl == "2" then
  743. BauStart()
  744. elseif auswahl =="3" then
  745. shell.run("clear")
  746. Header()
  747. FarmprogrammFunc()
  748. else
  749.  
  750.  
  751. end
  752.  
  753. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement