ID:1372716
 
(See the best response by Kaiochao.)
Code:
obj/Block
icon='Iso64.dmi'
var/block
Cross(mob/M)
if(istype(M,/mob))
if(M.dir == src.block)
return 0
else
return 1
Uncross(mob/M)
if(istype(M,/mob))
if(turn(M.dir,180) == src.block)
return 0
else
return 1
N
icon_state="north";block=NORTH
E
icon_state="east";block=EAST
S
icon_state="south";block=SOUTH
W
icon_state="west";block=WEST


Problem description: Uncrossed() doesn't seem to be working as I'd expected. The goal here is to have one edge of the tile that you can not cross over. These would be laid over a fence for example, so that players can walk onto the tile containing the fence, but not walk through it.

What is actually happening?
Nothing. Say I put the obj/Block/N down, I can't cross onto that that location with a Northern direction, but I can with a Southern direction. Uncrossed() is supposed to stop me from leaving the location with a Southern direction (Opposite of the objects block variable), however it doesn't.

Edit: Now that I've looked at it some more, Uncrossed() is never called when I step off the object.
In response to Danny Roe
In my test environment, Cross() isn't being called either.
In response to Neimo
In mine, Cross() is being called, but Uncross() isn't. Odd.
Neimo wrote:
In my test environment, Cross() isn't being called either.
Odd.

I just realised I've been writing Uncrossed() here and I use Uncross() in my code, my bad. The problem still exists though, Uncrossed() is useless as you can't block the movement after they have made it.
In response to Danny Roe
Best response
Cross/Uncross is definitely what you want to be using, not Crossed/Uncrossed. It's just strange that they're not working as expected, in a bare environment. You should probably file a bug report at this point, and refer to here.