diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 99aff268725..2a6c79b8ebc 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -527,21 +527,16 @@ // Find an obstruction free turf that's within the range of the center. Can also condition on if it is of a certain area type. /proc/find_obstruction_free_location(range, atom/center, area/specific_area) - var/list/turfs = RANGE_TURFS(range, center) var/list/possible_loc = list() - for(var/turf/found_turf in turfs) - var/area/turf_area = get_area(found_turf) - + for(var/turf/found_turf in RANGE_TURFS(range, center)) // We check if both the turf is a floor, and that it's actually in the area. // We also want a location that's clear of any obstructions. - if (specific_area) - if (!istype(turf_area, specific_area)) - continue + if (specific_area && !istype(get_area(found_turf), specific_area)) + continue - if (!isspaceturf(found_turf)) - if (!found_turf.is_blocked_turf()) - possible_loc.Add(found_turf) + if (!isgroundlessturf(found_turf) && !found_turf.is_blocked_turf()) + possible_loc.Add(found_turf) // Need at least one free location. if (possible_loc.len < 1)