Fix for bots breaking if they fail to path

This commit is contained in:
Peter Wall
2013-07-26 04:08:09 +02:00
parent e716e66d10
commit 5f20459635
3 changed files with 6 additions and 3 deletions
+2 -1
View File
@@ -233,7 +233,8 @@ text("<A href='?src=\ref[src];operation=oddbutton'>[src.oddbutton ? "Yes" : "No"
if(target && path.len == 0)
spawn(0)
if(!src || !target) return
src.path = AStar(src.loc, src.target.loc, /turf/proc/AdjacentTurfs, /turf/proc/Distance, 0, 30)
src.path = AStar(src.loc, src.target.loc, /turf/proc/CardinalTurfsWithAccess, /turf/proc/Distance, 0, 30, id=botcard)
if (!path) path = list()
if(src.path.len == 0)
src.oldtarget = src.target
src.target = null
+1
View File
@@ -615,6 +615,7 @@ Auto Patrol: []"},
// given an optional turf to avoid
/obj/machinery/bot/ed209/proc/calc_path(var/turf/avoid = null)
src.path = AStar(src.loc, patrol_target, /turf/proc/CardinalTurfsWithAccess, /turf/proc/Distance, 0, 120, id=botcard, exclude=avoid)
if (!src.path) src.path = list()
// look for a criminal in view of the bot
+3 -2
View File
@@ -241,9 +241,10 @@
if(src.target && (src.target != null) && src.path.len == 0)
spawn(0)
if(!istype(src.target, /turf/))
src.path = AStar(src.loc, src.target.loc, /turf/proc/AdjacentTurfsSpace, /turf/proc/Distance, 0, 30)
src.path = AStar(src.loc, src.target.loc, /turf/proc/AdjacentTurfsSpace, /turf/proc/Distance, 0, 30, id=botcard)
else
src.path = AStar(src.loc, src.target, /turf/proc/AdjacentTurfsSpace, /turf/proc/Distance, 0, 30)
src.path = AStar(src.loc, src.target, /turf/proc/AdjacentTurfsSpace, /turf/proc/Distance, 0, 30, id=botcard)
if (!src.path) src.path = list()
if(src.path.len == 0)
src.oldtarget = src.target
src.target = null