Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local original_invoke=component.invoke
- component.invoke=function(address, method, ...)
- if component.type(address)=="navigation" and method=="getPosition" then
- local x,y,z=original_invoke(address, method, ...)
- if not x then
- local wp = original_invoke(address,"findWaypoints",... or 400)[1]
- if wp then
- local nums=wp.label:gmatch("%-?%d+")
- x=nums()
- y=nums()
- z=nums()
- return x+wp.position[1]+0.5,y+wp.position[2]+0.5,z+wp.position[3]+0.5
- else
- return nil,"out of range","waypoints not found"
- end
- else
- return x,y,z
- end
- else
- return original_invoke(address, method, ...)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement