funkd0ct0r

Untitled

Mar 23rd, 2014
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.55 KB | None | 0 0
  1. -- setup is turtle facing apiary, with a (large, maybe dimensional storage) chest beneath the turtle
  2. -- RwTbaqpP
  3.  
  4. local apiary = peripheral.wrap("front")
  5. local chest = peripheral.wrap("bottom")
  6. local maxDrones = 6
  7. local minDrones = 3
  8.  
  9. bees = {}
  10. stacks = {}
  11. shutdownMsg = nil
  12.  
  13. function addParent(parent, offspring)
  14. if not bees[parent] then
  15. bees[parent] = {
  16. --name = parent,
  17. score = 0,
  18. mutateFrom = {}
  19. }
  20. end
  21. end
  22.  
  23. function addOffspring(offspring, parentss)
  24. if bees[offspring] then
  25. for i, parents in ipairs(parentss) do
  26. table.insert(bees[offspring].mutateFrom, parents)
  27. end
  28. else
  29. bees[offspring] = {
  30. score = 0,
  31. mutateFrom = parentss
  32. }
  33. end
  34. for i, parents in ipairs(parentss) do
  35. for i, parent in ipairs(parents) do
  36. addParent(parent, offspring)
  37. end
  38. end
  39. end
  40.  
  41.  
  42.  
  43.  
  44. -- produce combinations from 1 or 2 lists
  45. function choose(list, list2)
  46. local newList = {}
  47. if list2 then
  48. for i = 1, #list2 do
  49. for j = 1, #list do
  50. if list[j] ~= list[i] then
  51. table.insert(newList, {list[j], list2[i]})
  52. end
  53. end
  54. end
  55. else
  56. for i = 1, #list do
  57. for j = i, #list do
  58. if list[i] ~= list[j] then
  59. table.insert(newList, {list[i], list[j]})
  60. end
  61. end
  62. end
  63. end
  64. return newList
  65. end
  66.  
  67.  
  68. --bee list from Master Apiarist Database v3.1
  69. --Forestry v2.3.0.7 (683)
  70. --Extra Bees v1.8-dev2
  71. --Magic Bees v2.1.7 (build 78)
  72.  
  73. addOffspring("Common", choose({"Forest", "Meadows", "Modest", "Wintry", "Tropical", "Marshy", "Water", "Rocky", "Mystical", "Sorcerous", "Unusual", "Attuned"}))
  74. addOffspring("Cultivated", choose({"Common"}, {"Forest", "Meadows", "Modest", "Wintry", "Tropical", "Marshy", "Water", "Rocky", "Mystical", "Sorcerous", "Unusual", "Attuned"}))
  75.  
  76. addOffspring("Noble", {{"Common", "Cultivated"}})
  77. addOffspring("Majestic", {{"Noble", "Cultivated"}})
  78. addOffspring("Imperial", {{"Noble", "Majestic"}})
  79. addOffspring("Diligent", {{"Common", "Cultivated"}})
  80. addOffspring("Unweary", {{"Diligent", "Cultivated"}})
  81. addOffspring("Industrious", {{"Diligent", "Unweary"}})
  82. addOffspring("Heroic", {{"Steadfast", "Valiant"}})
  83. addOffspring("Sinister", choose({"Cultivated"}, {"Modest", "Tropical"}))
  84. addOffspring("Fiendish", choose({"Sinister"}, {"Cultivated", "Modest", "Tropical"}))
  85. addOffspring("Frugal", choose({"Modest"}, {"Sinister", "Fiendish"}))
  86. addOffspring("Demonic", {{"Sinister", "Fiendish"}})
  87. addOffspring("Austere", {{"Modest", "Frugal"}})
  88. addOffspring("Exotic", {{"Austere", "Tropical"}})
  89. addOffspring("Edenic", {{"Exotic", "Tropical"}})
  90. addOffspring("Spectral", {{"Hermitic", "Ender"}})
  91. addOffspring("Phantasmal", {{"Spectral", "Ender"}})
  92. addOffspring("Icy", {{"Industrious", "Wintry"}})
  93. addOffspring("Glacial", {{"Icy", "Wintry"}})
  94. addOffspring("Vindictive", {{"Monastic", "Demonic"}})
  95. addOffspring("Vengeful", choose({"Vindictive"}, {"Demonic", "Monastic"}))
  96. addOffspring("Avenging", {{"Vengeful", "Vindictive"}})
  97. addOffspring("Leporine", {{"Meadows", "Forest"}})
  98. addOffspring("Merry", {{"Wintry", "Forest"}})
  99. addOffspring("Tipsy", {{"Wintry", "Meadows"}})
  100. addOffspring("Tricky", {{"Sinister", "Common"}})
  101. addOffspring("Rural", {{"Meadows", "Diligent"}})
  102. addOffspring("Secluded", {{"Monastic", "Austere"}})
  103. addOffspring("Hermitic", {{"Monastic", "Secluded"}})
  104. addOffspring("Arid", {{"Meadows", "Modest"}})
  105. addOffspring("Barren", {{"Arid", "Common"}})
  106. addOffspring("Desolate", {{"Arid", "Barren"}})
  107. addOffspring("Decaying", {{"Desolate", "Modest"}})
  108. addOffspring("Skeletal", {{"Desolate", "Frugal"}})
  109. addOffspring("Creepy", {{"Desolate", "Austere"}})
  110. addOffspring("Decomposing", {{"Gnawing", "Common"}})
  111. addOffspring("Tolerant", {{"Rocky", "Diligent"}})
  112. addOffspring("Robust", {{"Rocky", "Tolerant"}})
  113. addOffspring("Resilient", {{"Imperial", "Robust"}})
  114. addOffspring("Corroded", {{"Resilient", "Forest"}})
  115. addOffspring("Tarnished", {{"Resilient", "Marshy"}})
  116. addOffspring("Rusty", {{"Resilient", "Meadows"}})
  117. addOffspring("Leaden", {{"Resilient", "Unweary"}})
  118. addOffspring("Galvanized", {{"Tarnished", "Cultivated"}})
  119. addOffspring("Impregnable", {{"Resilient", "Noble"}})
  120. addOffspring("Invincible", {{"Resilient", "Ender"}})
  121. addOffspring("Glittering", {{"Corroded", "Imperial"}})
  122. addOffspring("Shining", {{"Rusty", "Imperial"}})
  123. addOffspring("Valuable", {{"Glittering", "Shining"}})
  124. addOffspring("Lapis", {{"Resilient", "Water"}})
  125. addOffspring("Emerald", {{"Lapis", "Noble"}})
  126. addOffspring("Ruby", {{"Emerald", "Austere"}})
  127. addOffspring("Sapphire", {{"Emerald", "Ocean"}})
  128. addOffspring("Diamond", {{"Lapis", "Imperial"}})
  129. addOffspring("Unstable", {{"Austere", "Rocky"}})
  130. addOffspring("Nuclear", {{"Unstable", "Rusty"}})
  131. addOffspring("Radioactive", {{"Nuclear", "Glittering"}})
  132. addOffspring("Ancient", {{"Noble", "Diligent"}})
  133. addOffspring("Primeval", {{"Ancient", "Noble"}})
  134. addOffspring("Prehistoric", {{"Primeval", "Majestic"}})
  135. addOffspring("Relic", {{"Prehistoric", "Imperial"}})
  136. addOffspring("Fossilised", {{"Primeval", "Growing"}})
  137. addOffspring("Resinous", {{"Primeval", "Fungal"}})
  138. addOffspring("Oily", {{"Primeval", "Ocean"}})
  139. addOffspring("Distilled", {{"Oily", "Industrious"}})
  140. addOffspring("Refined", {{"Oily", "Distilled"}})
  141. addOffspring("Elastic", {{"Refined", "Resinous"}})
  142. addOffspring("River", {{"Water", "Common"}})
  143. addOffspring("Ocean", {{"Water", "Diligent"}})
  144. addOffspring("Stained", {{"Ebony", "Ocean"}})
  145. addOffspring("Growing", {{"Diligent", "Forest"}})
  146. addOffspring("Thriving", {{"Growing", "Rural"}})
  147. addOffspring("Blooming", {{"Thriving", "Growing"}})
  148. addOffspring("Sweetened", {{"Valiant", "Diligent"}})
  149. addOffspring("Sugary", {{"Sweetened", "Diligent"}})
  150. addOffspring("Ripening", {{"Sugary", "Forest"}})
  151. addOffspring("Fruity", {{"Ripening", "Rural"}})
  152. addOffspring("Farmed", {{"Cultivated", "Rural"}})
  153. addOffspring("Bovine", {{"Rural", "Water"}})
  154. addOffspring("Caffeinated", {{"Tropical", "Rural"}})
  155. addOffspring("Minty", {{"Tropical", "Farmed"}})
  156. addOffspring("Damp", {{"Common", "Marshy"}})
  157. addOffspring("Boggy", {{"Damp", "Marshy"}})
  158. addOffspring("Fungal", {{"Boggy", "Damp"}})
  159. addOffspring("Furious", {{"Embittered", "Sinister"}})
  160. addOffspring("Volcanic", {{"Embittered", "Furious"}})
  161. addOffspring("Malicious", {{"Sinister", "Tropical"}})
  162. addOffspring("Infectious", {{"Malicious", "Tropical"}})
  163. addOffspring("Virulent", {{"Malicious", "Infectious"}})
  164. addOffspring("Viscous", {{"Water", "Exotic"}})
  165. addOffspring("Glutinous", {{"Viscous", "Exotic"}})
  166. addOffspring("Sticky", {{"Viscous", "Glutinous"}})
  167. addOffspring("Corrosive", {{"Virulent", "Sticky"}})
  168. addOffspring("Caustic", {{"Corrosive", "Fiendish"}})
  169. addOffspring("Acidic", {{"Corrosive", "Caustic"}})
  170. addOffspring("Excited", {{"Cultivated", "Valiant"}})
  171. addOffspring("Energetic", {{"Excited", "Valiant"}})
  172. addOffspring("Frigid", {{"Wintry", "Diligent"}})
  173. addOffspring("Absolute", {{"Ocean", "Frigid"}})
  174. addOffspring("Shadowed", {{"Tolerant", "Sinister"}})
  175. addOffspring("Darkened", {{"Shadowed", "Embittered"}})
  176. addOffspring("Abyssal", {{"Shadowed", "Darkened"}})
  177. addOffspring("Maroon", {{"Forest", "Valiant"}})
  178. addOffspring("Saffron", {{"Meadows", "Valiant"}})
  179. addOffspring("Prussian", {{"Water", "Valiant"}})
  180. addOffspring("Natural", {{"Tropical", "Valiant"}})
  181. addOffspring("Ebony", {{"Rocky", "Valiant"}})
  182. addOffspring("Bleached", {{"Wintry", "Valiant"}})
  183. addOffspring("Sepia", {{"Marshy", "Valiant"}})
  184. addOffspring("Amber", {{"Maroon", "Saffron"}})
  185. addOffspring("Turquoise", {{"Natural", "Prussian"}})
  186. addOffspring("Indigo", {{"Maroon", "Prussian"}})
  187. addOffspring("Slate", {{"Ebony", "Bleached"}})
  188. addOffspring("Azure", {{"Prussian", "Bleached"}})
  189. addOffspring("Lavender", {{"Maroon", "Bleached"}})
  190. addOffspring("Lime", {{"Natural", "Bleached"}})
  191. addOffspring("Fuchsia", {{"Indigo", "Lavender"}})
  192. addOffspring("Ashen", {{"Slate", "Bleached"}})
  193. addOffspring("Celebratory", {{"Austere", "Excited"}})
  194. addOffspring("Jaded", {{"Ender", "Relic"}})
  195. addOffspring("Glowering", {{"Furious", "Excited"}})
  196. addOffspring("Hazardous", {{"Austere", "Desolate"}})
  197. addOffspring("Lustered", {{"Resilient", "Unweary"}})
  198. addOffspring("Abnormal", {{"Secluded", "Ender"}})
  199. addOffspring("Spatial", {{"Abnormal", "Hermitic"}})
  200. addOffspring("Quantum", {{"Spatial", "Spectral"}})
  201. addOffspring("Eldritch", choose({"Cultivated"}, {"Mystical", "Sorcerous", "Unusual", "Attuned"}))
  202. addOffspring("Esoteric", {{"Cultivated", "Eldritch"}})
  203. addOffspring("Mysterious", {{"Eldritch", "Esoteric"}})
  204. addOffspring("Arcane", {{"Esoteric", "Mysterious"}})
  205. addOffspring("Charmed", {{"Cultivated", "Eldritch"}})
  206. addOffspring("Enchanted", {{"Eldritch", "Charmed"}})
  207. addOffspring("Supernatural", {{"Charmed", "Enchanted"}})
  208. addOffspring("Ethereal", {{"Arcane", "Supernatural"}})
  209. addOffspring("Watery", {{"Supernatural", "Ethereal"}})
  210. addOffspring("Earthen", {{"Supernatural", "Ethereal"}})
  211. addOffspring("Firey", {{"Supernatural", "Ethereal"}})
  212. addOffspring("Windy", {{"Supernatural", "Ethereal"}})
  213. addOffspring("Pupil", {{"Monastic", "Arcane"}})
  214. addOffspring("Scholarly", {{"Arcane", "Pupil"}})
  215. addOffspring("Savant", {{"Pupil", "Scholarly"}})
  216. addOffspring("Aware", {{"Ethereal", "Attuned"}})
  217. addOffspring("Spirit", choose({"Aware"}, {"MystEtherealical", "Attuned"}))
  218. addOffspring("Soul", {{"Aware", "Spirit"}})
  219. addOffspring("Skulking", {{"Modest", "Eldritch"}})
  220. addOffspring("Ghastly", {{"Skulking", "Ethereal"}})
  221. addOffspring("Spidery", {{"Tropical", "Skulking"}})
  222. addOffspring("Smouldering", {{"Skulking", "Hateful"}})
  223. addOffspring("Timely", {{"Imperial", "Ethereal"}})
  224. addOffspring("Lordly", {{"Imperial", "Timely"}})
  225. addOffspring("Doctoral", {{"Timely", "Lordly"}})
  226. addOffspring("Infernal", {{"Infernal", "ves"}})
  227. addOffspring("Hateful", {{"Infernal", "Eldritch"}})
  228. addOffspring("Spiteful", {{"Infernal", "Hateful"}})
  229. addOffspring("Withering", {{"Demonic", "Spiteful"}})
  230. addOffspring("Oblivion", {{"Oblivion", "ves"}})
  231. addOffspring("Nameless", {{"Ethereal", "Oblivion"}})
  232. addOffspring("Abandoned", {{"Oblivion", "Nameless"}})
  233. addOffspring("Forlorn", {{"Nameless", "Abandoned"}})
  234. addOffspring("Draconic", {{"Imperial", "Abandoned"}})
  235. addOffspring("Ferrous", {{"Common", "Industrious"}})
  236. addOffspring("Auric", {{"Minium", "Plumbum"}})
  237. addOffspring("Cuprum", {{"Industrious", "Meadows"}})
  238. addOffspring("Stannum", {{"Industrious", "Forest"}})
  239. addOffspring("Argentum", {{"Imperial", "Modest"}})
  240. addOffspring("Plumbum", {{"Stannum", "Common"}})
  241. addOffspring("Aluminum", {{"Industrious", "Cultivated"}})
  242. addOffspring("Ardite", {{"Industrious", "Infernal"}})
  243. addOffspring("Cobalt", {{"Imperial", "Infernal"}})
  244. addOffspring("Manyullyn", {{"Ardite", "Cobalt"}})
  245. addOffspring("Diamandi", {{"Austere", "Auric"}})
  246. addOffspring("Esmeraldi", {{"Austere", "Argentum"}})
  247. addOffspring("Apatine", {{"Rural", "Cuprum"}})
  248. addOffspring("Mutable", {{"Unusual", "Eldritch"}})
  249. addOffspring("Transmuting", {{"Unusual", "Mutable"}})
  250. addOffspring("Crumbling", {{"Unusual", "Mutable"}})
  251. addOffspring("Invisible", {{"Mystical", "Mutable"}})
  252. addOffspring("Aer", {{"Windy", "Windy"}})
  253. addOffspring("Ignis", {{"Firey", "Firey"}})
  254. addOffspring("Aqua", {{"Watery", "Watery"}})
  255. addOffspring("Solum", {{"Earthen", "Earthen"}})
  256. addOffspring("Ordered", {{"Ethereal", "Arcane"}})
  257. addOffspring("Chaotic", {{"Ethereal", "Supernatural"}})
  258. addOffspring("Brainy", {{"Skulking", "Pupil"}})
  259. addOffspring("Batty", {{"Skulking", "Windy"}})
  260. addOffspring("Poultry", {{"Common", "Skulking"}})
  261. addOffspring("Beefy", {{"Common", "Skulking"}})
  262. addOffspring("Porcine", {{"Common", "Skulking"}})
  263. addOffspring("Minium", {{"Frugal", "Eldritch"}})
  264.  
  265.  
  266.  
  267.  
  268. function findAvailableParent(species, score, type)
  269.  
  270. for i, stack in pairs(stacks) do
  271. if stack.beeInfo.displayName == species then
  272. if type then
  273. if string.find(stack.name, type) then
  274. return species, nil, score
  275. end
  276. else
  277. return species, nil, score
  278. end
  279. end
  280. end
  281.  
  282. local aScore, aParent, aOffspring
  283. local beeScore = 99999
  284. local beeParent = nil
  285. local beeOffspring = nil
  286.  
  287. for i, parents in ipairs(bees[species].mutateFrom) do
  288. aParent, aOffspring, aScore = findAvailableParent(parents[1], score + 1, type)
  289. if aScore < beeScore then
  290. beeScore = aScore
  291. beeParent = aParent
  292. beeOffspring = aOffspring
  293. end
  294. aParent, aOffspring, aScore = findAvailableParent(parents[2], score + 1, type)
  295. if aScore < beeScore then
  296. beeScore = aScore
  297. beeParent = aParent
  298. beeOffspring = aOffspring
  299. end
  300. end
  301. if beeOffspring == nil then
  302. beeOffspring = species
  303. end
  304. return beeParent, beeOffspring, beeScore
  305. end
  306.  
  307.  
  308. local function findSpecies(species)
  309. local princessIndex = nil
  310. local droneIndex = nil
  311.  
  312. for i, stack in pairs(stacks) do
  313. if stack.beeInfo.displayName == species then
  314. if string.find(stack.name, "Princess") then
  315. princessIndex = i
  316. end
  317. if string.find(stack.name, "Drone") then
  318. droneIndex = i
  319. end
  320. end
  321. end
  322. return princessIndex, droneIndex
  323. end
  324.  
  325. local function breedSpecies(parent1, parent2)
  326. local princess1 = nil
  327. local princess2 = nil
  328. local drone1 = nil
  329. local drone2 = nil
  330.  
  331. princess1, drone1 = findSpecies(parent1)
  332. princess2, drone2 = findSpecies(parent2)
  333.  
  334. if not (princess1 and drone2) then
  335. princess1 = princess2
  336. drone2 = drone1
  337. end
  338.  
  339. print("Breeding " .. parent1 .. " with " .. parent2)
  340.  
  341. if princess1 and drone2 then
  342. chest.pushItem("up", princess1, 1) --todo check against description
  343. turtle.drop()
  344. chest.pushItem("up", drone2, 1) --todo check against description
  345. turtle.drop()
  346. return true
  347. end
  348. return false
  349. end
  350.  
  351. local function findExtraBee(type, msg)
  352. local counts = {}
  353. local bestcount = 0
  354. local bestspecies = nil
  355.  
  356. for i, stack in pairs(stacks) do
  357. if string.find(stack.name, type) then
  358. if counts[stack.beeInfo.displayName] then
  359. counts[stack.beeInfo.displayName] = counts[stack.beeInfo.displayName] + 1
  360. else
  361. counts[stack.beeInfo.displayName] = 1
  362. end
  363. if counts[stack.beeInfo.displayName] > bestcount then
  364. bestcount = counts[stack.beeInfo.displayName]
  365. bestspecies = stack.beeInfo.displayName
  366. end
  367. end
  368. end
  369. if bestcount < 2 then
  370. shutdownMsg = "Need more " .. type .. "s!";
  371. else
  372. print(msg .. " Extra " .. bestspecies .. " " .. type)
  373. end
  374. return bestspecies, bestcount
  375. end
  376.  
  377. local function purebreed(species)
  378. local princessCount = 0
  379. local droneCount = 0
  380. for i, stack in pairs(stacks) do
  381. if stack.beeInfo.displayName == species then
  382. if string.find(stack.name, "Princess") then
  383. princessCount = princessCount + stack.qty
  384. end
  385. if string.find(stack.name, "Drone") then
  386. droneCount = droneCount + stack.qty
  387. end
  388. end
  389. end
  390.  
  391. if princessCount >= 1 and droneCount >= minDrones then
  392. return true
  393. end
  394.  
  395. print("Attempting to purebreed " .. species)
  396.  
  397. if princessCount >= 1 and droneCount >= 1 then
  398. breedSpecies(species, species)
  399. return false
  400. end
  401.  
  402. local parent1, offspring, score
  403. if(princessCount >= 1) then
  404. parent1, offspring, score = findAvailableParent(species, 0, "Drone")
  405. if score == 99999 then
  406. parent1, score = findExtraBee("Drone", "Used")
  407. else
  408. if bees[parent1].mutateFrom[1] then
  409. if not purebreed(parent1) then
  410. return false
  411. end
  412. end
  413. end
  414. else
  415. parent1, offspring, score = findAvailableParent(species, 0, "Princess")
  416. if score == 99999 then
  417. parent1, score = findExtraBee("Princess", "Used")
  418. else
  419. if bees[parent1].mutateFrom[1] then
  420. if not purebreed(parent1) then
  421. return false
  422. end
  423. end
  424. end
  425. end
  426. if shutdownMsg then
  427. return false
  428. end
  429.  
  430. breedSpecies(species, parent1)
  431. return false
  432. end
  433.  
  434. local function targetSpecies(species)
  435. local parent1
  436. local parent2 = nil
  437.  
  438.  
  439. local parent1, offspring, score = findAvailableParent(species, 0, nil)
  440. if score == 0 then
  441. --found species
  442. return true
  443. end
  444. if score == 99999 then
  445. shutdownMsg = "No available parents for " .. species
  446. return false
  447. end
  448.  
  449. print("Targeting Species " .. offspring)
  450.  
  451. local princess1, drone1 = findSpecies(parent1)
  452. local princess2, drone2
  453.  
  454. for i, parents in ipairs(bees[offspring].mutateFrom) do
  455. if parents[1] == parent1 then
  456. princess2, drone2 = findSpecies(parents[2])
  457. if (princess1 and drone2) or (princess2 and drone1) then
  458. parent2 = parents[2]
  459. break
  460. end
  461. if not parent2 then
  462. parent2 = parents[2]
  463. end
  464. if princess2 or drone2 then
  465. parent2 = parents[2]
  466. end
  467. end
  468. if parents[2] == parent1 then
  469. princess2, drone2 = findSpecies(parents[1])
  470. if (princess1 and drone2) or (princess2 and drone1) then
  471. parent2 = parents[1]
  472. break
  473. end
  474. if not parent2 then
  475. parent2 = parents[1]
  476. end
  477. if princess2 or drone2 then
  478. parent2 = parents[1]
  479. end
  480. end
  481.  
  482. end
  483.  
  484. princess2, drone2 = findSpecies(parent2)
  485.  
  486. if (princess1 and drone2) or (princess2 and drone1) then
  487. if bees[parent1].mutateFrom[1] then
  488. if not purebreed(parent1) then
  489. return false
  490. end
  491. end
  492. if bees[parent2].mutateFrom[1] then
  493. if not purebreed(parent2) then
  494. return false
  495. end
  496. end
  497. breedSpecies(parent1, parent2)
  498. return false
  499. end
  500.  
  501. if princess2 or drone2 then
  502. purebreed(parent2)
  503. return false
  504. end
  505.  
  506. targetSpecies(parent2)
  507. return false
  508. end
  509.  
  510. local function dropExtraDrones()
  511.  
  512. local species, count = findExtraBee("Drone", "Dropping")
  513. shutdownMsg = nil
  514.  
  515. if count <= maxDrones then
  516. return
  517. end
  518.  
  519. for i, stack in pairs(stacks) do
  520. if stack.beeInfo.displayName == species and string.find(stack.name, "Drone") then
  521. chest.pushItem("up", i, 1)
  522. turtle.dropUp()
  523. count = count - 1
  524. if count <= maxDrones then
  525. return
  526. end
  527. end
  528. end
  529.  
  530. end
  531.  
  532.  
  533. local function main(species)
  534.  
  535. for slot = 1, 16 do
  536. if turtle.getItemCount(slot) > 0 then
  537. turtle.select(slot)
  538. turtle.dropDown()
  539. end
  540. end
  541. turtle.select(1)
  542.  
  543. local apiarystacks
  544.  
  545. while(1) do
  546.  
  547. --test for breeding in progress
  548. apiarystacks = apiary.getAllStacks()
  549. while apiarystacks[1] do
  550. sleep(1)
  551. while(turtle.suck()) do
  552. turtle.dropDown()
  553. end
  554.  
  555. apiarystacks = apiary.getAllStacks()
  556. end
  557.  
  558. --clear apiary
  559. while(turtle.suck()) do
  560. turtle.dropDown()
  561. end
  562.  
  563. stacks = chest.getAllStacks()
  564.  
  565. if targetSpecies(species) then
  566. if purebreed(species) then
  567. shutdownMsg = "Breeding complete: " .. species
  568. end
  569. end
  570.  
  571. if(shutdownMsg) then
  572. print(shutdownMsg)
  573. break
  574. end
  575.  
  576. dropExtraDrones()
  577.  
  578. sleep(1)
  579. end
  580. end
  581.  
  582. local species = ...
  583. if species == nil then
  584. print("Usage")
  585. print(" programname species")
  586. return
  587. end
  588. if bees[species] == nil then
  589. print("Species does not exist in database")
  590. end
  591.  
  592. main(species)
Advertisement
Add Comment
Please, Sign In to add comment