Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --program for host to receive graph and turtle position
- --generates graph_image.nft file and displays it on connected monitor
- function draw_image(image)
- monitor = peripheral.find("monitor")
- if not monitor then
- print("Unable to find monitor")
- return false
- end
- term.redirect(monitor)
- end
- --look for monitor peripheral.
- --open rednet
- peripheral.find("modem", rednet.open)
- --host on protocol "MINER_GRAPH" as hostname "monitor"
- rednet.host("MINER_GRAPH", "monitor")
- while true do
- local id, message, protocol = rednet.receive("MINER_GRAPH", 1)
- if id then
- local graph = message.graph
- local x = message.x
- local y = message.y
- local z = message.z
- local image = generate_graph_image(graph, y)
- end
- end
- --unhost on protocol "MINER_GRAPH"
- rednet.unhost("MINER_GRAPH")
- --close rednet
- peripheral.find("modem", rednet.close)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement