Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local currslot = 1
- local princess = 0
- local bestDrone = 0
- local data=""
- local countBees = 0
- local beeTable = {}
- local currScore = 0
- s = peripheral.wrap("right")
- function clearVars()
- currslot = 1
- princess = 0
- bestDrone = 0
- data = ""
- countBees = 0
- currScore = 0
- end
- function regTable()
- -- beeTable["Heroic"] = 32
- -- beeTable["Industrious"] = 31
- -- beeTable["Imperial"] = 30
- -- beeTable["Valiant"] = 21
- -- beeTable["Unweary"] = 21
- -- beeTable["Majestic"] = 20
- -- beeTable["Steadfast"] = 11
- -- beeTable["Ancient"] = 35
- -- beeTable["Prehistoric"] = 30
- -- beeTable["Primeval"] = 25
- beeTable["Ancient"] = 20
- beeTable["Diligent"] = 11
- beeTable["Noble"] = 10
- beeTable["Cultivated"] = 6
- beeTable["Common"] = 5
- beeTable["Forest"] = 1
- beeTable["Meadows"] = 1
- end
- function getBees()
- turtle.select(1)
- for i = 1,6 do
- if turtle.suck() then countBees = countBees + 1 end
- end
- end
- function returnBees()
- turtle.turnRight()
- turtle.turnRight()
- turtle.select(princess)
- s.dropSneaky(1,1)
- turtle.select(bestDrone)
- s.dropSneaky(0,1)
- end
- function ditchCombs()
- turtle.turnLeft()
- m = peripheral.wrap("front")
- for i = 1,8 do
- turtle.suck()
- while (not m.isBee()) and (turtle.getItemCount(i) > 0) do
- turtle.select(i)
- turtle.drop()
- if not m.isBee() then
- print("Gotta ditch the combs!")
- turtle.suck()
- turtle.dropDown()
- turtle.select(countBees)
- turtle.transferTo(i, 1)
- countBees = countBees - 1
- else
- turtle.suck()
- while turtle.getItemCount(i) > 1 do
- countBees = countBees + 1
- turtle.transferTo(countBees, 1)
- end
- turtle.drop()
- end
- end
- end
- turtle.turnRight()
- end
- function scanBees()
- turtle.turnLeft()
- turtle.turnLeft()
- for i = 1, countBees do
- turtle.select(i)
- turtle.drop()
- end
- print("Waiting on Analyzer for bees...")
- sleep(26)
- end
- function determineBest(slot)
- if beeTable[data["speciesPrimary"]] == nil then
- score = 0
- else
- score = beeTable[data["speciesPrimary"]]
- end
- if beeTable[data["speciesSecondary"]] == nil then
- score = score + 0
- else
- score = score + beeTable[data["speciesSecondary"]]
- end
- print("Current: "..currScore)
- print("NewScore: "..score)
- if(bestDrone == 0) then
- bestDrone = slot
- currScore = score
- else
- if (score > currScore) then
- bestDrone = slot
- currScore = score
- end
- end
- end
- function analyzeBees()
- for i = 1, countBees do
- turtle.select(i)
- s.suckSneaky(0,1)
- turtle.turnRight()
- turtle.drop()
- m = peripheral.wrap("front")
- data = m.analyze()
- if (data["type"] == "princess") then
- princess = i
- print("Princess = "..i)
- else
- determineBest(i)
- end
- print(data["speciesPrimary"]..":"..data["speciesSecondary"])
- print("BestDrone = "..bestDrone)
- turtle.suck()
- turtle.turnLeft()
- if i ~= countBees then sleep(26) end
- end
- end
- function dropExcess()
- for i = 1, 6 do
- turtle.select(i)
- turtle.dropDown()
- end
- end
- ------=============================
- beeTable = {}
- clearVars()
- regTable()
- while true do
- getBees()
- ditchCombs()
- if (turtle.getItemCount(1) > 0) then
- scanBees()
- analyzeBees()
- returnBees()
- dropExcess()
- clearVars()
- end
- print("Waiting on bees...")
- sleep(60)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement