Advertisement
Guest User

startup

a guest
Dec 16th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.79 KB | None | 0 0
  1. echarbon = false
  2. local modem = peripheral.wrap("right")
  3. local ig = {netherwart = {-318,108,749,1},
  4. glowstone = {423,4,-800,2},
  5. sucre = {-317,109,749,1},
  6. hopper = {-318,110,750,3},
  7. botle = {-318,109,749,1},
  8. bs = {-318,108,750,3},
  9. gunpowder = {423,6,-799,2},
  10. dragon = {423,5,-800,2},
  11. blazepowder = {423,5,-801,2},
  12. pasteque = {423,5,-801,2},
  13. oeila = {423,5,-801,2},
  14. larmeghast = {423,5,-801,2},
  15. magma = {423,5,-801,2},
  16. poissonglobe = {423,5,-801,2},
  17. carotte = {423,5,-801,2},
  18. oeilafermenter = {423,5,-801,2},
  19. spectral = {423,5,-801,2},
  20. redstone = {},
  21. charbon ={422,4,-802,2}}
  22.  
  23. local orientation = 2
  24. function corientation(o)
  25.     while orientation ~= o do
  26. turtle.turnLeft()
  27. orientation = orientation+1
  28. if orientation == 4 then
  29. orientation = 0
  30. end
  31. end
  32. end
  33. function afficheinfo()
  34. x, y, z = gps.locate(5)
  35. --term.clear()
  36. print("x: "..x)
  37. print("y: "..y)
  38. print("z: "..z)
  39. print("orientation: "..orientation)
  40. end
  41. function verifcharbon()
  42. if echarbon == true then
  43. else
  44. if turtle.getFuelLevel() < 25 then
  45. echarbon = true
  46. deplacementO(ig["charbon"][1],ig["charbon"][2],ig["charbon"][3],ig["charbon"][4])
  47. turtle.select(15)
  48. turtle.suck(64)
  49. turtle.refuel(turtle.getItemCount(15))
  50. turtle.select(1)
  51. end
  52. echarbon = false
  53. end
  54. echarbon = false
  55. end
  56. function deplacementy(y2)
  57.  x, y, z = gps.locate(5)
  58. afficheinfo()
  59. print(y2)
  60. while y ~= y2 do
  61. if y > y2 then
  62. turtle.down()
  63. verifcharbon()
  64. else
  65. turtle.up()
  66. verifcharbon()
  67. end
  68. x, y, z = gps.locate(5)
  69. afficheinfo()
  70. end
  71. end
  72. function deplacementz(z2)
  73. x, y, z = gps.locate(5)
  74. afficheinfo()
  75. if z > z2 then
  76. corientation(1)
  77. else
  78. corientation(3)
  79. end
  80.  
  81.  
  82. while z ~= z2 do
  83. turtle.forward()
  84. verifcharbon()
  85. x, y, z = gps.locate(5)
  86. afficheinfo()
  87. print("orientation"..orientation)
  88. end
  89. end
  90.  
  91. function deplacementx(x2)
  92. print("p")
  93. x, y, z = gps.locate(5)
  94. afficheinfo()
  95. if x > x2 then
  96. corientation(2)
  97. else
  98. corientation(0)
  99. end
  100. while x ~= x2 do
  101. turtle.forward()
  102. verifcharbon()
  103. x, y, z = gps.locate(5)
  104. afficheinfo()
  105. end
  106. end
  107. function deplacement(xa,ya,za)
  108. deplacementy(ya)
  109. deplacementx(xa)
  110. deplacementz(za)
  111. end
  112. function deplacemento(xa,ya,za,o)
  113. deplacementy(ya)
  114. deplacementx(xa)
  115. deplacementz(za)
  116. corientation(o)
  117. end
  118. function cbottle(potion, potion2, potion3, potion4)
  119. print("test")
  120. deplacemento(ig["botle"][1],ig["botle"][2],ig["botle"][3],ig["botle"][4])
  121. turtle.select(1)
  122. verify("water botle",potion, potion2, potion3, potion4)
  123. turtle.select(2)
  124. verify("water botle",potion, potion2, potion3, potion4)
  125. turtle.select(3)
  126. verify("water botle",potion, potion2, potion3, potion4)
  127. end
  128. function cnetherwart()
  129. deplacemento(ig["netherwart"][1],ig["netherwart"][2],ig["netherwart"][3],ig["netherwart"][4])
  130. turtle.select(4)
  131. verify(potion, potion2, potion3, potion4)
  132. end
  133. function ccnetherwart()
  134. deplacemento(ig["netherwart"][1],ig["netherwart"][2],ig["netherwart"][3],ig["netherwart"][4])
  135. turtle.select(4)
  136. turtle.drop(1)
  137. end
  138. function verify(item,potion, potion2, potion3, potion4)
  139. if not turtle.suck(1) then
  140. modem.transmit(45,45, "manque")
  141. modem.transmit(45,45, item)
  142. print("il manque :"..item)
  143. sleep(4)
  144. deplacemento(ig["botle"][1],ig["botle"][2],ig["botle"][3],ig["botle"][4])
  145. turtle.select(1)
  146. turtle.drop(1)
  147. turtle.select(2)
  148. turtle.drop(1)
  149. turtle.select(3)
  150. turtle.drop(1)
  151. if potion == "speed" then
  152. ccnetherwart()
  153. deplacemento(ig["sucre"][1],ig["sucre"][2],ig["sucre"][3],ig["sucre"][4])
  154. turtle.select(5)
  155. turtle.drop(1)
  156. elseif potion == "force" then
  157. cnetherwart(potion, potion2, potion3, potion4)
  158. deplacemento(ig["blazepowder"][1],ig["blazepowder"][2],ig["blazepowder"][3],ig["blazepowder"][4])
  159. turtle.select(5)
  160. turtle.drop(1)
  161. elseif potion == "soin" then
  162. ccnetherwart(potion, potion2, potion3, potion4)
  163. deplacemento(ig["pasteque"][1],ig["pasteque"][2],ig["pasteque"][3],ig["pasteque"][4])
  164. turtle.select(5)
  165. turtle.drop(1)
  166. elseif potion == "poison" then
  167. ccnetherwart(potion, potion2, potion3, potion4)
  168. deplacemento(ig["oeila"][1],ig["oeila"][2],ig["oeila"][3],ig["oeila"][4])
  169. turtle.select(5)
  170. turtle.drop(1)
  171. elseif potion == "regen" then
  172. ccnetherwart(potion, potion2, potion3, potion4)
  173. deplacemento(ig["larmeghast"][1],ig["larmeghast"][2],ig["larmeghast"][3],ig["larmeghast"][4])
  174. turtle.select(5)
  175. turtle.drop(1)
  176. elseif potion == "resistance" then
  177. ccnetherwart(potion, potion2, potion3, potion4)
  178. deplacemento(ig["magma"][1],ig["magma"][2],ig["magma"][3],ig["magma"][4])
  179. turtle.select(5)
  180. turtle.drop(1)
  181. elseif potion == "respiration" then
  182. cnetherwart(potion, potion2, potion3, potion4)
  183. deplacemento(ig["poissonglobe"][1],ig["poissonglobe"][2],ig["poissonglobe"][3],ig["poissonglobe"][4])
  184. turtle.select(5)
  185. turtle.drop(1)
  186. elseif potion == "visionnocturne" then
  187. ccnetherwart(potion, potion2, potion3, potion4)
  188. deplacemento(ig["carotte"][1],ig["carotte"][2],ig["carotte"][3],ig["carotte"][4])
  189. turtle.select(5)
  190. turtle.drop(1)
  191. elseif potion == "faiblesse" then
  192. deplacemento(ig["oeilafermenter"][1],ig["oeilafermenter"][2],ig["oeilafermenter"][3],ig["oeilafermenter"][4])
  193. turtle.select(5)
  194. turtle.drop(1)
  195. elseif potion == "invisibilite" then
  196. ccnetherwart(potion, potion2, potion3, potion4)
  197. deplacemento(ig["spectral"][1],ig["spectral"][2],ig["spectral"][3],ig["spectral"][4])
  198. turtle.select(5)
  199. turtle.drop(1)
  200. elseif potion == "lenteur" then
  201. ccnetherwart(potion, potion2, potion3, potion4)
  202. deplacemento(ig["sucre"][1],ig["sucre"][2],ig["sucre"][3],ig["sucre"][4])
  203. turtle.select(5)
  204. turtle.drop(1)
  205. deplacemento(ig["oeilafermenter"][1],ig["oeilafermenter"][2],ig["oeilafermenter"][3],ig["oeilafermenter"][4])
  206. turtle.select(6)
  207. turtle.drop(1)
  208. elseif potion == "degat" then
  209. ccnetherwart(potion, potion2, potion3, potion4)
  210. deplacemento(ig["pasteque"][1],ig["pasteque"][2],ig["pasteque"][3],ig["pasteque"][4])
  211. turtle.select(5)
  212. turtle.drop(1)
  213. deplacemento(ig["oeilafermenter"][1],ig["oeilafermenter"][2],ig["oeilafermenter"][3],ig["oeilafermenter"][4])
  214. turtle.select(6)
  215. turtle.drop(1)
  216. end
  217. if potion2 == "glowstone" then
  218. deplacemento(ig["glowstone"][1],ig["glowstone"][2],ig["glowstone"][3],ig["glowstone"][4])
  219. turtle.select(7)
  220. turtle.drop(1)
  221. elseif potion2 == "redstone" then
  222. deplacemento(ig["redstone"][1],ig["redstone"][2],ig["redstone"][3],ig["redstone"][4])
  223. turtle.select(7)
  224. turtle.drop(1)
  225. end
  226. if potion3 == true then
  227. deplacemento(ig["gunpowder"][1],ig["gunpowder"][2],ig["gunpowder"][3],ig["gunpowder"][4])
  228. turtle.select(8)
  229. turtle.drop(1)
  230. end
  231. if potion4 == true then
  232. deplacemento(ig["dragon"][1],ig["dragon"][2],ig["dragon"][3],ig["dragon"][4])
  233. turtle.select(9)
  234. turtle.drop(1)
  235. end
  236. corientation(2)
  237. sleep(5)
  238. os.reboot()
  239. end
  240. end
  241. function potion(potion, potion2, potion3, potion4)
  242. local etape = 0
  243. print(potion)
  244. print(potion2)
  245. print(potion3)
  246. print(potion4)
  247. cbottle(potion, potion2, potion3, potion4)
  248. if potion == "speed" then
  249. etape = etape + 2
  250. cnetherwart(potion, potion2, potion3, potion4)
  251. deplacemento(ig["sucre"][1],ig["sucre"][2],ig["sucre"][3],ig["sucre"][4])
  252. turtle.select(5)
  253. verify("sucre",potion, potion2, potion3, potion4)
  254. elseif potion == "force" then
  255. etape = etape + 2
  256. cnetherwart(potion, potion2, potion3, potion4)
  257. deplacemento(ig["blazepowder"][1],ig["blazepowder"][2],ig["blazepowder"][3],ig["blazepowder"][4])
  258. turtle.select(5)
  259. verify("blazepowder",potion, potion2, potion3, potion4)
  260. elseif potion == "soin" then
  261. etape = etape + 2
  262. cnetherwart(potion, potion2, potion3, potion4)
  263. deplacemento(ig["pasteque"][1],ig["pasteque"][2],ig["pasteque"][3],ig["pasteque"][4])
  264. turtle.select(5)
  265. verify("pasteque",potion, potion2, potion3, potion4)
  266. elseif potion == "poison" then
  267. etape = etape + 2
  268. cnetherwart(potion, potion2, potion3, potion4)
  269. deplacemento(ig["oeila"][1],ig["oeila"][2],ig["oeila"][3],ig["oeila"][4])
  270. turtle.select(5)
  271. verify("oeila",potion, potion2, potion3, potion4)
  272. elseif potion == "regen" then
  273. etape = etape + 2
  274. cnetherwart(potion, potion2, potion3, potion4)
  275. deplacemento(ig["larmeghast"][1],ig["larmeghast"][2],ig["larmeghast"][3],ig["larmeghast"][4])
  276. turtle.select(5)
  277. verify("larmeghast",potion, potion2, potion3, potion4)
  278. elseif potion == "resistance" then
  279. etape = etape + 2
  280. cnetherwart(potion, potion2, potion3, potion4)
  281. deplacemento(ig["magma"][1],ig["magma"][2],ig["magma"][3],ig["magma"][4])
  282. turtle.select(5)
  283. verify("magma",potion, potion2, potion3, potion4)
  284. elseif potion == "respiration" then
  285. etape = etape + 2
  286. cnetherwart(potion, potion2, potion3, potion4)
  287. deplacemento(ig["poissonglobe"][1],ig["poissonglobe"][2],ig["poissonglobe"][3],ig["poissonglobe"][4])
  288. turtle.select(5)
  289. verify("poissonglobe",potion, potion2, potion3, potion4)
  290. elseif potion == "visionnocturne" then
  291. etape = etape + 2
  292. cnetherwart(potion, potion2, potion3, potion4)
  293. deplacemento(ig["carotte"][1],ig["carotte"][2],ig["carotte"][3],ig["carotte"][4])
  294. turtle.select(5)
  295. verify("carotte",potion, potion2, potion3, potion4)
  296. elseif potion == "faiblesse" then
  297. etape = etape + 1
  298. deplacemento(ig["oeilafermenter"][1],ig["oeilafermenter"][2],ig["oeilafermenter"][3],ig["oeilafermenter"][4])
  299. turtle.select(5)
  300. verify("oeilafermenter",potion, potion2, potion3, potion4)
  301. elseif potion == "invisibilite" then
  302. etape = etape + 2
  303. cnetherwart(potion, potion2, potion3, potion4)
  304. deplacemento(ig["spectral"][1],ig["spectral"][2],ig["spectral"][3],ig["spectral"][4])
  305. turtle.select(5)
  306. verify("spectral",potion, potion2, potion3, potion4)
  307. elseif potion == "lenteur" then
  308. etape = etape + 3
  309. cnetherwart(potion, potion2, potion3, potion4)
  310. deplacemento(ig["sucre"][1],ig["sucre"][2],ig["sucre"][3],ig["sucre"][4])
  311. turtle.select(5)
  312. verify("sucre",potion, potion2, potion3, potion4)
  313. deplacemento(ig["oeilafermenter"][1],ig["oeilafermenter"][2],ig["oeilafermenter"][3],ig["oeilafermenter"][4])
  314. turtle.select(6)
  315. verify("oeilafermenter",potion, potion2, potion3, potion4)
  316. elseif potion == "degat" then
  317. etape = etape + 3
  318. cnetherwart(potion, potion2, potion3, potion4)
  319. deplacemento(ig["pasteque"][1],ig["pasteque"][2],ig["pasteque"][3],ig["pasteque"][4])
  320. turtle.select(5)
  321. verify("pasteque",potion, potion2, potion3, potion4)
  322. deplacemento(ig["oeilafermenter"][1],ig["oeilafermenter"][2],ig["oeilafermenter"][3],ig["oeilafermenter"][4])
  323. turtle.select(6)
  324. verify("oeilafermenter",potion, potion2, potion3, potion4)
  325. end
  326. if potion2 == "glowstone" then
  327. etape = etape + 1
  328. deplacemento(ig["glowstone"][1],ig["glowstone"][2],ig["glowstone"][3],ig["glowstone"][4])
  329. turtle.select(7)
  330. verify("glowstone",potion, potion2, potion3, potion4)
  331. elseif potion2 == "redstone" then
  332. etape = etape + 1
  333. deplacemento(ig["redstone"][1],ig["redstone"][2],ig["redstone"][3],ig["redstone"][4])
  334. turtle.select(7)
  335. verify("redstone",potion, potion2, potion3, potion4)
  336. end
  337. if potion3 == true then
  338. etape = etape + 1
  339. deplacemento(ig["gunpowder"][1],ig["gunpowder"][2],ig["gunpowder"][3],ig["gunpowder"][4])
  340. turtle.select(8)
  341. verify("gunpowder",potion, potion2, potion3, potion4)
  342. end
  343. if potion4 == true then
  344. etape = etape + 1
  345. deplacemento(ig["dragon"][1],ig["dragon"][2],ig["dragon"][3],ig["dragon"][4])
  346. turtle.select(9)
  347. verify("souffle du dragon",potion, potion2, potion3, potion4)
  348. end
  349. print("bs")
  350. os.sleep(3)
  351. deplacemento(ig["bs"][1],ig["bs"][2],ig["bs"][3],ig["bs"][4])
  352. print("bs2")
  353. turtle.select(1)
  354. turtle.drop(1)
  355. turtle.select(2)
  356. turtle.drop(1)
  357. turtle.select(3)
  358. turtle.drop(1)
  359. deplacemento(ig["hopper"][1],ig["hopper"][2],ig["hopper"][3],ig["hopper"][4])
  360. for i = 3,10 do
  361. turtle.select(i)
  362. turtle.drop(1)
  363. end
  364. corientation(2)
  365. modem.open(35)
  366. modem.transmit(35,35,(etape*20)+2)
  367. os.reboot()
  368. end
  369. --deplacemento(ig["bs"][1],ig["bs"][2],ig["bs"][3],ig["bs"][4])
  370. modem.closeAll()
  371. modem.open(45)
  372. local event, modemside, senderchannel,replychannel, message, senderdistance = os.pullEvent("modem_message")
  373. print(message)
  374. if not textutils.unserialize( message ) then
  375. os.reboot()
  376. end
  377. tableau = textutils.unserialize( message )
  378. local x, y, z = gps.locate(5)
  379. print(tableau[1])
  380. print(tableau[2])
  381. print(tableau[3])
  382. print(tableau[4])
  383. os.sleep(5)
  384.  potion(tostring(tableau[1]),tostring(tableau[2]),tableau[3],tableau[4])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement