ID:267058
 
I have a random respawing code, and if they respawn on water I have an icon state called "inwater". I'm trying to determine how to tell what turf the object was respawned on. Can anyone help me with this?
O.loc is the turf that O is on.
In response to Garthor
Yes, but isn't that a x,y,z coordinate?
In response to DBZ Kidd
It returns the turf, not coordinates. That's why you never save an object's loc to save where it's located at, because it'd save the turf along with the object.
In response to Foomer
for(var/obj/sword/O in world)
if(O.loc==/turf/water)
O.icon_state="sinwater"

I have this code, but when it is respawned on water it dosn't do anything different.
In response to DBZ Kidd
An object is never a type, but it has a type.

O.loc != type
O.loc.type == type
In response to Foomer
Thank you.