mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
get_turf optimization
Checks isturf() and then locs instead of looping
This commit is contained in:
committed by
Arokha Sieyes
parent
652e35024b
commit
dd9082f903
@@ -1039,10 +1039,9 @@ proc/get_mob_with_client_list()
|
|||||||
|
|
||||||
//gets the turf the atom is located in (or itself, if it is a turf).
|
//gets the turf the atom is located in (or itself, if it is a turf).
|
||||||
//returns null if the atom is not in a turf.
|
//returns null if the atom is not in a turf.
|
||||||
/proc/get_turf(atom/A)
|
/proc/get_turf(atom/movable/A)
|
||||||
if(!istype(A)) return
|
if(isturf(A)) return A
|
||||||
for(A, A && !isturf(A), A=A.loc);
|
if(A.locs.len) return A.locs[1]
|
||||||
return A
|
|
||||||
|
|
||||||
/proc/get(atom/loc, type)
|
/proc/get(atom/loc, type)
|
||||||
while(loc)
|
while(loc)
|
||||||
|
|||||||
Reference in New Issue
Block a user