From c27e434dcc9d0c76ffdf400072166a1957b52dfa Mon Sep 17 00:00:00 2001 From: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Date: Wed, 7 Jan 2026 10:47:44 +0530 Subject: [PATCH] Objects mounted in shuttle areas drop again & relocates some shuttle objects (#94611) ## About The Pull Request - Fixes #94119 > This will require a different solution which someone smarter than me has to figure out in the foreseeable future Today me is now smarter than yesterday me. We basically just unmount when the object is about to shuttle moved and remount after it has been shuttle moved This also map edits some objects that could not be mounted in shuttles previously ## Changelog :cl: fix: objects mounted in shuttle areas deconstruct when their support structure is destroyed fix: fixes runtime in arrivals shuttle when its request console is destroyed map: moved around some objects in shuttles so they can be mounted on its walls again /:cl: --- _maps/shuttles/emergency_box.dmm | 16 +++----- _maps/shuttles/emergency_delta.dmm | 2 +- _maps/shuttles/emergency_nebula.dmm | 8 ++-- _maps/shuttles/emergency_tram.dmm | 2 +- .../shuttles/ruin_syndicate_fighter_shiv.dmm | 14 +++---- code/__DEFINES/is_helpers.dm | 1 + code/datums/components/atom_mounted.dm | 39 +++++++++++++------ code/game/objects/effects/posters/poster.dm | 2 +- code/game/objects/items/wall_mounted.dm | 3 +- code/game/objects/structures/signs/_signs.dm | 2 +- .../modules/power/lighting/light_construct.dm | 5 +-- .../mobile_port/shuttle_move_callbacks.dm | 4 +- .../shuttle/mobile_port/variants/arrivals.dm | 17 ++++++++ 13 files changed, 68 insertions(+), 47 deletions(-) diff --git a/_maps/shuttles/emergency_box.dmm b/_maps/shuttles/emergency_box.dmm index 60815016f83..539dd7a8fa4 100644 --- a/_maps/shuttles/emergency_box.dmm +++ b/_maps/shuttles/emergency_box.dmm @@ -79,9 +79,7 @@ /area/shuttle/escape) "as" = ( /obj/item/radio/intercom/directional/south, -/obj/machinery/camera/autoname{ - dir = 5 - }, +/obj/machinery/camera/autoname, /turf/open/floor/mineral/titanium, /area/shuttle/escape) "at" = ( @@ -251,7 +249,7 @@ "bs" = ( /obj/machinery/light/small/directional/west, /obj/machinery/camera/autoname{ - dir = 10 + dir = 8 }, /turf/open/floor/mineral/titanium/white, /area/shuttle/escape) @@ -271,21 +269,17 @@ /turf/open/floor/mineral/titanium/blue, /area/shuttle/escape) "jA" = ( -/obj/machinery/camera/autoname{ - dir = 5 - }, +/obj/machinery/camera/autoname, /turf/open/floor/mineral/titanium, /area/shuttle/escape) "oY" = ( /obj/machinery/camera/autoname{ - dir = 6 + dir = 4 }, /turf/open/floor/mineral/titanium/blue, /area/shuttle/escape) "pW" = ( -/obj/machinery/camera/autoname{ - dir = 5 - }, +/obj/machinery/camera/autoname, /turf/open/floor/mineral/plastitanium/red, /area/shuttle/escape/brig) "qJ" = ( diff --git a/_maps/shuttles/emergency_delta.dmm b/_maps/shuttles/emergency_delta.dmm index 94807e385b6..3f898d72550 100644 --- a/_maps/shuttles/emergency_delta.dmm +++ b/_maps/shuttles/emergency_delta.dmm @@ -907,7 +907,7 @@ /area/shuttle/escape) "pd" = ( /obj/machinery/camera/autoname{ - dir = 9 + dir = 1 }, /turf/open/floor/mineral/plastitanium/red, /area/shuttle/escape/brig) diff --git a/_maps/shuttles/emergency_nebula.dmm b/_maps/shuttles/emergency_nebula.dmm index 267454ee5eb..60e1852d20e 100644 --- a/_maps/shuttles/emergency_nebula.dmm +++ b/_maps/shuttles/emergency_nebula.dmm @@ -506,7 +506,7 @@ /obj/structure/chair/comfy/shuttle, /obj/machinery/status_display/evac/directional/north, /obj/machinery/camera/autoname{ - dir = 9 + dir = 1 }, /turf/open/floor/iron/dark/textured_large, /area/shuttle/escape) @@ -1249,7 +1249,7 @@ /obj/machinery/stasis, /obj/item/radio/intercom/directional/north, /obj/machinery/camera/autoname{ - dir = 9 + dir = 1 }, /turf/open/floor/iron/white/herringbone, /area/shuttle/escape) @@ -1475,7 +1475,7 @@ /obj/item/radio/intercom/directional/north, /obj/machinery/status_display/evac/directional/west, /obj/machinery/camera/autoname{ - dir = 9 + dir = 1 }, /turf/open/floor/mineral/plastitanium/red, /area/shuttle/escape) @@ -2396,7 +2396,7 @@ /obj/machinery/chem_dispenser/drinks/beer, /obj/machinery/status_display/evac/directional/north, /obj/machinery/camera/autoname{ - dir = 9 + dir = 1 }, /turf/open/floor/grass, /area/shuttle/escape) diff --git a/_maps/shuttles/emergency_tram.dmm b/_maps/shuttles/emergency_tram.dmm index 7ab45a766ff..a7f1340ec98 100644 --- a/_maps/shuttles/emergency_tram.dmm +++ b/_maps/shuttles/emergency_tram.dmm @@ -191,7 +191,7 @@ /obj/machinery/light/directional/east, /obj/item/radio/intercom/directional/north, /obj/machinery/camera/autoname{ - dir = 6 + dir = 4 }, /turf/open/floor/mineral/titanium, /area/shuttle/escape) diff --git a/_maps/shuttles/ruin_syndicate_fighter_shiv.dmm b/_maps/shuttles/ruin_syndicate_fighter_shiv.dmm index 08a0585dc9d..561e9ad8cdd 100644 --- a/_maps/shuttles/ruin_syndicate_fighter_shiv.dmm +++ b/_maps/shuttles/ruin_syndicate_fighter_shiv.dmm @@ -48,6 +48,10 @@ req_access = list("syndicate"); specialfunctions = 4 }, +/obj/machinery/camera/xray/directional/north{ + c_tag = "External View"; + network = list("caravansyndicate1") + }, /turf/open/floor/mineral/plastitanium/red, /area/shuttle/ruin/caravan/syndicate1) "Jv" = ( @@ -59,14 +63,6 @@ }, /turf/closed/wall/mineral/plastitanium, /area/shuttle/ruin/caravan/syndicate1) -"Ve" = ( -/obj/machinery/camera/xray/directional/west{ - c_tag = "External View"; - network = list("caravansyndicate1"); - pixel_x = 32 - }, -/turf/closed/wall/mineral/plastitanium/nodiagonal, -/area/shuttle/ruin/caravan/syndicate1) "Yi" = ( /obj/effect/mapping_helpers/airlock/locked, /obj/machinery/door/airlock/hatch{ @@ -138,7 +134,7 @@ qu ie Jv cZ -Ve +qu cZ Jv ie diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm index 41339199d34..f3de67129ac 100644 --- a/code/__DEFINES/is_helpers.dm +++ b/code/__DEFINES/is_helpers.dm @@ -351,3 +351,4 @@ GLOBAL_LIST_INIT(book_types, typecacheof(list( #define is_area_nearby_station(checked_area) (istype(checked_area, /area/space) || istype(checked_area, /area/space/nearstation) || istype(checked_area, /area/station/asteroid)) #define is_area_virtual(checked_area) (GLOB.virtual_areas && GLOB.virtual_areas[(checked_area).type]) +#define is_area_shuttle(checked_area) (istype(checked_area, /area/shuttle)) diff --git a/code/datums/components/atom_mounted.dm b/code/datums/components/atom_mounted.dm index 87a9d1b7e84..1b58f2ec09f 100644 --- a/code/datums/components/atom_mounted.dm +++ b/code/datums/components/atom_mounted.dm @@ -3,9 +3,9 @@ /// The closed turf our object is currently linked to. var/atom/hanging_support_atom -/datum/component/atom_mounted/Initialize(target_structure, on_drop_callback) +/datum/component/atom_mounted/Initialize(target_structure) . = ..() - if(!isobj(parent)) + if(!isobj(parent) || !isatom(target_structure)) return COMPONENT_INCOMPATIBLE hanging_support_atom = target_structure RegisterSignal(hanging_support_atom, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine)) @@ -15,19 +15,19 @@ RegisterSignal(hanging_support_atom, COMSIG_QDELETING, PROC_REF(on_structure_delete)) /datum/component/atom_mounted/RegisterWithParent() - ADD_TRAIT(parent, TRAIT_WALLMOUNTED, REF(src)) + ADD_TRAIT(parent, TRAIT_WALLMOUNTED, INNATE_TRAIT) + if(is_area_shuttle(get_area(parent))) + RegisterSignal(parent, COMSIG_ATOM_BEFORE_SHUTTLE_MOVE, PROC_REF(detach)) RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(on_move)) /datum/component/atom_mounted/UnregisterFromParent() - REMOVE_TRAIT(parent, TRAIT_WALLMOUNTED, REF(src)) - UnregisterSignal(parent, COMSIG_MOVABLE_MOVED) + REMOVE_TRAIT(parent, TRAIT_WALLMOUNTED, INNATE_TRAIT) + var/list/signals = list(COMSIG_MOVABLE_MOVED) + if(is_area_shuttle(get_area(parent))) + signals += COMSIG_ATOM_BEFORE_SHUTTLE_MOVE + UnregisterSignal(parent, signals) /datum/component/atom_mounted/Destroy(force) - UnregisterSignal(hanging_support_atom, list(COMSIG_ATOM_EXAMINE)) - if(isclosedturf(hanging_support_atom)) - UnregisterSignal(hanging_support_atom, COMSIG_TURF_CHANGE) - else - UnregisterSignal(hanging_support_atom, COMSIG_QDELETING) hanging_support_atom = null return ..() @@ -47,6 +47,7 @@ if(ispath(path, /turf/open)) drop_wallmount() +///When the atom the object is mounted on is destroyed deconstruct /datum/component/atom_mounted/proc/on_structure_delete(datum/source, force) SIGNAL_HANDLER @@ -61,6 +62,12 @@ return drop_wallmount() +///Called when the object is about to be shuttle rotated so we have to delete ourself and mount again later +/datum/component/atom_mounted/proc/detach(datum/source, newT, rotation, move_mode, moving_dock) + SIGNAL_HANDLER + + qdel(src) + /** * Handles the dropping of the linked object. This is done via deconstruction, as that should be the most sane way to handle it for most objects. * Except for intercoms, which are handled by creating a new wallframe intercom, as they're apparently items. @@ -72,7 +79,6 @@ hanging_parent.visible_message(message = span_warning("\The [hanging_parent] falls apart!"), vision_distance = 5) hanging_parent.deconstruct(FALSE) - /// Returns a list of potential turfs to mount on. This should not check if those turfs are valid but only locate them /obj/proc/get_turfs_to_mount_on() PROTECTED_PROC(TRUE) @@ -137,7 +143,7 @@ return TRUE var/area/location = get_area(src) - if(!isarea(location) || istype(location, /area/shuttle)) + if(!isarea(location)) return FALSE var/msg @@ -157,6 +163,8 @@ break if(attachable_atom) AddComponent(/datum/component/atom_mounted, attachable_atom) + if(is_area_shuttle(location)) + RegisterSignal(src, COMSIG_ATOM_AFTER_SHUTTLE_MOVE, PROC_REF(remount), override = TRUE) return TRUE if(msg) msg += "([target.x],[target.y],[target.z]) " @@ -166,3 +174,10 @@ if(mark_for_late_init) obj_flags |= MOUNT_ON_LATE_INITIALIZE return FALSE + +///Used to remount an object after shuttle move +/obj/proc/remount(datum/source, oldT) + SIGNAL_HANDLER + PRIVATE_PROC(TRUE) + + find_and_mount_on_atom() diff --git a/code/game/objects/effects/posters/poster.dm b/code/game/objects/effects/posters/poster.dm index 1fe4e365691..833d142c5da 100644 --- a/code/game/objects/effects/posters/poster.dm +++ b/code/game/objects/effects/posters/poster.dm @@ -124,7 +124,7 @@ placed_poster.roll_and_drop(user_drop_location, user) return ITEM_INTERACT_FAILURE - placed_poster.AddComponent(/datum/component/atom_mounted, wall_structure) + placed_poster.find_and_mount_on_atom() placed_poster.on_placed_poster(user) return ITEM_INTERACT_SUCCESS diff --git a/code/game/objects/items/wall_mounted.dm b/code/game/objects/items/wall_mounted.dm index 2cd4c4011da..824341b4c71 100644 --- a/code/game/objects/items/wall_mounted.dm +++ b/code/game/objects/items/wall_mounted.dm @@ -49,8 +49,7 @@ hanging_object.pixel_x = pixel_shift if(WEST) hanging_object.pixel_x = -pixel_shift - if(!istype(get_area(user), /area/shuttle)) //due to turf changing issue we don't mount here for now - hanging_object.AddComponent(/datum/component/atom_mounted, support_structure) + hanging_object.find_and_mount_on_atom() after_attach(hanging_object) qdel(src) diff --git a/code/game/objects/structures/signs/_signs.dm b/code/game/objects/structures/signs/_signs.dm index e1debb4aab1..7be5596412f 100644 --- a/code/game/objects/structures/signs/_signs.dm +++ b/code/game/objects/structures/signs/_signs.dm @@ -207,7 +207,7 @@ playsound(target_turf, 'sound/items/deconstruct.ogg', 50, TRUE) placed_sign.update_integrity(get_integrity()) placed_sign.setDir(dir) - placed_sign.AddComponent(/datum/component/atom_mounted, target_turf) + placed_sign.find_and_mount_on_atom() qdel(src) return ITEM_INTERACT_SUCCESS diff --git a/code/modules/power/lighting/light_construct.dm b/code/modules/power/lighting/light_construct.dm index 649207a9759..cb090f4ac7e 100644 --- a/code/modules/power/lighting/light_construct.dm +++ b/code/modules/power/lighting/light_construct.dm @@ -153,10 +153,7 @@ if("floor") new_light = new /obj/machinery/light/floor/empty(loc) new_light.setDir(dir) - var/atom/support = get_step(src, dir) - if(!isclosedturf(support)) - support = locate(/obj/structure/window) in support - new_light.AddComponent(/datum/component/atom_mounted, support) + new_light.find_and_mount_on_atom() transfer_fingerprints_to(new_light) if(!QDELETED(cell)) new_light.cell = cell diff --git a/code/modules/shuttle/mobile_port/shuttle_move_callbacks.dm b/code/modules/shuttle/mobile_port/shuttle_move_callbacks.dm index 67b626154ff..37f2c1a9c6c 100644 --- a/code/modules/shuttle/mobile_port/shuttle_move_callbacks.dm +++ b/code/modules/shuttle/mobile_port/shuttle_move_callbacks.dm @@ -118,7 +118,7 @@ All ShuttleMove procs go here // Called on atoms after everything has been moved /atom/movable/proc/afterShuttleMove(turf/oldT, list/movement_force, shuttle_dir, shuttle_preferred_direction, move_dir, rotation) SHOULD_CALL_PARENT(TRUE) - SEND_SIGNAL(src, COMSIG_ATOM_AFTER_SHUTTLE_MOVE, oldT) + if(light) update_light() if(rotation) @@ -126,6 +126,8 @@ All ShuttleMove procs go here update_parallax_contents() + SEND_SIGNAL(src, COMSIG_ATOM_AFTER_SHUTTLE_MOVE, oldT) + return TRUE /atom/movable/proc/lateShuttleMove(turf/oldT, list/movement_force, move_dir) diff --git a/code/modules/shuttle/mobile_port/variants/arrivals.dm b/code/modules/shuttle/mobile_port/variants/arrivals.dm index 4a1bc5744d8..bcb2db4e78e 100644 --- a/code/modules/shuttle/mobile_port/variants/arrivals.dm +++ b/code/modules/shuttle/mobile_port/variants/arrivals.dm @@ -41,6 +41,7 @@ new_latejoin += shuttle_chair if(isnull(console)) console = locate() in arrival_turf + RegisterSignal(console, COMSIG_QDELETING, PROC_REF(find_console)) areas += arrival_area if(SSjob.latejoin_trackers.len) @@ -100,6 +101,22 @@ else if(!found_awake) Launch(FALSE) +/obj/docking_port/mobile/arrivals/proc/find_console(datum/source, force) + SIGNAL_HANDLER + + //clear ref to old deleted console + console = null + + //find new console + for(var/area/shuttle/arrival/arrival_area as anything in areas) + for(var/list/zlevel_turfs as anything in arrival_area.get_zlevel_turf_lists()) + for(var/turf/arrival_turf as anything in zlevel_turfs) + var/obj/machinery/requests_console/target = locate() in arrival_turf + if(!QDELETED(target)) + console = target + RegisterSignal(console, COMSIG_QDELETING, PROC_REF(find_console)) + return + /obj/docking_port/mobile/arrivals/proc/CheckTurfsPressure() for(var/I in SSjob.latejoin_trackers) var/turf/open/T = get_turf(I)