mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 12:07:27 +01:00
Bot port from /tg/
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user