ID:170281
 
turf
Tree1
icon = 'Turfs1.dmi'
Three
icon_state = "T13"
layer = MOB_LAYER+10
Exit(mob/M)
if(M.dir==SOUTH||M.dir==SOUTHWEST||M.dir==SOUTHEAST)
return 0
else
return 1
Enter(mob/M)
if(M.dir==NORTH||M.dir==NORTHWEST||M.dir==NORTHEAST)
return 0
else
return 1


This exit and enter is obeyed by everything! Objects included! Why is this? It should only be obeyed by mobs ("Enter(mob/M)") so why are all my objects obeying it too? This is causing a bit of aggrivation for my missile system!

~Ease~
ismob() - look it up in the ref

-Angel
This exit and enter is obeyed by everything! Objects included! Why is this? It should only be obeyed by mobs ("Enter(mob/M)") so why are all my objects obeying it too? This is causing a bit of aggrivation for my missile system!

The type you use for the parameters is only for compile time syntax checking. Anything can be passed in and for Enter/Exit procs I think they can recieve any atom/movable datum as well as all their children. If you only want that code to apply to mobs you need to preform the check yourself to make sure you have a mob.
Regarding the direction check, I'd only like to add that you can save a lot of work simply by using if(M.dir&SOUTH) and if(M.dir&NORTH). Since BYOND dirs are implemented as bit flags, all of those directions (and no others) have that flag in common.

Lummox JR