From 2ef48f07a921ae65ad45955fe912967dfd53b2a7 Mon Sep 17 00:00:00 2001 From: Kano <89972582+kano-dot@users.noreply.github.com> Date: Wed, 19 Aug 2026 18:08:28 +0000 Subject: [PATCH] Tweaks turf add overlay logic (#23071) ## About PR Makes it so when a turf calls the overlay subsystem (if overlay layer was left as default) it'll add overlays slightly above the turf layer. With this we'll no longer have the silly issue where turf smoothing overlays appear under the adjacent turfs depending on turf load order In short, here's what it fixes Before: Screenshot_10 After: Screenshot_9 --- to-do: - [x] Figure out whether to change `is_plating()` check method or add the missing `initial_flooring` for every exoplanet turf type since this plays a role in deciding decal layer, suffer as both paths are equally agonizing --- code/controllers/subsystems/overlays.dm | 26 ++++++++++++++----- code/game/turfs/flooring/flooring_.dm | 23 +++++++++------- code/modules/mining/mine_turfs.dm | 4 ++- .../overmap/exoplanets/decor/_turfs.dm | 3 +++ .../overmap/exoplanets/decor/turfs/plating.dm | 3 +++ .../overmap/exoplanets/decor/turfs/snow.dm | 4 ++- .../overmap/exoplanets/decor/turfs/water.dm | 6 ++++- html/changelogs/kano-overlay-insanity.yml | 4 +++ 8 files changed, 55 insertions(+), 18 deletions(-) create mode 100644 html/changelogs/kano-overlay-insanity.yml diff --git a/code/controllers/subsystems/overlays.dm b/code/controllers/subsystems/overlays.dm index 4e914160727..12a6ddde1ef 100644 --- a/code/controllers/subsystems/overlays.dm +++ b/code/controllers/subsystems/overlays.dm @@ -98,25 +98,40 @@ SUBSYSTEM_DEF(overlays) var/list/result = list() var/icon/icon = subject.icon var/atom/entry + var/overlay_appearance for (var/i = 1 to length(sources)) entry = sources[i] if (!entry) continue else if (istext(entry)) - result += GetStateAppearance(icon, entry) + overlay_appearance = GetStateAppearance(icon, entry) else if (isicon(entry)) - result += GetIconAppearance(entry) + overlay_appearance = GetIconAppearance(entry) else if (istype(entry, /mutable_appearance)) - result += entry + overlay_appearance = entry else if (isloc(entry)) if (entry.atom_flags & ATOM_AWAITING_OVERLAY_UPDATE) entry.UpdateOverlays() if (!ispath(entry)) - result += entry.appearance + overlay_appearance = entry.appearance else var/image/image = entry - result += image.appearance + overlay_appearance = image.appearance + + // If the caller is a turf, we put the overlay's layer slightly above it. + // So this way overlays extending over to neighbouring turfs don't appear under them depending on load order. + // We only apply this if source hasn't explictly provided a layer (think the FLOAT_LAYER as a default layer for overlays). + // For more info see overlays doc. in byond ref. + var/turf/T = subject + if(istype(T)) + var/mutable_appearance/turf_overlay = new() + turf_overlay.appearance = overlay_appearance + if(turf_overlay.layer == FLOAT_LAYER) + turf_overlay.layer = T.is_plating() ? ABOVE_PLATING_LAYER : TURF_DETAIL_LAYER + overlay_appearance = turf_overlay.appearance + + result += overlay_appearance return result @@ -306,4 +321,3 @@ SUBSYSTEM_DEF(overlays) overlays |= other.atom_protected_overlay_cache if (cache_target & ATOM_ICON_CACHE_NORMAL) overlays |= other.atom_overlay_cache - diff --git a/code/game/turfs/flooring/flooring_.dm b/code/game/turfs/flooring/flooring_.dm index 4dec45426b1..2245b12e25d 100644 --- a/code/game/turfs/flooring/flooring_.dm +++ b/code/game/turfs/flooring/flooring_.dm @@ -15,18 +15,21 @@ var/icon_base var/color - var/has_base_range // basically if you want your turf to have variants, e.g. snow and grass. this number sets upper bound, starts at 0. + /// Basically if you want your turf to have variants, e.g. snow and grass. this number sets upper bound, starts at 0. + var/has_base_range var/has_damage_range = 7 - var/has_damage_state // if you've got unique damage sprites, hard-baked, not overlays. if you use overlays use the range system. + /// If you've got unique damage sprites, hard-baked, not overlays. if you use overlays use the range system. + var/has_damage_state var/has_burn_range = 4 - var/has_burn_state // same as damage state for burn. + /// Ssame as damage state for burn. + var/has_burn_state var/damage_uses_color = FALSE // see wood. var/damage_temperature var/apply_thermal_conductivity var/apply_heat_capacity - ///The type of floor that can make this, if it's not set (`null`), this flooring is unbuildable - var/obj/item/stack/build_type // Unbuildable if not set. Must be /obj/item/stack. + /// The type of floor that can make this, if it's not set (`null`), this flooring is unbuildable. + var/obj/item/stack/build_type var/build_cost = 1 // Stack units. var/build_time = 0 // BYOND ticks. @@ -38,14 +41,16 @@ //How we smooth with other flooring var/decal_layer = DECAL_LAYER var/floor_smooth = SMOOTH_ALL - var/list/flooring_whitelist = list() //Smooth with nothing except the contents of this list - var/list/flooring_blacklist = list() //Smooth with everything except the contents of this list + /// Smooth with nothing except the contents of this list. + var/list/flooring_whitelist = list() + /// Smooth with everything except the contents of this list. + var/list/flooring_blacklist = list() - //How we smooth with walls + /// How we smooth with walls. var/wall_smooth = SMOOTH_ALL //There are no lists for walls at this time - //How we smooth with space and openspace tiles + /// How we smooth with space and openspace tiles. var/space_smooth = SMOOTH_ALL //There are no lists for spaces diff --git a/code/modules/mining/mine_turfs.dm b/code/modules/mining/mine_turfs.dm index 29588ca6db2..fb20fab2073 100644 --- a/code/modules/mining/mine_turfs.dm +++ b/code/modules/mining/mine_turfs.dm @@ -768,8 +768,10 @@ GLOBAL_LIST_INIT(mineral_can_smooth_with, list( GLOBAL_LIST_INIT(asteroid_floor_smooth, list( /turf/simulated/floor/exoplanet/asteroid/ash, + /turf/simulated/wall, + /turf/unsimulated/wall, /turf/simulated/mineral, - /turf/simulated/wall + /turf/unsimulated/mineral )) // Copypaste parent for performance. diff --git a/code/modules/overmap/exoplanets/decor/_turfs.dm b/code/modules/overmap/exoplanets/decor/_turfs.dm index b557916377a..d0def05c904 100644 --- a/code/modules/overmap/exoplanets/decor/_turfs.dm +++ b/code/modules/overmap/exoplanets/decor/_turfs.dm @@ -91,6 +91,9 @@ if(away_site.exoplanet_lightlevel && is_outside()) set_light(MINIMUM_USEFUL_LIGHT_RANGE, away_site.exoplanet_lightlevel, away_site.exoplanet_lightcolor) +/turf/simulated/floor/exoplanet/is_plating() + return FALSE + /turf/simulated/floor/exoplanet/update_icon(var/update_neighbors) if(initial_flooring) . = ..() diff --git a/code/modules/overmap/exoplanets/decor/turfs/plating.dm b/code/modules/overmap/exoplanets/decor/turfs/plating.dm index 4f1bc3f2b9f..62edf28222b 100644 --- a/code/modules/overmap/exoplanets/decor/turfs/plating.dm +++ b/code/modules/overmap/exoplanets/decor/turfs/plating.dm @@ -5,6 +5,9 @@ footstep_sound = SFX_FOOTSTEP_PLATING has_resources = FALSE +/turf/simulated/floor/exoplanet/plating/is_plating() + return TRUE + /turf/simulated/floor/exoplanet/plating/asteroid icon_state = "asteroidplating" diff --git a/code/modules/overmap/exoplanets/decor/turfs/snow.dm b/code/modules/overmap/exoplanets/decor/turfs/snow.dm index ab54a39892e..175d3f93e84 100644 --- a/code/modules/overmap/exoplanets/decor/turfs/snow.dm +++ b/code/modules/overmap/exoplanets/decor/turfs/snow.dm @@ -11,7 +11,9 @@ canSmoothWith = list( /turf/simulated/floor/exoplanet/snow, /turf/simulated/wall, - /turf/unsimulated/wall + /turf/unsimulated/wall, + /turf/simulated/mineral, + /turf/unsimulated/mineral ) //Smooths with walls but not the inverse. This way to avoid layering over walls. /turf/simulated/floor/exoplanet/snow/Initialize() diff --git a/code/modules/overmap/exoplanets/decor/turfs/water.dm b/code/modules/overmap/exoplanets/decor/turfs/water.dm index e2cff88ff21..eb427ea4c78 100644 --- a/code/modules/overmap/exoplanets/decor/turfs/water.dm +++ b/code/modules/overmap/exoplanets/decor/turfs/water.dm @@ -144,7 +144,11 @@ /turf/simulated/floor/exoplanet/water/shallow/konyang/beach icon = 'icons/turf/flooring/exoplanet/konyang/konyang_beach.dmi' smoothing_flags = SMOOTH_MORE | SMOOTH_BORDER | SMOOTH_NO_CLEAR_ICON - canSmoothWith = list(/turf/simulated/floor/exoplanet/water/shallow/konyang, /turf/simulated/floor/exoplanet/water/konyang, /turf/simulated/floor/exoplanet/water/shallow/konyang/beach) + canSmoothWith = list( + /turf/simulated/floor/exoplanet/water/shallow/konyang, + /turf/simulated/floor/exoplanet/water/konyang, + /turf/simulated/floor/exoplanet/water/shallow/konyang/beach + ) /turf/simulated/floor/exoplanet/water/shallow/sewage//What horror. name = "putrid sewage" diff --git a/html/changelogs/kano-overlay-insanity.yml b/html/changelogs/kano-overlay-insanity.yml new file mode 100644 index 00000000000..fa84bb5c941 --- /dev/null +++ b/html/changelogs/kano-overlay-insanity.yml @@ -0,0 +1,4 @@ +author: kano +delete-after: True +changes: + - bugfix: "Fixed the smooth icon overlays appearing under the adjacent turfs."