Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local computerID = 1
- local mobs = {}
- local chest = peripheral.wrap("bottom")
- rednet.open("right")
- function loadMobs()
- turtle.suckUp()
- turtle.dropDown()
- for i,p in pairs(chest.getAllStacks()) do
- mobs[p["name"]] = i
- end
- end
- function printMobs()
- for i,p in pairs(mobs) do
- print("Mob "..i.." is in Slot "..p)
- end
- end
- function waitRednet()
- senderID, msg = rednet.receive()
- if senderID == computerID then
- if msg == "getMobs" then
- rednet.send(senderID, textutils.serialize(mobs))
- elseif msg == "on" then
- rs.setOutput("top", false)
- elseif msg == "off" then
- rs.setOutput("top", true)
- else
- insertMob(msg)
- end
- end
- end
- function insertMob(mobName)
- turtle.suckUp()
- turtle.dropDown()
- chest.pushItem("up", mobs[mobName], 1)
- turtle.dropUp()
- end
- loadMobs()
- printMobs()
- while true do waitRednet() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement