Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("right");
- Data = {
- [2] = "PowerPlant",
- [3] = "Factory",
- [4] = "mtFluff",
- [5] = "SacredTree"
- }
- function returnPickedUpBook()
- for i, v in ipairs(Data) do
- local count = turtle.getItemCount(i);
- if (count == 0) then
- turtle.select(1);
- turtle.transferTo(i);
- break;
- end
- end
- end
- while true do
- local sender, msg = rednet.receive();
- local id = tonumber(msg);
- if (id) then
- local pickedUpBook = turtle.suck();
- if (pickedUpBook) then
- returnPickedUpBook();
- end
- if (Data[id]) then
- turtle.select(id);
- turtle.drop();
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement