var/stepsToTake = rand(1,50)
for(var/i = 0, i <= stepsToTake, i++)
if(src.Interrupted == 1)
goto INTERRUPTED
else
step_rand(M)
for(var/turf/Water/W in world)
if(M.loc == W.loc)
world << "OH GOD DROWNING!"
sleep(8)
I'm not getting the output "OH GOD DROWNING!" when the mob enters the water. I'm wondering why not. Thank you!
The loc of a mob (or any movable atom) on the map (as in, not inside another movable atom) is always a turf; the turf that it's standing on... such as a water turf.
If you're not using pixel movement, one simple way to check if you're standing in water is this:
Otherwise (if you are using pixel movement), you may be standing on multiple turfs at a time, so you could check like this:
It's a huge waste of resources to potentially search through every water turf to check if it's equal to the turf that you already have a reference to (loc), when you could just use the reference itself.