From 64718206afd30060f15b009db640aaaec57243f9 Mon Sep 17 00:00:00 2001 From: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Date: Fri, 5 Sep 2025 06:05:07 +0200 Subject: [PATCH] Fixes emissive overlays on neon carpets (#92789) ## About The Pull Request Carpets were manually assigning emissive plane to a normal overlay, while using incorrect logic (adding alpha to it instead of coloring the overlay), resulting in this mess which both shows through objects and is twice as bright as it should be image I've added a separate emissive decal element subtype, as well as (just in case) banning all FLOAT_LAYER overlays from topdown planes, instead of allowing them when manually passed into the proc (topdown planes should never have floating emissives) ## Changelog :cl: fix: Fixed emissive overlays on neon carpets poking through objects /:cl: --- code/__HELPERS/lighting.dm | 10 ++++----- code/datums/elements/decals/_decal.dm | 25 ++++++++++++++++++++--- code/game/turfs/open/floor/fancy_floor.dm | 2 +- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/code/__HELPERS/lighting.dm b/code/__HELPERS/lighting.dm index 9cf4839a1ff..086b0e99c4a 100644 --- a/code/__HELPERS/lighting.dm +++ b/code/__HELPERS/lighting.dm @@ -2,11 +2,11 @@ /// 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)) - if(IS_TOPDOWN_PLANE(offset_spokesman.plane)) - layer = TOPDOWN_TO_EMISSIVE_LAYER(offset_spokesman.layer) - else - layer = FLOAT_LAYER + if((isnull(layer) || layer == FLOAT_LAYER) && IS_TOPDOWN_PLANE(offset_spokesman.plane)) + layer = TOPDOWN_TO_EMISSIVE_LAYER(offset_spokesman.layer) + else if(isnull(layer)) + layer = FLOAT_LAYER + var/mutable_appearance/appearance = mutable_appearance(icon, icon_state, layer, offset_spokesman, EMISSIVE_PLANE, 255, appearance_flags | EMISSIVE_APPEARANCE_FLAGS, offset_const) if(alpha == 255) switch(effect_type) diff --git a/code/datums/elements/decals/_decal.dm b/code/datums/elements/decals/_decal.dm index b9adaca0b41..d5616c5b5cb 100644 --- a/code/datums/elements/decals/_decal.dm +++ b/code/datums/elements/decals/_decal.dm @@ -45,6 +45,11 @@ if(directional) //Even when the dirs are the same rotation is coming out as not 0 for some reason rotation = SIMPLIFY_DEGREES(dir2angle(new_dir)-dir2angle(old_dir)) new_dir = turn(pic.dir,-rotation) + + var/pic_color = pic.color + if(islist(pic_color)) + pic_color = string_list(pic_color) + return list( "icon" = pic.icon, "icon_state" = base_icon_state, @@ -52,7 +57,7 @@ "plane" = pic.plane, "layer" = pic.layer, "alpha" = pic.alpha, - "color" = pic.color, + "color" = pic_color, "smoothing" = smoothing, "cleanable" = cleanable, "desc" = description @@ -64,6 +69,9 @@ . = ..() if(!isatom(target)) return ELEMENT_INCOMPATIBLE + // Color matrixes should be stringlisted as to avoid dupes + if (islist(_color)) + _color = string_list(_color) if(_pic) pic = _pic else if(!generate_appearance(_icon, _icon_state, _dir, _plane, _layer, _color, _alpha, _smoothing, target)) @@ -104,6 +112,11 @@ /datum/element/decal/proc/generate_appearance(_icon, _icon_state, _dir, _plane, _layer, _color, _alpha, _smoothing, source) if(!_icon || !_icon_state) return FALSE + + if(_plane == EMISSIVE_PLANE) + pic = emissive_appearance(_icon, isnull(_smoothing) ? _icon_state : "[_icon_state]-[_smoothing]", source, _layer, _alpha) + return TRUE + var/temp_image = image(_icon, null, isnull(_smoothing) ? _icon_state : "[_icon_state]-[_smoothing]", _layer, _dir) pic = new(temp_image) var/atom/atom_source = source @@ -153,7 +166,10 @@ if(new_turf == source) return Detach(source) - new_turf.AddElement(type, pic.icon, base_icon_state, directional, pic.plane, pic.layer, pic.alpha, pic.color, smoothing, cleanable, description) + var/pic_color = pic.color + if(islist(pic_color)) + pic_color = string_list(pic_color) + new_turf.AddElement(type, pic.icon, base_icon_state, directional, pic.plane, pic.layer, pic.alpha, pic_color, smoothing, cleanable, description) /datum/element/decal/proc/shuttle_rotate(datum/source, list/datum/element/decal/rotating) SIGNAL_HANDLER @@ -172,5 +188,8 @@ return NONE Detach(source) - source.AddElement(type, pic.icon, base_icon_state, directional, PLANE_TO_TRUE(pic.plane), pic.layer, pic.alpha, pic.color, smoothing_junction, cleanable, description) + var/pic_color = pic.color + if(islist(pic_color)) + pic_color = string_list(pic_color) + source.AddElement(type, pic.icon, base_icon_state, directional, PLANE_TO_TRUE(pic.plane), pic.layer, pic.alpha, pic_color, smoothing_junction, cleanable, description) return NONE diff --git a/code/game/turfs/open/floor/fancy_floor.dm b/code/game/turfs/open/floor/fancy_floor.dm index 97b5c50ecc1..eea5232aa06 100644 --- a/code/game/turfs/open/floor/fancy_floor.dm +++ b/code/game/turfs/open/floor/fancy_floor.dm @@ -508,7 +508,7 @@ /turf/open/floor/carpet/neon/Initialize(mapload) . = ..() AddElement(/datum/element/decal, neon_icon || icon, neon_icon_state || base_icon_state, dir, null, null, alpha, neon_color, smoothing_junction) - AddElement(/datum/element/decal, neon_icon || icon, neon_icon_state || base_icon_state, dir, EMISSIVE_PLANE, null, emissive_alpha, GLOB.emissive_color, smoothing_junction) + AddElement(/datum/element/decal, neon_icon || icon, neon_icon_state || base_icon_state, dir, EMISSIVE_PLANE, null, emissive_alpha, null, smoothing_junction) /turf/open/floor/carpet/neon/simple name = "simple neon carpet"