Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- state = {
- lastMessage = nil,
- target = 4 -- change this to your monitor computer's id
- }
- util = {
- send = function(msg, force)
- if msg ~= nil and state.lastMessage ~= msg or force then
- print("Sending message: "..msg)
- rednet.send(state.target, msg)
- state.lastMessage = msg
- end
- end,
- sendSerialized = function(msg, force)
- if msg ~= nil then
- util.send(textutils.serialize(msg), force)
- end
- end,
- hasItems = function()
- for i = 1, 16 do
- if turtle.getItemCount(i) > 0 then
- return true
- end
- end
- return false
- end,
- dropItems = function()
- for i = 1, 16 do
- if turtle.getItemCount(i) > 0 then
- turtle.select(i)
- turtle.dropDown()
- sleep(.5)
- end
- end
- turtle.select(1)
- end
- }
- local scanner = peripheral.wrap("right")
- rednet.open("right")
- while true do
- -- print("Checking aspects")
- local aspects = scanner.getAspectsDown()
- if next(aspects) == nil then
- util.send("none")
- else
- util.sendSerialized(aspects)
- end
- if util.hasItems() then
- print("Dropping items in to crucible.")
- util.dropItems()
- end
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement