Hiranus icon

BeeBreeder

Hiranus | PRO | 07/19/15 10:15:42 AM UTC | 0 ⭐ | 512 👁️ | Never ⏰ | []
Lua |

1.13 KB

|

None

|

0 👍

/

0 👎

local chest = peripheral.wrap("tileskychest_0")
local apiary = peripheral.wrap("right")
local pattern = peripheral.wrap("left")
local species = nil
function IsApiaryDone()
    if apiary.getAllStacks()[1] == nil then
        return true
    else
        return false
    end
end
function Split(inputstr, sep)
        if sep == nil then
                sep = "%s"
        end
        local t={} ; i=1
        for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
                t[i] = str
                i = i + 1
        end
        return t
end
function GetSpecies ()
    bee = pattern.getAllStacks()
    if bee[1] == nil then
        printError("No species bee")
        error()
    end
    species = Split(bee[1].basic().display_name," ")[1]
end
 
function findWrongPrincess ()
    bee = chest.getAllStacks()
    for k,v in pairs(bee) do
        if v.basic().id == "Forestry:beePrincessGE" then
            if species ~= Split(v.basic().display_name," ")[1] then
                chest.pushItem("west",k)
                return
            end
        end
    end
    printError("No princess to work with")
    error()
end
 
GetSpecies()
while true do
    sleep(1)
    if (IsApiaryDone()) then
        findWrongPrincess ()
    end
end

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎