ID:884801
 
(See the best response by DarkCampainger.)
Code:
area
mouse_opacity = 0
proc
set_properties()
layer = MOB_LAYER + 2

mob
// Pixel Movement
bound_x = 8
bound_y = 0
bound_height = 16
bound_width = 16
step_size = 4
layer = 3

obj
layer = 3
turf
layer = 1


Problem description:

Hey everyone, this is like my.. what.. 3rd topic since yesterday? Learning this stuff takes a lot of effort! Bear with me here if you all will~

The point of showing you those sections of code is so that I can display how the layers in my project are setup.

Having objs be on the same layer as mobs might seem a little weird, but here's why;

I've added a Day Cycle system to the game, which adds overlays to areas. Now, when the obj layer is below the mob, the mob shows up above the area overlays, which isn't right graphically.

Some objs I just define to have a higher layer, like this here cactus;

            Cactus
bound_x = 0
bound_y = 8
bound_width = 16
bound_height = 16
density = 1
icon = 'Cactus.dmi'
layer = MOB_LAYER + 1


The purpose being, so that when a mob walks by the cactus if it's north of it, the top tip of the cactus should overlay the mob icon.

However... Even in this case, the -Cactus- shows up above the area overlay. The area's layer is set at runtime so that I don't see it's effects in the map editor. I'm.. not sure why this is happening, the only logical explanation I have is that overlays don't necessarily inherit their owner's layer?

Help would be appreciated!

Best response
As per the reference entry for layer:
When making objects to be used as graphical overlays, you should also be aware of the special FLOAT_LAYER value. 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.

So depending on how you're adding the overlay to the area, it may not be inheriting the area's layer are you're expecting. If you're adding it by type (eg targetArea.overlays += /obj/AreaOverlay) try specifying the type's layer to be FLOAT_LAYER. Otherwise, show us how you're adding the overlay.
Aha, I see where this is going, here is the DayCycle system;

area
proc

day_cycle()
while(1)
if(Natural)
sleep(600*(Week_Speed/28))
overlays += /obj/DayOverlays/Dusk
sleep(600*(Week_Speed/56))
overlays -= /obj/DayOverlays/Dusk
overlays += /obj/DayOverlays/Night
sleep(600*(Week_Speed/56))
overlays -= /obj/DayOverlays/Night
overlays += /obj/DayOverlays/Midnight
sleep(600*(Week_Speed/56))
overlays -= /obj/DayOverlays/Midnight
overlays += /obj/DayOverlays/Night
sleep(600*(Week_Speed/56))
overlays -= /obj/DayOverlays/Night
overlays += /obj/DayOverlays/Dawn
sleep(600*(Week_Speed/84))
overlays -= /obj/DayOverlays/Dawn
overlays += /obj/DayOverlays/Early
sleep(600*(Week_Speed/84))
overlays -= /obj/DayOverlays/Early
overlays += /obj/DayOverlays/Morning
sleep(600*(Week_Speed/84))
overlays -= /obj/DayOverlays/Morning
sleep(1)


Since they're objs, they're inheriting the obj layer.

I just need to give them layer = FLOAT_LAYER, as you said.

Tested it, and it's working just fine! Thank you, DarkCampainger.
Glad you've got it working.

Can I ask, is there a reason you're using overlays at all instead of just setting the area's icon? Seems like it would be more straight-forward than adding and removing overlays.
The day cycle system isn't the only thing that will be happening as far as the area's graphics.

I also intend to eventually use a weather system, and the effects will run alongside the day system, so it will need to be able to support Midnight and Rain for example, or Dusk and Fog.

At first I was just changing the icon lol.