mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
Import TG latest AStar.
This commit is contained in:
@@ -117,7 +117,7 @@ datum/controller/lighting/proc/Recover()
|
|||||||
var/msg = "## DEBUG: [time2text(world.timeofday)] lighting_controller restarted. Reports:\n"
|
var/msg = "## DEBUG: [time2text(world.timeofday)] lighting_controller restarted. Reports:\n"
|
||||||
for(var/varname in lighting_controller.vars)
|
for(var/varname in lighting_controller.vars)
|
||||||
switch(varname)
|
switch(varname)
|
||||||
if("tag","bestF","type","parent_type","vars") continue
|
if("tag","type","parent_type","vars") continue
|
||||||
else
|
else
|
||||||
var/varval1 = lighting_controller.vars[varname]
|
var/varval1 = lighting_controller.vars[varname]
|
||||||
var/varval2 = vars[varname]
|
var/varval2 = vars[varname]
|
||||||
|
|||||||
@@ -385,7 +385,7 @@ datum/controller/game_controller/proc/Recover() //Mostly a placeholder for now.
|
|||||||
var/msg = "## DEBUG: [time2text(world.timeofday)] MC restarted. Reports:\n"
|
var/msg = "## DEBUG: [time2text(world.timeofday)] MC restarted. Reports:\n"
|
||||||
for(var/varname in master_controller.vars)
|
for(var/varname in master_controller.vars)
|
||||||
switch(varname)
|
switch(varname)
|
||||||
if("tag","bestF","type","parent_type","vars") continue
|
if("tag","type","parent_type","vars") continue
|
||||||
else
|
else
|
||||||
var/varval = master_controller.vars[varname]
|
var/varval = master_controller.vars[varname]
|
||||||
if(istype(varval,/datum))
|
if(istype(varval,/datum))
|
||||||
|
|||||||
@@ -93,12 +93,13 @@ PriorityQueue
|
|||||||
if(ind)
|
if(ind)
|
||||||
Remove(ind)
|
Remove(ind)
|
||||||
PathNode
|
PathNode
|
||||||
var/datum/source
|
var/turf/source
|
||||||
var/PathNode/prevNode
|
var/PathNode/prevNode
|
||||||
var/f
|
var/f
|
||||||
var/g
|
var/g
|
||||||
var/h
|
var/h
|
||||||
var/nt // Nodes traversed
|
var/nt // Nodes traversed
|
||||||
|
var/bestF
|
||||||
New(s,p,pg,ph,pnt)
|
New(s,p,pg,ph,pnt)
|
||||||
source = s
|
source = s
|
||||||
prevNode = p
|
prevNode = p
|
||||||
@@ -108,7 +109,7 @@ PathNode
|
|||||||
source.bestF = f
|
source.bestF = f
|
||||||
nt = pnt
|
nt = pnt
|
||||||
|
|
||||||
datum
|
turf
|
||||||
var/bestF
|
var/bestF
|
||||||
proc
|
proc
|
||||||
PathWeightCompare(PathNode/a, PathNode/b)
|
PathWeightCompare(PathNode/a, PathNode/b)
|
||||||
@@ -121,7 +122,8 @@ proc
|
|||||||
var/closed[] = new()
|
var/closed[] = new()
|
||||||
var/path[]
|
var/path[]
|
||||||
start = get_turf(start)
|
start = get_turf(start)
|
||||||
if(!start) return 0
|
if(!start)
|
||||||
|
return 0
|
||||||
|
|
||||||
open.Enqueue(new /PathNode(start,null,0,call(start,dist)(end)))
|
open.Enqueue(new /PathNode(start,null,0,call(start,dist)(end)))
|
||||||
|
|
||||||
@@ -150,7 +152,7 @@ proc
|
|||||||
if(cur.nt >= maxnodedepth)
|
if(cur.nt >= maxnodedepth)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for(var/datum/d in L)
|
for(var/turf/d in L)
|
||||||
if(d == exclude)
|
if(d == exclude)
|
||||||
continue
|
continue
|
||||||
var/ng = cur.g + call(cur.source,dist)(d)
|
var/ng = cur.g + call(cur.source,dist)(d)
|
||||||
@@ -165,10 +167,7 @@ proc
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
open.Enqueue(new /PathNode(d,cur,ng,call(d,dist)(end),cur.nt+1))
|
open.Enqueue(new /PathNode(d,cur,ng,call(d,dist)(end),cur.nt+1))
|
||||||
if(maxnodes && open.L.len > maxnodes)
|
|
||||||
open.L.Cut(open.L.len)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var/PathNode/temp
|
var/PathNode/temp
|
||||||
while(!open.IsEmpty())
|
while(!open.IsEmpty())
|
||||||
temp = open.Dequeue()
|
temp = open.Dequeue()
|
||||||
@@ -178,6 +177,8 @@ proc
|
|||||||
temp.bestF = 0
|
temp.bestF = 0
|
||||||
closed.Cut(closed.len)
|
closed.Cut(closed.len)
|
||||||
|
|
||||||
|
if(path && maxnodes && path.len > maxnodes+1)
|
||||||
|
return 0
|
||||||
if(path)
|
if(path)
|
||||||
for(var/i = 1; i <= path.len/2; i++)
|
for(var/i = 1; i <= path.len/2; i++)
|
||||||
path.Swap(i,path.len-i+1)
|
path.Swap(i,path.len-i+1)
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ var/global/mulebot_count = 0
|
|||||||
if(5,6)
|
if(5,6)
|
||||||
dat += "Calculating navigation path"
|
dat += "Calculating navigation path"
|
||||||
if(7)
|
if(7)
|
||||||
dat += "Unable to locate destination"
|
dat += "Unable to reach destination"
|
||||||
|
|
||||||
|
|
||||||
dat += "<BR>Current Load: [load ? load.name : "<i>none</i>"]<BR>"
|
dat += "<BR>Current Load: [load ? load.name : "<i>none</i>"]<BR>"
|
||||||
|
|||||||
Reference in New Issue
Block a user