diff --git a/code/modules/mob/living/basic/vermin/mothroach/mothroach_ai.dm b/code/modules/mob/living/basic/vermin/mothroach/mothroach_ai.dm index 5ef330cdc64..5801d183215 100644 --- a/code/modules/mob/living/basic/vermin/mothroach/mothroach_ai.dm +++ b/code/modules/mob/living/basic/vermin/mothroach/mothroach_ai.dm @@ -27,9 +27,21 @@ SIGNAL_HANDLER set_blackboard_key(BB_MOTHROACH_NEXT_EAT, world.time + MOTHROACH_EAT_TIMER) +/datum/ai_planning_subtree/find_food/mothroach + finding_behavior = /datum/ai_behavior/find_and_set/in_list/mothroach_food + /datum/ai_planning_subtree/find_food/mothroach/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick) if(world.time < controller.blackboard[BB_MOTHROACH_NEXT_EAT]) return return ..() +/datum/ai_behavior/find_and_set/in_list/mothroach_food + +/datum/ai_behavior/find_and_set/in_list/mothroach_food/search_tactic(datum/ai_controller/controller, locate_paths, search_range) + var/list/found = typecache_filter_list(oview(search_range, controller.pawn), locate_paths) + var/mob/living/living_pawn = controller.pawn + found -= living_pawn.loc + if(length(found)) + return pick(found) + #undef MOTHROACH_EAT_TIMER