Very handy snippet, but I have a few comments. I hope you won't take offense at my tampering!
> atom/movable/Move(nLoc, nDir)
if(nDir) |
The nDir may not correspond to the direction of movement. For instance some movement systems allow you to strafe sideways and backwards or move completely independently of your facing. Most of my projects use the Dir argument to keep the mob facing the correct direction when they teleport to far off turfs.
I would check if nLoc and loc are turfs at the beginning, then see if they are at a distance of 1 before proceeding with the border check. If so, nDir should be set to get_dir(loc, nLoc).
You don't really need to split the component directions out of the original. You want to see if the turf's border completely occludes the direction of movement. You can just check
if((T.borders & nDir) == nDir) |
The full proc with my changes:
turf/var/borders = 0
atom/movable/Move(nLoc)
if(isturf(loc) && isturf(nLoc) && get_dist(loc, nLoc) == 1)
var/nDir = get_dir(loc, nLoc)
var/turf/T = loc
if((T.borders & nDir) == nDir)
return FALSE
T = nLoc
nDir = turn(nDir,180)
if((T.borders & nDir) == nDir)
return FALSE
. = ..()
turf/limited_exit/borders = EAST|NORTH|WEST
|
|
|