Skip to content

Commit 8627bd1

Browse files
authored
fix bots spamming get_path_to (#1126)
1 parent 4cd1be8 commit 8627bd1

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

code/modules/mob/living/simple_animal/bot/cleanbot.dm

+4-2
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@
242242
start_patrol()
243243
if(BOT_PATROL)
244244
bot_patrol()
245+
245246
else if(target)
246247
if(QDELETED(target) || !isturf(target.loc))
247248
target = null
@@ -255,12 +256,13 @@
255256
mode = BOT_IDLE
256257
return
257258

258-
if(target && path.len == 0 && (get_dist(src,target) > 1))
259-
path = jps_path_to(src, target, max_distance=30, mintargetdist=1, access = access_card?.GetAccess())
259+
if(target && path.len == 0 && (get_dist(src,target) > 1) && mode != BOT_MOVING)
260260
mode = BOT_MOVING
261+
path = jps_path_to(src, target, max_distance=30, mintargetdist=1, access = access_card?.GetAccess())
261262
if(length(path) == 0)
262263
add_to_ignore(target)
263264
target = null
265+
mode = BOT_IDLE
264266

265267
if(path.len > 0 && target)
266268
if(!bot_move(path[path.len]))

code/modules/mob/living/simple_animal/bot/firebot.dm

+2-3
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,9 @@
226226
soft_reset()
227227
return
228228

229-
if(target_fire && (get_dist(src, target_fire) > 2))
230-
231-
path = jps_path_to(src, target_fire, max_distance=30, mintargetdist=1, access = access_card?.GetAccess())
229+
if(target_fire && (get_dist(src, target_fire) > 2) && mode != BOT_MOVING)
232230
mode = BOT_MOVING
231+
path = jps_path_to(src, target_fire, max_distance=30, mintargetdist=1, access = access_card?.GetAccess())
233232
if(!path.len)
234233
soft_reset()
235234

code/modules/mob/living/simple_animal/bot/medbot.dm

+2-2
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,9 @@
375375
soft_reset()
376376
return
377377

378-
if(patient && path.len == 0 && (get_dist(src,patient) > 1))
379-
path = jps_path_to(src, patient, max_distance=30, access = access_card?.GetAccess())
378+
if(patient && path.len == 0 && (get_dist(src,patient) > 1) && mode != BOT_MOVING)
380379
mode = BOT_MOVING
380+
path = jps_path_to(src, patient, max_distance=30, access = access_card?.GetAccess())
381381
if(!path.len) //try to get closer if you can't reach the patient directly
382382
path = jps_path_to(src, patient, max_distance=30, mintargetdist=1, access = access_card?.GetAccess())
383383
if(!path.len) //Do not chase a patient we cannot reach.

0 commit comments

Comments
 (0)