From e3b5a1b378a77f00e4f2da56949d67e56232e1fc Mon Sep 17 00:00:00 2001 From: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Date: Fri, 21 Nov 2025 02:34:00 +0100 Subject: [PATCH] Fixes blood emissives rendering below disposals pipes and other floor objects (#94024) ## About The Pull Request So KEEP_APART with a set plane has a fun behavior where topdown objects still keep their topdown layer, which causes FLOAT_LAYER emissives on floor objects to render above everything else. This includes emissive blockers, and I have missed static blockers in my original PR so here they are. Fixes this. image ## Changelog :cl: fix: Fixed blood emissives rendering below disposals pipes and other floor objects /:cl: --- code/__DEFINES/layers.dm | 3 +++ code/__HELPERS/lighting.dm | 4 ---- code/game/atoms_movable.dm | 2 ++ 3 files changed, 5 insertions(+), 4 deletions(-) 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