ID:1339785
 
(See the best response by LordAndrew.)
Code:
//Kaiochao's code for layering
atom
var/standing = FALSE
var/tile_height

proc
Update_Layer(var/atom/A)
if(standing)
layer = MOB_LAYER - (A.tile_height * (A.y - 1) + A:bound_y + A:step_y) / (A.tile_height * world.maxy)



mob
standing = TRUE
tile_height = 32
Move()
. = ..()
. && standing && Update_Layer(src)


Problem description:
So I've been using this snippet of code, provided by Kaiochao. It basically ensures that atoms at lower y's populate at a higher layer than those at higher y's. This is because of some slight overlapping with bound boxes of standing objects. I'm probably describing this terribly, but essentially it allows a player to walk behind a tree from the north, rather than on top of it.

So the problem I'm having is now I'm getting to the part where I'm adding overlays to my projects, such as hair and clothing. Because of this layering system, the mob constantly appears at a higher layer than it's overlays which defeats the purpose. So what do I need to do to have the overlays populate one layer higher constantly?

Best response
You'd want to make use of the special FLOAT_LAYER setting for the clothing/hair's layer. From the reference:
This causes the overlay (or underlay) to be in the same drawing layer as the base object, no matter how that layer changes after the addition of the overlay. Otherwise, the overlay object's own drawing layer is used.
Thank you. I'll look into it. ^^