ID:141821
 
Code: its only suppose to teleport me up when i enter it from NORTH NORTHEAST NORTHWEST
turf
Array
icon = 'Turf.dmi'
icon_state = "A"
density = 0
opacity = 0
Enter()
if(usr.Meditate >= 1)
flick("AO",src)
return 1
else
return 0
Entered(mob/M)
if(istype(M,/mob))
if(M.dir == NORTH || NORTHEAST|| NORTHWEST)
M.loc = locate(M.x,M.y+1,M.z)

Exit()
return 1


Problem description: It always teleports me one square above the turf even if i try to enter it from another dirrection

Small note: When coming from NORTH/NORTHEAST/NORTHWEST M.dir is SOUTH/SOUTHWEST/SOUTHEAST
if(M.dir == NORTH || NORTHEAST|| NORTHWEST)


NORTHEAST and NORTHWEST are true; therefore, the if() statement continues regardless of direction. You need to keep saying M.dir == NORTHEAST || M.dir == NORTHWEST etc.

However, bitwise math would be better for this!

if(M.dir&NORTH) //if they have north in their direction