diff --git a/code/datums/ai/generic/find_and_set.dm b/code/datums/ai/generic/find_and_set.dm index 8ecc6df7cfb..f54ba33e6e3 100644 --- a/code/datums/ai/generic/find_and_set.dm +++ b/code/datums/ai/generic/find_and_set.dm @@ -68,12 +68,8 @@ /datum/ai_behavior/find_and_set/in_list /datum/ai_behavior/find_and_set/in_list/search_tactic(datum/ai_controller/controller, locate_paths, search_range) - var/list/found = list() - for(var/locate_path in locate_paths) - var/single_locate = ..(controller, locate_path, search_range) - if(single_locate) - found += single_locate - if(found.len) + var/list/found = typecache_filter_list(oview(search_range, controller.pawn), locate_paths) + if(length(found)) return pick(found) /** diff --git a/code/modules/mob/living/basic/farm_animals/cow/_cow.dm b/code/modules/mob/living/basic/farm_animals/cow/_cow.dm index bcd0084adb0..e5d49aa867b 100644 --- a/code/modules/mob/living/basic/farm_animals/cow/_cow.dm +++ b/code/modules/mob/living/basic/farm_animals/cow/_cow.dm @@ -45,7 +45,7 @@ udder_component() setup_eating() . = ..() - ai_controller.set_blackboard_key(BB_BASIC_FOODS, food_types) + ai_controller.set_blackboard_key(BB_BASIC_FOODS, typecacheof(food_types)) ///wrapper for the udder component addition so you can have uniquely uddered cow subtypes /mob/living/basic/cow/proc/udder_component() diff --git a/code/modules/mob/living/basic/farm_animals/deer.dm b/code/modules/mob/living/basic/farm_animals/deer.dm index 7f2fbb68fe1..5b88593f0c6 100644 --- a/code/modules/mob/living/basic/farm_animals/deer.dm +++ b/code/modules/mob/living/basic/farm_animals/deer.dm @@ -30,7 +30,7 @@ var/time_to_freeze_for = (rand(5, 10) SECONDS) ai_controller.set_blackboard_key(BB_STATIONARY_SECONDS, time_to_freeze_for) ai_controller.set_blackboard_key(BB_STATIONARY_COOLDOWN, (time_to_freeze_for * (rand(3, 5)))) - ai_controller.set_blackboard_key(BB_STATIONARY_TARGETS, stationary_scary_things) + ai_controller.set_blackboard_key(BB_STATIONARY_TARGETS, typecacheof(stationary_scary_things)) /datum/ai_controller/basic_controller/deer blackboard = list( diff --git a/code/modules/mob/living/basic/farm_animals/goat/_goat.dm b/code/modules/mob/living/basic/farm_animals/goat/_goat.dm index db49ae8df9f..7588d96ba6e 100644 --- a/code/modules/mob/living/basic/farm_animals/goat/_goat.dm +++ b/code/modules/mob/living/basic/farm_animals/goat/_goat.dm @@ -56,7 +56,7 @@ RegisterSignal(src, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(on_attacked)) RegisterSignal(src, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(on_move)) - ai_controller.set_blackboard_key(BB_BASIC_FOODS, edibles) + ai_controller.set_blackboard_key(BB_BASIC_FOODS, typecacheof(edibles)) /// Called when we attack something in order to piece together the intent of the AI/user and provide desired behavior. The element might be okay here but I'd rather the fluff. /// Goats are really good at beating up plants by taking bites out of them, but we use the default attack for everything else diff --git a/code/modules/mob/living/basic/farm_animals/gorilla/gorilla.dm b/code/modules/mob/living/basic/farm_animals/gorilla/gorilla.dm index 6cd6e5f2027..39bc6f87cd6 100644 --- a/code/modules/mob/living/basic/farm_animals/gorilla/gorilla.dm +++ b/code/modules/mob/living/basic/farm_animals/gorilla/gorilla.dm @@ -65,7 +65,7 @@ ) AddComponent(/datum/component/personal_crafting) AddComponent(/datum/component/basic_inhands, y_offset = -1) - ai_controller?.set_blackboard_key(BB_BASIC_FOODS, gorilla_food) + ai_controller?.set_blackboard_key(BB_BASIC_FOODS, typecacheof(gorilla_food)) /mob/living/basic/gorilla/update_overlays() . = ..() diff --git a/code/modules/mob/living/basic/lavaland/goliath/goliath.dm b/code/modules/mob/living/basic/lavaland/goliath/goliath.dm index f8064c32569..6d197d8853a 100644 --- a/code/modules/mob/living/basic/lavaland/goliath/goliath.dm +++ b/code/modules/mob/living/basic/lavaland/goliath/goliath.dm @@ -87,7 +87,7 @@ tentacles_ready() RegisterSignal(src, COMSIG_MOB_ABILITY_FINISHED, PROC_REF(used_ability)) - ai_controller.set_blackboard_key(BB_BASIC_FOODS, goliath_foods) + ai_controller.set_blackboard_key(BB_BASIC_FOODS, typecacheof(goliath_foods)) ai_controller.set_blackboard_key(BB_GOLIATH_TENTACLES, tentacles) /mob/living/basic/mining/goliath/examine(mob/user) diff --git a/code/modules/mob/living/basic/ruin_defender/skeleton.dm b/code/modules/mob/living/basic/ruin_defender/skeleton.dm index 3ca9211451e..17262f6495d 100644 --- a/code/modules/mob/living/basic/ruin_defender/skeleton.dm +++ b/code/modules/mob/living/basic/ruin_defender/skeleton.dm @@ -51,7 +51,8 @@ AddElement(/datum/element/basic_eating, heal_amt = 50, drinking = TRUE, food_types = good_drinks) AddElement(/datum/element/basic_eating, heal_amt = 0, damage_amount = 25, damage_type = BURN, drinking = TRUE, food_types = bad_drinks) ADD_TRAIT(src, TRAIT_SNOWSTORM_IMMUNE, INNATE_TRAIT) - ai_controller?.set_blackboard_key(BB_BASIC_FOODS, good_drinks + bad_drinks) + var/list/foods_list = good_drinks + bad_drinks + ai_controller?.set_blackboard_key(BB_BASIC_FOODS, typecacheof(foods_list)) /mob/living/basic/skeleton/settler name = "undead settler" diff --git a/code/modules/mob/living/basic/space_fauna/carp/carp.dm b/code/modules/mob/living/basic/space_fauna/carp/carp.dm index 53199375359..ebb6f1d23f7 100644 --- a/code/modules/mob/living/basic/space_fauna/carp/carp.dm +++ b/code/modules/mob/living/basic/space_fauna/carp/carp.dm @@ -109,7 +109,8 @@ /mob/living/basic/carp/proc/setup_eating() AddElement(/datum/element/basic_eating, food_types = desired_food) AddElement(/datum/element/basic_eating, heal_amt = 0, damage_amount = 10, damage_type = BRUTE, food_types = desired_trash) // We are killing our planet - ai_controller.set_blackboard_key(BB_BASIC_FOODS, desired_food + desired_trash) + var/list/foods_list = desired_food + desired_trash + ai_controller.set_blackboard_key(BB_BASIC_FOODS, typecacheof(foods_list)) /// Set a random colour on the carp, override to do something else /mob/living/basic/carp/proc/apply_colour() diff --git a/code/modules/mob/living/basic/space_fauna/snake/snake.dm b/code/modules/mob/living/basic/space_fauna/snake/snake.dm index 135402a5b44..7a30d713a4d 100644 --- a/code/modules/mob/living/basic/space_fauna/snake/snake.dm +++ b/code/modules/mob/living/basic/space_fauna/snake/snake.dm @@ -50,7 +50,7 @@ AddElement(/datum/element/swabable, CELL_LINE_TABLE_SNAKE, CELL_VIRUS_TABLE_GENERIC_MOB, 1, 5) AddElement(/datum/element/basic_eating, heal_amt = 2, food_types = edibles) - ai_controller.set_blackboard_key(BB_BASIC_FOODS, edibles) + ai_controller.set_blackboard_key(BB_BASIC_FOODS, typecacheof(edibles)) AddComponent(\ /datum/component/tameable,\ diff --git a/code/modules/mob/living/basic/vermin/lizard.dm b/code/modules/mob/living/basic/vermin/lizard.dm index 760dfecc28f..da68087d70f 100644 --- a/code/modules/mob/living/basic/vermin/lizard.dm +++ b/code/modules/mob/living/basic/vermin/lizard.dm @@ -51,7 +51,7 @@ ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT) AddElement(/datum/element/pet_bonus, "sticks its tongue out contentedly!") AddElement(/datum/element/basic_eating, heal_amt = 5, food_types = edibles) - ai_controller.set_blackboard_key(BB_BASIC_FOODS, edibles) + ai_controller.set_blackboard_key(BB_BASIC_FOODS, typecacheof(edibles)) /datum/ai_controller/basic_controller/lizard blackboard = list(