From 5f204596351bb75cbef62a887ccacc767fbcec16 Mon Sep 17 00:00:00 2001 From: Peter Wall Date: Fri, 26 Jul 2013 04:08:09 +0200 Subject: [PATCH] Fix for bots breaking if they fail to path --- code/game/machinery/bots/cleanbot.dm | 3 ++- code/game/machinery/bots/ed209bot.dm | 1 + code/game/machinery/bots/floorbot.dm | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/code/game/machinery/bots/cleanbot.dm b/code/game/machinery/bots/cleanbot.dm index 47b27ac54bd..d0345f60905 100644 --- a/code/game/machinery/bots/cleanbot.dm +++ b/code/game/machinery/bots/cleanbot.dm @@ -233,7 +233,8 @@ text("[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 diff --git a/code/game/machinery/bots/ed209bot.dm b/code/game/machinery/bots/ed209bot.dm index 5e5ae744068..d71a43c083e 100644 --- a/code/game/machinery/bots/ed209bot.dm +++ b/code/game/machinery/bots/ed209bot.dm @@ -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 diff --git a/code/game/machinery/bots/floorbot.dm b/code/game/machinery/bots/floorbot.dm index bb984a1787b..69fc5afd3f3 100644 --- a/code/game/machinery/bots/floorbot.dm +++ b/code/game/machinery/bots/floorbot.dm @@ -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