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)