ID:139114
 
Code:
        Currents
Up
icon_state = "cup"

WorldProc()
for(var/mob/M in src.contents)
for(var/turf/T in get_step(src, NORTH)) // Do a check on the intended new location
if(typesof(T,/turf/Map/Rocks)) // If it's a rock, don't move anything
M.Hp -- // Subtract 1 Hp
src.DActive = 1 // De-Activate the turf the player is on
else
T.DActive = 1 // De-Active the new location to be
M.loc = locate(M.x, M.y + 1, M.z) // Move the player
M.Move(M.loc) // This is so you can move the person into the turf's contents
sleep(5)


Problem description:

In order to test this code I created a map with a rock to the north of the up current.

The idea is that if the current bumps you into the rock, you lose health. Because I want to have your direction not change with the current, only your location, I can't just Move() the mob. (Moving the mob results in a direction change) I know that the check for the rock is successful. If a rock is to the north of the current, you won't be moved on top of it. However the M.Hp -- line is not working. (I also need to add DeathCheck() but that can wait until I get the Hp -- working)
get_step() already returns a /turf, so the loop won't work because a /turf cannot exist in another /turf.

So delete for() and replace "in" with =
var/turf/T = get...


And instead of
M.loc = locate(M.x, M.y + 1, M.z) // Move the player
M.Move(M.loc)
You can simply do step(M, NORTH). If you want to keep the dir the same, get M's dir prior moving (ex: var/olddir = M.dir) and set M's dir to the old value after the Move()/step()
In response to GhostAnime (#1)
Okidokes, I'll do some re-working. Just one question though. The reason I had the check for turf was because in F1 the get_step() said that it returned a location. Is turf synonymous with location? I had assumed it meant the x,y,z coords.