Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getRoute(x1,y1,z1,x2,y2,z2,dir)
- id = 1234
- request = textutils.serialize({ beginx = x1, eindx = x2, beginy = y1, eindy = y2, beginz = z1, eindz = z2, facing = dir })
- tabel = { type = "routeRequest", id = id, request = request }
- table.insert(tabel,request)
- modem.transmit(7000,7001,textutils.serialize(tabel))
- modem.open(7001)
- correct = false
- route = nil
- while not correct do
- event = { os.pullEvent("modem_message") }
- data = textutils.unserialize(event[5])
- if data.type == "routeAnswer" and data.id == id then
- route = data.route
- correct = true
- end
- end
- return route
- end
- function reportObstacle(x,y,z)
- info = { x = x, y = y, z = z }
- tabel = { type = "addObstacle", info = info }
- modem.transmit(7000,7001,textutils.serialize(tabel))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement