diff --git a/code/__DEFINES/layers.dm b/code/__DEFINES/layers.dm index fd6369f9d72..a32e2907d83 100644 --- a/code/__DEFINES/layers.dm +++ b/code/__DEFINES/layers.dm @@ -159,6 +159,9 @@ // NOTICE: we break from the pattern of increasing in steps of like 0.01 here // Because TOPDOWN_LAYER is 10000 and that's enough to floating point our modifications away +/// Used to shift all topdown layer emissives to a the game plane equivalent layers, as otherwise they render above everything else due to being KEEP_APART +#define TOPDOWN_TO_EMISSIVE_LAYER(layer) LERP(FLOOR_EMISSIVE_START_LAYER, FLOOR_EMISSIVE_END_LAYER, (layer - (TOPDOWN_LAYER + 1)) / TOPDOWN_LAYER_COUNT) + // Must be equal to the offset of the highest topdown layer #define TOPDOWN_LAYER_COUNT 18 diff --git a/code/__HELPERS/lighting.dm b/code/__HELPERS/lighting.dm index 086b0e99c4a..4f1b29d436a 100644 --- a/code/__HELPERS/lighting.dm +++ b/code/__HELPERS/lighting.dm @@ -1,5 +1,3 @@ -#define TOPDOWN_TO_EMISSIVE_LAYER(layer) LERP(FLOOR_EMISSIVE_START_LAYER, FLOOR_EMISSIVE_END_LAYER, (layer - (TOPDOWN_LAYER + 1)) / TOPDOWN_LAYER_COUNT) - /// Produces a mutable appearance glued to the [EMISSIVE_PLANE] dyed to be the [EMISSIVE_COLOR]. /proc/emissive_appearance(icon, icon_state = "", atom/offset_spokesman, layer, alpha = 255, appearance_flags = NONE, offset_const, effect_type = EMISSIVE_BLOOM) if((isnull(layer) || layer == FLOAT_LAYER) && IS_TOPDOWN_PLANE(offset_spokesman.plane)) @@ -99,5 +97,3 @@ var/atom/movable/vis_cast = make_blocker vis_cast.vis_contents += hand_back return hand_back - -#undef TOPDOWN_TO_EMISSIVE_LAYER diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 420b8118c2a..d14d97018ab 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -174,6 +174,8 @@ blocker.dir = dir blocker.appearance_flags = appearance_flags | EMISSIVE_APPEARANCE_FLAGS blocker.plane = GET_NEW_PLANE(EMISSIVE_PLANE, PLANE_TO_OFFSET(plane)) // Takes a light path through the normal macro for a microop + if (IS_TOPDOWN_PLANE(plane)) + blocker.layer = TOPDOWN_TO_EMISSIVE_LAYER(layer) // Ok so this is really cursed, but I want to set with this blocker cheaply while // Still allowing it to be removed from the overlays list later // So I'm gonna flatten it, then insert the flattened overlay into overlays AND the managed overlays list, directly