mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
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 🆑 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 /🆑
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user