ID:137710
 
Code Request, have it so that u can make particular tiles be entered from only one direction example

Turf
toilet
icon = "Stinky.dmi'
icon_state = "The Jon"
EnterDir
Dir = client north

or something like that, that makes it only so that they can enter the tile from the north side of the tile.




Sariat wrote:
Code Request, have it so that u can make particular tiles be entered from only one direction example

Turf
toilet
icon = "Stinky.dmi'
icon_state = "The Jon"
EnterDir
Dir = client north

or something like that, that makes it only so that they can enter the tile from the north side of the tile.

turf
toilet
icon = 'stinky.dmi'
icon_state = "The Jon"
var/list/enterdirs

New()
enterdirs = list(NORTH) // add more dirs if you want

Enter(atom/movable/O)
var/attemptdir = get_dir(src, O)
if (src.enterdirs.Find(attemptdir))
return ..()
else
return 0
Sariat wrote:
Code Request, have it so that u can make particular tiles be entered from only one direction example

Turf
toilet
icon = "Stinky.dmi'
icon_state = "The Jon"
EnterDir
Dir = client north

or something like that, that makes it only so that they can enter the tile from the north side of the tile.





oo! i had a kewl little snippet for that i posted a long time ago. Maybe ill fix it up and make it a lib or something.
In response to Air Mapster
Air Mapster wrote:
Sariat wrote:
Code Request, have it so that u can make particular tiles be entered from only one direction example

Turf
toilet
icon = "Stinky.dmi'
icon_state = "The Jon"
EnterDir
Dir = client north

or something like that, that makes it only so that they can enter the tile from the north side of the tile.

turf
toilet
icon = 'stinky.dmi'
icon_state = "The Jon"
var
enterdirs[] = list(NORTH) // add more dirs if you want

Enter(atom/movable/O)
var/attemptdir = get_dir(src, O)
if (src.enterdirs.Find(attemptdir)
return ..()
else
return 0
Is that how it would be done? or how u already can do it?
In response to Sariat
Sariat wrote:
Is that how it would be done? or how u already can do it?

Try it. (but look at my post now, I fixed a couple of typos)
In response to Air Mapster
Air Mapster wrote:
Sariat wrote:
Is that how it would be done? or how u already can do it?

Try it. (but look at my post now, I fixed a couple of typos)

Heres the code i posted a long time ago. Its from when I basically first start byond so its not very efficiently coded.

turf
var
north_density
south_density
east_density
west_density
ne_density
nw_density
se_density
sw_density
Enter()
if(usr.dir == SOUTH)
if(src.north_density == 1) return 0
if(usr.dir == NORTH)
if(src.south_density == 1) return 0
if(usr.dir == EAST)
if(src.west_density == 1) return 0
if(usr.dir == WEST)
if(src.east_density == 1) return 0
if(usr.dir == NORTHEAST)
if(src.sw_density == 1) return 0
if(usr.dir == NORTHWEST)
if(src.se_density == 1) return 0
if(usr.dir == SOUTHEAST)
if(src.nw_density == 1) return 0
if(usr.dir == SOUTHWEST)
if(src.ne_density == 1) return 0
if(density == 1) return 0
return ..()
Exit()
if(usr.dir == SOUTH)
if(src.south_density == 1) return 0
if(usr.dir == NORTH)
if(src.north_density == 1) return 0
if(usr.dir == EAST)
if(src.east_density == 1) return 0
if(usr.dir == WEST)
if(src.west_density == 1) return 0
if(usr.dir == NORTHEAST)
if(src.ne_density == 1) return 0
if(usr.dir == NORTHWEST)
if(src.nw_density == 1) return 0
if(usr.dir == SOUTHEAST)
if(src.se_density == 1) return 0
if(usr.dir == SOUTHWEST)
if(src.sw_density == 1) return 0
return ..()


In response to Air Mapster
I would also add a get_dir check in there, in case the mob is teleporting into the bathroom from some place else (I've often wished for this ability). It wouldn't make sense if they can only teleport in if they're due north of the bathroom.

I had a very similar problem while making an elevation system.

-AbyssDragon