View difference between Paste ID: FTpHdzkc and zJnbiq2z
SHOW: | | - or go back to the newest paste.
1-
-- turtle facing north
1+
local interfaceDir = "down"
2-
local beeDir = {{"front","south"}, {"right","west"}, {"back","north"}, {"left","east"}}
2+
local beeDir = {"front", "right", "back", "left"}
3
local bee = {}
4-
local princess = "top"
4+
5-
local drone = "bottom"
5+
6-
local generation = {0,0,0,0}
6+
  bee[i] = peripheral.wrap(beeDir[i])
7
end
8
9-
  bee[i] = {peripheral.wrap(beeDir[i][1]),beeDir[i][2]}
9+
-- pull princess and drone from interface
10
local function fillApiary(apiary)
11
  local result = 0
12-
-- (limited) turtle inventory clean up
12+
  -- princess in slot 1 in apiary and interface
13-
local function checkAndMoveBak(i)
13+
  result = apiary.pullItemIntoSlot(interfaceDir, 1, 1, 1)
14-
  local result = true
14+
  if result==0 then result=apiary.pullItemIntoSlot(interfaceDir,3,1,1) end
15-
  local destination = 16
15+
16-
  if turtle.getItemCount(i) > 0 then
16+
  result = result * apiary.pullItemIntoSlot(interfaceDir, 2, 1, 2)
17-
    print("Attempting clean up in slot " .. i)
17+
18-
    result = false
18+
19-
    turtle.select(i)
19+
20-
    while not turtle.transferTo(destination) do
20+
21-
      destination = destination - 1
21+
22-
      -- print(destination)
22+
23-
      if destination <= 2 then break end
23+
24
--end
25-
    if destination <= 2 then result = false else result = true end
25+
26
local function getApiaryProducts(apiary)
27
  local result = 0
28
  for i=3,9 do
29
    result = result + apiary.pushItem(interfaceDir,i,64)
30-
-- (limited) turtle inventory clean up / push stuff into apiaries
30+
31-
--local function checkAndMove(i,apiary)
31+
32-
--  local result = true
32+
33-
--  if turtle.getItemCount(i) > 0 then
33+
34-
--    print("Attempting clean up in slot " .. i)
34+
35-
--    result = false
35+
36-
--    apiary[1].pullItemIntoSlot(apiary[2], 1, 1, 1)
36+
37
  for i=1,4 do
38
    --check apiaries
39-
local function checkInv(i)
39+
    if not bee[i].getQueen() then
40-
  local result = true
40+
      print(getApiaryProducts(bee[i]))
41-
  if turtle.getItemCount(i) > 0 then
41+
      fill = fillApiary(bee[i])
42-
    print("Bee found in slot " .. i)
42+
43-
    result = false
43+
44
  end
45
  if not fill then break end
46
  sleep(5)
47
end