ID:1337475
 
(See the best response by Neimo.)
Code:
    door
icon = 'objects.dmi'
icon_state = "door"
var/warpZ
Entered(mob/M)
M.loc = locate(1,1,warpZ)
usr << "test"


Problem description:
I am attempting to warp any mob that enters the door on to the proper Z level. "warpZ" is defined individually as an instance on the map.
Upon entering the door, nothing happens. No user output or warping.


I have followed several resources with no luck.
Thank you!
You have to define the z level when defining the var warpZ?
If door is an obj, entering him would be putting your mob in the door's contents. You can only enter turfs by walking on them.

I use Cross(mob/m) when I want somthing like you want. Just remember to return 1 in the end(or maybe is better to use the Crossed proc).

Oh, and the Uncross proc isn't the opposite behavior I was hoping for, maybe I used wrong...
Best response
// written by the magnificent Garthor awhile ago
atom
movable
proc
//analogous to Enter()
step_on(atom/movable/A)
//always allow an object to step on itself
if(A == src) return 1
//do not allow two dense objects in the same turf
else return !(density & A.density)
//analogous to Exit()
step_off(atom/movable/A)
//always allow stepping off of something by default
return 1
//analogous to Entered()
stepped_on(atom/movable/A)
//analogous to Exited()
stepped_off(atom/movable/A)

turf
Enter(atom/movable/A)
//don't allow dense movables onto dense turfs
if((density | loc.density) & A.density) return 0
else
//check contents of this turf for something else that will block A
for(var/atom/movable/M in src)
if(M != A)
if(!M.step_on(A))
return 0

return 1
Exit(atom/movable/A)
//check for something that will prevent A exiting src
for(var/atom/movable/M in src)
if(M != A)
if(!M.step_off(A))
return 0

return 1

Entered(atom/movable/A)
//perform the default action
..()
//call SteppedOn() for everything in contents
for(var/atom/movable/M in src)
if(M != A)
M.stepped_on(A)

Exited(atom/movable/A)
..()
for(var/atom/movable/M in src)
if(M != A)
M.stepped_off(A)
In response to Neimo
That is literally what Cross() and Crossed() do, except those are built in procs and don't require overwriting anything...
Yup. Crossed did the trick.

Thanks!