diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 0f051e08f72..9671769aaef 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1234,21 +1234,12 @@ proc/get_mob_with_client_list() else return zone -/proc/get_turf(const/atom/O) - if (isnull(O) || isarea(O)) - return - - var/atom/A = O - - for (var/i = 0, ++i <= 20) - if (isturf(A)) - return A - - switch (istype(A)) - if (1) - A = A.loc - if (0) - return +/proc/get_turf(turf/location) + while(location) + if(isturf(location)) + return location + location = location.loc + return null /proc/get(atom/loc, type) while(loc) @@ -1630,4 +1621,4 @@ atom/proc/GetTypeInAllContents(typepath) processed |= A - return found + return found \ No newline at end of file