From ebc8ac7dc25049ec286f58cbacdb543344d23536 Mon Sep 17 00:00:00 2001 From: Profakos Date: Mon, 6 Nov 2023 15:34:00 +0100 Subject: [PATCH] [No GBP] Traders use Pick() to select their first customer (#79455) ## About The Pull Request In my trader PR, I made `/datum/ai_behavior/find_and_set/conscious_person` return the first person the trader found, since all they had to know was that they found someone. However, I realized that I made the jumpscare subtype actually move towards the target, meaning they would always move to the first target they found in their vision range. This PR makes them use Pick(). ## Why It's Good For The Game Its good if an AI randomly picks from a search list instead of returning the first one. ## Changelog Nothing player facing --- code/datums/ai/generic/find_and_set.dm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/datums/ai/generic/find_and_set.dm b/code/datums/ai/generic/find_and_set.dm index 6107b1664ee..8ecc6df7cfb 100644 --- a/code/datums/ai/generic/find_and_set.dm +++ b/code/datums/ai/generic/find_and_set.dm @@ -142,7 +142,13 @@ /datum/ai_behavior/find_and_set/conscious_person /datum/ai_behavior/find_and_set/conscious_person/search_tactic(datum/ai_controller/controller, locate_path, search_range) + var/list/customers = list() for(var/mob/living/carbon/human/target in oview(search_range, controller.pawn)) if(IS_DEAD_OR_INCAP(target) || !target.mind) continue - return target + customers += target + + if(customers.len) + return pick(customers) + + return null