From 4148bc92b664cc8ba0bafcebbea4bb491193556d Mon Sep 17 00:00:00 2001 From: Bloop <13398309+vinylspiders@users.noreply.github.com> Date: Thu, 10 Apr 2025 00:36:28 -0400 Subject: [PATCH] Fixes the flipped table spawners (#90518) ## About The Pull Request They weren't actually working turns out. There was a race condition with icon smoothing, so it needs to be flipped after the table gets smoothed. On top of that the dir wasn't being passed properly. ## Why It's Good For The Game Stuff that actually works! This will allow for things like this on mapload: ![image](https://github.com/user-attachments/assets/372297d7-2a30-4d85-8e89-91d14fd584d7) ## Changelog :cl: fix: fixes flipped table spawners not initializing correctly /:cl: --- code/game/objects/effects/spawners/structure.dm | 11 ++++++++--- code/game/objects/structures/tables_racks.dm | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/code/game/objects/effects/spawners/structure.dm b/code/game/objects/effects/spawners/structure.dm index 7f462ff2480..6dd8729cf97 100644 --- a/code/game/objects/effects/spawners/structure.dm +++ b/code/game/objects/effects/spawners/structure.dm @@ -386,7 +386,12 @@ again. /obj/effect/spawner/structure/flipped_table/Initialize(mapload) . = ..() - var/obj/structure/table/table_to_flipped = new table_to_spawn(loc) - table_to_flipped.dir = dir - table_to_flipped.flip_table() + var/obj/structure/table/table_to_flip = new table_to_spawn(loc) + table_to_flip.dir = dir + RegisterSignal(table_to_flip, COMSIG_ATOM_SMOOTHED_ICON, PROC_REF(on_icon_smoothed)) +/// The flip_table() proc HAS to be run after smooth_icon() is completed or else we will get runtimes. +/obj/effect/spawner/structure/flipped_table/proc/on_icon_smoothed(obj/structure/table/table_to_flip) + SIGNAL_HANDLER + table_to_flip.flip_table(table_to_flip.dir) + UnregisterSignal(table_to_flip, COMSIG_ATOM_SMOOTHED_ICON) diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index b438e42c49f..63f93867c41 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -78,7 +78,7 @@ ADD_TRAIT(src, TRAIT_COMBAT_MODE_SKIP_INTERACTION, INNATE_TRAIT) if(can_flip && is_flipped) - flip_table() + flip_table(dir) return make_climbable() @@ -121,7 +121,7 @@ is_flipped = FALSE //proc that removes elements present in now-flipped tables -/obj/structure/table/proc/flip_table(new_dir) +/obj/structure/table/proc/flip_table(new_dir = SOUTH) playsound(src, 'sound/items/trayhit/trayhit1.ogg', 100) RemoveElement(/datum/element/climbable) RemoveElement(/datum/element/footstep_override, priority = STEP_SOUND_TABLE_PRIORITY)