Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function drop()
- for x=1, 16 do
- if turtle.getItemCount(x) > 0 then
- turtle.select(x)
- turtle.drop()
- end
- end
- turtle.select(1)
- end
- drop()
- chestSide = "left"
- spawnerSide = "top"
- modemSide = "right"
- monitorID = 112
- m = peripheral.wrap(modemSide)
- rednet.open(modemSide)
- tArgs = { ... }
- if #tArgs == 1 then
- if tArgs[1] == "On" then
- rs.setOutput("top", true)
- elseif tArgs[1] == "Off" then
- rs.setOutput("top", false)
- end
- end
- function main()
- id, msg, distance = nil, nil, nil
- id, msg, distance = rednet.receive()
- if id == monitorID then
- if msg == "Empty" then
- turtle.suckUp()
- drop()
- rednet.send(monitorID, "Empty done")
- elseif msg == "Full" then
- turtle.suck()
- turtle.dropUp()
- rednet.send(monitorID, "Full done")
- elseif msg == "On" then
- rs.setOutput("top", false)
- redstone = "On"
- save()
- rednet.send(monitorID, "On done")
- elseif msg == "Off" then
- rs.setOutput("top", true)
- redstone = "Off"
- save()
- rednet.send(monitorID, "Off done")
- end
- end
- end
- function save() --saving position
- file = fs.open("startup", "w") --open startup in writemode
- file.write('shell.run("slave", \''..redstone..'\')')
- file.close()
- end
- while true do
- main()
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment