moved patching to server-side

By putting the path-finding code on the server-side, it’ll be easier to
debug, and more optimizable.

Also, I’m noticing the paths being discovered are definitely not the
shortest, so could be a bug in there somewhere.