Enhances algorithm for finding an atom mount (#94076)

## About The Pull Request
Depends on #94064 for the unit test but offers a better method for
finding an atom to mount on
- Finding a mount now takes into consideration the objects pixel x & y
offsets meaning diagonal mounting is now supported. Gives great
flexibility for mappers
- If you don't want to use pixel offsets but default back to using the
objects direction that behaviour is still preserved. Useful if your
object uses directional icon states(lights & cameras for now) AND don't
use offsets
- If no direction could be specified then as the last resort it defaults
back to the objects local turf for mounting

## Changelog
🆑
fix: all mounted objects on tables, fences, windows & walls should fall
of correctly when the atom it is placed on is destroyed
fix: security telescreen now falls off when their mounted wall is
destroyed
fix: defib wall mount falls off when their mounted wall is destroyed
fix: floor lights are mounted to the ground/catwalk/tram floor they are
sitting on meaning destroying it will destroy the light
fix: wall mounted plaques now fall off when their mounted wall is
destroyed
/🆑
This commit is contained in:
SyncIt21
2025-12-01 00:50:16 +01:00
committed by GitHub
parent 26fa3a42f1
commit 39a196824a
54 changed files with 228 additions and 139 deletions
@@ -26,6 +26,8 @@ GLOBAL_DATUM_INIT(keycard_events, /datum/events, new)
/obj/machinery/keycard_auth/Initialize(mapload)
. = ..()
activated = GLOB.keycard_events.addEvent("triggerEvent", CALLBACK(src, PROC_REF(triggerEvent)))
if(mapload)
find_and_mount_on_atom()
/obj/machinery/keycard_auth/Destroy()
GLOB.keycard_events.clearEvent("triggerEvent", activated)
@@ -162,11 +164,6 @@ GLOBAL_DATUM_INIT(keycard_events, /datum/events, new)
MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/keycard_auth/wall_mounted, 26)
/obj/machinery/keycard_auth/wall_mounted/Initialize(mapload)
. = ..()
if(mapload)
find_and_hang_on_atom()
GLOBAL_VAR_INIT(emergency_access, FALSE)
/proc/make_maint_all_access()
for(var/area/station/maintenance/area in GLOB.areas)