diff --git a/build_circle.lua b/build_circle.lua index bfceba1..b304e98 100644 --- a/build_circle.lua +++ b/build_circle.lua @@ -49,6 +49,7 @@ file:close() local inverted = false robot.select(1) +local inventorySize = robot.inventorySize() -- build: nav.forward(radius) @@ -65,7 +66,18 @@ for _, ring in ipairs(rings) do for _ = 1, n do robot.placeDown() if robot.count() == 0 then - robot.select(robot.select() + 1) -- select the next item slot + local current_slot = robot.select() + if current_slot == inventorySize then + print('Waiting for more materials') + local _ = io.read() + robot.select(1) + else + robot.select(current_slot + 1) -- select the next item slot + if robot.count() == 0 then + print('Waiting for more materials') + local _ = io.read() + end + end end nav.forward() end diff --git a/rings b/rings index 4637312..bf972db 100644 --- a/rings +++ b/rings @@ -4,3 +4,4 @@ 822221111X11122227 83322211X1222337 83322211X11222337 +833222111X11222337