diff --git a/code/game/atom/atom_color.dm b/code/game/atom/atom_color.dm index 3c01429efc4..95790b51aa1 100644 --- a/code/game/atom/atom_color.dm +++ b/code/game/atom/atom_color.dm @@ -123,4 +123,17 @@ overlay.color = color if (!cached_color_filter) return overlay - return filter_appearance_recursive(overlay, cached_color_filter) + // Apply the atom's color filter to the overlay using named filters so that + // later calls to add_filter/update_filters (e.g., height displacement filters) + // do not wipe out our coloration. Mirror prior behavior by propagating to + // child overlays unless KEEP_TOGETHER is present. + overlay.add_filter(ATOM_PRIORITY_COLOR_FILTER, ATOM_PRIORITY_COLOR_FILTER_PRIORITY, cached_color_filter) + + if(!(overlay.appearance_flags & KEEP_TOGETHER)) + // Recursively ensure any nested overlays/underlays also get the color filter + for(var/mutable_appearance/child_overlay as anything in overlay.overlays) + color_atom_overlay(child_overlay) + for(var/mutable_appearance/child_underlay as anything in overlay.underlays) + color_atom_overlay(child_underlay) + + return overlay