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:

<img width="396" height="601" alt="Screenshot_10"
src="https://github.com/user-attachments/assets/91708402-c6c6-433f-af9f-5293ce926731"
/>

After:

<img width="391" height="598" alt="Screenshot_9"
src="https://github.com/user-attachments/assets/556d48dd-d463-4f76-b075-f0d77340e837"
/>

---

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
This commit is contained in:
Kano
2026-08-19 18:08:28 +00:00
committed by GitHub
parent 85ec63da94
commit 2ef48f07a9
8 changed files with 55 additions and 18 deletions
+20 -6
View File
@@ -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