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
+14 -9
View File
@@ -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
+3 -1
View File
@@ -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.
@@ -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)
. = ..()
@@ -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"
@@ -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()
@@ -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"
@@ -0,0 +1,4 @@
author: kano
delete-after: True
changes:
- bugfix: "Fixed the smooth icon overlays appearing under the adjacent turfs."