Fixes some runtimes with bots. (#26201)

This commit is contained in:
ShiftyRail
2020-04-14 19:29:29 +02:00
committed by GitHub
parent 7c9d1f27ce
commit 9c776718c4
4 changed files with 14 additions and 5 deletions

View File

@@ -99,7 +99,8 @@ length to avoid portals or something i guess?? Not that they're counted right no
//replace the passed element at it's right position using the cmp proc
/PriorityQueue/proc/ReSort(var/atom/A)
var/i = Seek(A)
ASSERT(i != 0)
if (i == 0)
CRASH("[src] was seeking [A] but could not find it.")
while(i < L.len && call(cmp)(L[i],L[i+1]) > 0)
L.Swap(i,i+1)
i++

View File

@@ -180,7 +180,11 @@
frustration = 0
return TRUE
if(frustration > 5)
if (target && !target.gcDestroyed)
calc_path(target, .proc/get_path, next)
else
target = null
path = list()
return
/obj/machinery/bot/to_bump(var/M) //Leave no man un-phased through!
@@ -298,7 +302,11 @@
frustration = 0
return TRUE
if(frustration > 5)
if (target && !target.gcDestroyed)
calc_path(target, .proc/get_path, next)
else
target = null
patrol_path = list()
// send a radio signal with a single data key/value pair
/obj/machinery/bot/proc/post_signal(var/freq, var/key, var/value)

View File

@@ -31,7 +31,7 @@ var/list/pitbulls_exclude_kinlist = list() //all pitbulls go in here so pitbulls
if(locs.len >= 3) //we found 3 locations and thats all we need
break
var/turf/T = get_step(user, direction) //getting a loc in that direction
if(AStar(user.loc, T, /turf/proc/AdjacentTurfs, /turf/proc/Distance, 1)) // if a path exists, so no dense objects in the way its valid salid
if(quick_AStar(get_turf(user), T, /turf/proc/AdjacentTurfs, /turf/proc/Distance, 1)) // if a path exists, so no dense objects in the way its valid salid
locs += T
if(locs.len < 3) //if we only found one location, spawn more on top of our tile so we dont get stacked pitbulls