ID:172270
 
I am trying to make a path overlap.



For example: path goes like ----------- then one comes around and goes under it like this..

|
-----|
| |
|--


I tried using layer, but this doesn't work for me because then the mob goes under the first part... any ideas?
Majinveku wrote:
I am trying to make a path overlap.



For example: path goes like ----------- then one comes around and goes under it like this..

|
-----|
| |
|--


I tried using layer, but this doesn't work for me because then the mob goes under the first part... any ideas?

Using the layer var of the turfs is the right idea; the east-west path that passes above would have a higher layer value than the north-south path that passes below, but to make it work you also need to update the layer var of any mob that enters a path turf. This can be achieved by overriding the Entered proc of the path turf.

[EDIT: the old version didn't distinguish between mobs and objs entering the turf. Fixed now]
/atom/movable
proc/SetTurfLayer(TurfLayer)
// Do nothing

/obj
SetTurfLayer(TurfLayer)
layer = TurfLayer + (OBJ_LAYER - TURF_LAYER)

/mob
SetTurfLayer(TurfLayer)
layer = TurfLayer + (MOB_LAYER - TURF_LAYER)

/turf/path
proc/AdjustLayer(atom/movable/Obj)
Obj.SetTurfLayer(layer)
Entered(atom/movable/Obj,atom/OldLoc)
. = ..(Obj, OldLoc)
AdjustLayer(Obj)

/turf/path/northsouth
layer = 2

/turf/path/eastwest
layer = 6

The turf where the paths cross could be entered from an east-west path turf or a north-south path turf, but it only has one layer var; this should be equal to the upper (east-west) path's layer so that a mob with a layer set by the east-west path will pass above, but a mob with a layer set by the north-south path will pass below. The AdjustLayer proc of the crossover turf should do nothing.
/turf/path/crossover
layer = 6
AdjustLayer(atom/movable/Obj)
// Do nothing