From 44f8a60b70eccd6798b7b6258c561659b8fcb027 Mon Sep 17 00:00:00 2001 From: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com> Date: Tue, 2 Jul 2024 21:58:55 -0400 Subject: [PATCH] Ports bad catwalk layering fix (#11146) * undertile refactor * ah, so thats the issue --- code/controllers/subsystem/minor_mapping.dm | 2 +- code/datums/components/plumbing/_plumbing.dm | 4 ++- code/datums/elements/undertile.dm | 34 +++++++++++++------ .../objects/items/devices/pressureplates.dm | 6 ++-- code/game/turfs/open/floor/catwalk_plating.dm | 8 ++--- code/game/turfs/turf.dm | 2 +- .../machinery/components/components_base.dm | 5 +-- 7 files changed, 38 insertions(+), 23 deletions(-) diff --git a/code/controllers/subsystem/minor_mapping.dm b/code/controllers/subsystem/minor_mapping.dm index 9c0dac8d2ab9d..58d1bc58e58d1 100644 --- a/code/controllers/subsystem/minor_mapping.dm +++ b/code/controllers/subsystem/minor_mapping.dm @@ -31,7 +31,7 @@ SUBSYSTEM_DEF(minor_mapping) var/turf/T = pick_n_take(turfs) var/obj/item/storage/backpack/satchel/flat/F = new(T) - SEND_SIGNAL(F, COMSIG_OBJ_HIDE, T.underfloor_accessibility < UNDERFLOOR_VISIBLE) + SEND_SIGNAL(F, COMSIG_OBJ_HIDE, T.underfloor_accessibility) amount-- /proc/find_exposed_wires() diff --git a/code/datums/components/plumbing/_plumbing.dm b/code/datums/components/plumbing/_plumbing.dm index c5cf5f6156cb7..56b65ffabc58c 100644 --- a/code/datums/components/plumbing/_plumbing.dm +++ b/code/datums/components/plumbing/_plumbing.dm @@ -234,9 +234,11 @@ net.add_plumber(src, dir) net.add_plumber(P, opposite_dir) -/datum/component/plumbing/proc/hide(atom/movable/AM, should_hide) +/datum/component/plumbing/proc/hide(atom/movable/AM, underfloor_accessibility) SIGNAL_HANDLER + var/should_hide = !underfloor_accessibility + tile_covered = should_hide AM.update_appearance() diff --git a/code/datums/elements/undertile.dm b/code/datums/elements/undertile.dm index 24c3d246fe70f..4812116b5bc12 100644 --- a/code/datums/elements/undertile.dm +++ b/code/datums/elements/undertile.dm @@ -19,6 +19,7 @@ /datum/element/undertile/Attach(datum/target, invisibility_trait, invisibility_level = INVISIBILITY_MAXIMUM, tile_overlay, use_alpha = TRUE, use_anchor = FALSE) . = ..() + if(!ismovable(target)) return ELEMENT_INCOMPATIBLE @@ -35,42 +36,55 @@ src.use_alpha = use_alpha src.use_anchor = use_anchor + ///called when a tile has been covered or uncovered -/datum/element/undertile/proc/hide(atom/movable/source, covered) +/datum/element/undertile/proc/hide(atom/movable/source, underfloor_accessibility) SIGNAL_HANDLER if(source.density) stack_trace("([src]): Atom [source] was given an undertile element, but has become dense! This can lead to invisible walls!") return //Returning to actually prevent this from happening - source.invisibility = covered ? invisibility_level : 0 + source.invisibility = underfloor_accessibility < UNDERFLOOR_VISIBLE ? invisibility_level : 0 var/turf/T = get_turf(source) - if(covered) - if(invisibility_trait) - ADD_TRAIT(source, invisibility_trait, ELEMENT_TRAIT(type)) + if(underfloor_accessibility < UNDERFLOOR_INTERACTABLE) + source.plane = FLOOR_PLANE // We do this so that turfs that allow you to see what's underneath them don't have to be on the game plane (which causes ambient occlusion weirdness) + if(tile_overlay) T.add_overlay(tile_overlay) - if(use_alpha) - source.alpha = ALPHA_UNDERTILE + if(use_anchor) source.set_anchored(TRUE) + if(underfloor_accessibility < UNDERFLOOR_VISIBLE) + if(use_alpha) + source.alpha = ALPHA_UNDERTILE + + if(invisibility_trait) + ADD_TRAIT(source, invisibility_trait, ELEMENT_TRAIT(type)) + else + source.plane = initial(source.plane) + if(invisibility_trait) REMOVE_TRAIT(source, invisibility_trait, ELEMENT_TRAIT(type)) + if(tile_overlay) T.overlays -= tile_overlay + if(use_alpha) - source.alpha = 255 + source.alpha = initial(source.alpha) + if(use_anchor) source.set_anchored(FALSE) -/datum/element/undertile/Detach(atom/movable/AM, visibility_trait, invisibility_level = INVISIBILITY_MAXIMUM) + +/datum/element/undertile/Detach(atom/movable/source, visibility_trait, invisibility_level = INVISIBILITY_MAXIMUM) . = ..() - hide(AM, FALSE) + hide(source, UNDERFLOOR_INTERACTABLE) #undef ALPHA_UNDERTILE diff --git a/code/game/objects/items/devices/pressureplates.dm b/code/game/objects/items/devices/pressureplates.dm index f86eccacf00b4..d8f320bcfd94c 100644 --- a/code/game/objects/items/devices/pressureplates.dm +++ b/code/game/objects/items/devices/pressureplates.dm @@ -68,5 +68,7 @@ return ..() ///Called from COMSIG_OBJ_HIDE to toggle the active part, because yeah im not making a special exception on the element to support it -/obj/item/pressure_plate/proc/ToggleActive(datum/source, covered) - active = covered +/obj/item/pressure_plate/proc/ToggleActive(datum/source, underfloor_accessibility) + SIGNAL_HANDLER + + active = underfloor_accessibility < UNDERFLOOR_VISIBLE diff --git a/code/game/turfs/open/floor/catwalk_plating.dm b/code/game/turfs/open/floor/catwalk_plating.dm index baa410381725e..6866c366ab74b 100644 --- a/code/game/turfs/open/floor/catwalk_plating.dm +++ b/code/game/turfs/open/floor/catwalk_plating.dm @@ -13,11 +13,7 @@ baseturfs = /turf/open/floor/plating floor_tile = /obj/item/stack/tile/catwalk_tile layer = CATWALK_LAYER - plane = GAME_PLANE footstep = FOOTSTEP_CATWALK - barefootstep = FOOTSTEP_CATWALK - clawfootstep = FOOTSTEP_CATWALK - heavyfootstep = FOOTSTEP_CATWALK overfloor_placed = TRUE underfloor_accessibility = UNDERFLOOR_VISIBLE var/covered = TRUE @@ -47,13 +43,13 @@ if(!covered) underfloor_accessibility = UNDERFLOOR_INTERACTABLE layer = TURF_LAYER - plane = FLOOR_PLANE icon_state = "[catwalk_type]_below" else underfloor_accessibility = UNDERFLOOR_VISIBLE layer = CATWALK_LAYER - plane = GAME_PLANE icon_state = "[catwalk_type]_above" + + levelupdate() user.balloon_alert(user, "[!covered ? "Cover removed" : "Ccover added"]") tool.play_tool_sound(src) update_appearance() diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 7f4be91b18acf..bbeab37719b8f 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -352,7 +352,7 @@ GLOBAL_LIST_EMPTY(created_baseturf_lists) /turf/proc/levelupdate() for(var/obj/O in src) if(O.flags_1 & INITIALIZED_1) - SEND_SIGNAL(O, COMSIG_OBJ_HIDE, underfloor_accessibility < UNDERFLOOR_VISIBLE) + SEND_SIGNAL(O, COMSIG_OBJ_HIDE, underfloor_accessibility) // override for space turfs, since they should never hide anything /turf/open/space/levelupdate() diff --git a/code/modules/atmospherics/machinery/components/components_base.dm b/code/modules/atmospherics/machinery/components/components_base.dm index e86ca59dfb8d4..bd98932755f10 100644 --- a/code/modules/atmospherics/machinery/components/components_base.dm +++ b/code/modules/atmospherics/machinery/components/components_base.dm @@ -36,8 +36,9 @@ /obj/machinery/atmospherics/components/proc/update_icon_nopipes() return -/obj/machinery/atmospherics/components/proc/hide_pipe(datum/source, covered) - showpipe = !covered +/obj/machinery/atmospherics/components/proc/hide_pipe(datum/source, underfloor_accessibility) + SIGNAL_HANDLER + showpipe = !!underfloor_accessibility update_icon() /obj/machinery/atmospherics/components/update_icon()