Bot port from /tg/

This commit is contained in:
Markolie
2014-12-02 17:59:40 +01:00
parent 79125ffb37
commit b21575f088
26 changed files with 2745 additions and 2882 deletions
+8 -1
View File
@@ -172,7 +172,7 @@ proc/AStar(start,end,adjacent,dist,maxnodes,maxnodedepth = 30,mintargetdist,minn
//then run the main loop
while(!open.IsEmpty() && !path)
{
//get the lower f node on the open list
//get the lower f node on the open list
cur = open.Dequeue() //get the lower f turf in the open list
closed.Add(cur.source) //and tell we've processed it
@@ -236,3 +236,10 @@ proc/AStar(start,end,adjacent,dist,maxnodes,maxnodedepth = 30,mintargetdist,minn
path.Swap(i,path.len-i+1)
return path
//wrapper that returns an empty list if A* failed to find a path
/proc/get_path_to(var/start,var/end,var/adjacent,var/dist,var/maxnodes,var/maxnodedepth = 30,var/mintargetdist,var/minnodedist,id=null, var/turf/exclude=null)
var/list/path = AStar(start, end, adjacent, dist, maxnodes, maxnodedepth, mintargetdist, minnodedist,id, exclude)
if(!path)
path = list()
return path