From 30e3abb042f117c2f35e592ac5161d1542b0a53d Mon Sep 17 00:00:00 2001 From: Morrow Date: Fri, 27 Oct 2023 10:17:30 -0400 Subject: [PATCH] falsey moment --- .../carbon/xenomorph/ai/movement/drone.dm | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/code/modules/mob/living/carbon/xenomorph/ai/movement/drone.dm b/code/modules/mob/living/carbon/xenomorph/ai/movement/drone.dm index 043046b01a..5682062cea 100644 --- a/code/modules/mob/living/carbon/xenomorph/ai/movement/drone.dm +++ b/code/modules/mob/living/carbon/xenomorph/ai/movement/drone.dm @@ -37,19 +37,17 @@ var/turf/current_turf = get_turf(idle_xeno) next_home_search = world.time + home_search_delay - if(!current_turf.weeds && check_turf(current_turf)) - home_turf = current_turf - else - var/shortest_distance - for(var/turf/potential_home as anything in RANGE_TURFS(home_locate_range, current_turf)) - if(!check_turf(potential_home)) - continue - if(shortest_distance && get_dist(idle_xeno, potential_home) > shortest_distance) - continue + var/shortest_distance + for(var/turf/potential_home as anything in shuffle(RANGE_TURFS(home_locate_range, current_turf))) + if(!check_turf(potential_home)) + continue - shortest_distance = get_dist(idle_xeno, potential_home) - home_turf = potential_home + if(!isnull(shortest_distance) && get_dist(idle_xeno, potential_home) > shortest_distance) + continue + + shortest_distance = get_dist(idle_xeno, potential_home) + home_turf = potential_home if(!home_turf) if(!idle_xeno.resting) @@ -93,7 +91,7 @@ var/blocked = FALSE for(var/atom/potential_blocker as anything in checked_turf) - if(potential_blocker.density || potential_blocker.can_block_movement) + if(parent != potential_blocker && (potential_blocker.density || potential_blocker.can_block_movement)) blocked = TRUE break