ml_pathfind
ml_pathfind copied to clipboard
Pathfind Module for MTA:SA-Server
Pathfind Server Module for MTA:SA
Developing
- Download and install the EditorConfig plugin for Visual Studio: https://github.com/editorconfig/editorconfig-visualstudio#readme
- Launch
premake.bat
- Open
Build/Pathfind.sln
Installing
- Put the resulting
Bin/ml_gps.dll/.so
into your MTA:SA servermodules
folder. - Add
<module src="ml_gps.dll"/>
(or.so
for Linux) to yourmtaserver.conf
. - Start the server
API
Function: loadPathGraph
int loadPathGraph(string path)
- path: The path to the graph definition file (relative to the resource directory)
Returns graphId if everything went fine, false otherwise.
Function: unloadPathGraph
bool unloadPathGraph(int graphId)
- graphId: The id of the graph
Returns true if the graph has been unloaded, false otherwise.
Function: findShortestPathBetween
bool findShortestPathBetween(int graphId, float startX, float startY, float startZ, float endX, float endY, float endZ, function callback)
- graphId: The id of the graph
- startX, startY, startZ: The start position
- endX, endY, endZ: The end position
-
callback: The callback function (parameters:
table nodes
)
Returns true if the route calculation has been scheduled successfully, false otherwise.
Function: isGraphLoaded
bool isGraphLoaded(int graphId)
- graphId: The id of the graph
Returns true if the graph is already loaded, false otherwise.
Function: findNodeAt
int, float, float, float findNodeAt(int graphId, float positionX, float positionY, float positionZ)
- graphId: The id of the graph
- positionX, positionY, positionZ: The postion where to search for a node
Returns 4 integers representing nodeId and his position if a node was found, false otherwise.
Function: getNodeNeighbors
table getNodeNeighbors(int graphId, int nodeId, int depth)
- graphId: The id of the graph
- nodeId: The id of the start node
- depth: The depth of the node neighbors
Returns a table with all neighbors of the node, false otherwise.
Contributors
- Justus H.
- Stefan K.