From f640a0e972c1625f151cafde2d7175bcbf5b0616 Mon Sep 17 00:00:00 2001 From: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Date: Mon, 1 Dec 2025 05:20:16 +0530 Subject: [PATCH] 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 :cl: 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 /:cl: --- .../SpaceRuins/old_infiltrator.dmm | 2 +- .../SpaceRuins/russian_derelict.dmm | 4 +- _maps/RandomZLevels/SnowCabin.dmm | 4 +- _maps/RandomZLevels/museum.dmm | 2 +- .../CatwalkStation/CatwalkStation_2023.dmm | 8 ++- .../map_files/Deltastation/DeltaStation2.dmm | 28 ++++----- .../map_files/IceBoxStation/IceBoxStation.dmm | 9 ++- _maps/map_files/MetaStation/MetaStation.dmm | 16 ++--- _maps/map_files/Mining/Lavaland.dmm | 27 ++++---- .../map_files/NebulaStation/NebulaStation.dmm | 13 +--- _maps/map_files/tramstation/tramstation.dmm | 4 +- _maps/map_files/wawastation/wawastation.dmm | 2 +- .../{wall_mounted.dm => atom_mounted.dm} | 63 ++++++++++++++++--- code/game/machinery/_machinery.dm | 2 +- code/game/machinery/barsigns.dm | 2 +- code/game/machinery/buttons.dm | 2 +- code/game/machinery/camera/camera.dm | 5 +- code/game/machinery/computer/telescreen.dm | 7 ++- code/game/machinery/defibrillator_mount.dm | 10 ++- code/game/machinery/digital_clock.dm | 2 +- code/game/machinery/firealarm.dm | 2 +- code/game/machinery/flasher.dm | 6 +- code/game/machinery/igniter.dm | 2 +- code/game/machinery/lightswitch.dm | 2 +- .../newscaster/newscaster_machine.dm | 2 +- .../machinery/porta_turret/turret_control.dm | 2 +- code/game/machinery/requests_console.dm | 2 +- code/game/machinery/status_display.dm | 4 +- code/game/machinery/wall_healer.dm | 2 +- code/game/objects/effects/posters/poster.dm | 2 +- .../objects/items/devices/radio/intercom.dm | 2 +- code/game/objects/items/wall_mounted.dm | 2 +- .../game/objects/structures/detectiveboard.dm | 2 +- code/game/objects/structures/extinguisher.dm | 2 +- code/game/objects/structures/fireaxe.dm | 2 +- code/game/objects/structures/mirror.dm | 2 +- code/game/objects/structures/noticeboard.dm | 2 +- .../objects/structures/plaques/_plaques.dm | 2 + .../structures/plaques/static_plaques.dm | 7 +++ code/game/objects/structures/secure_safe.dm | 4 +- code/game/objects/structures/signs/_signs.dm | 6 +- .../structures/water_structures/urinal.dm | 2 +- code/modules/art/paintings.dm | 5 +- .../machinery/air_alarm/_air_alarm.dm | 2 +- code/modules/fishing/fish_mount.dm | 2 +- .../spaceruin_code/hauntedtradingpost.dm | 3 + code/modules/paperwork/ticketmachine.dm | 2 +- code/modules/power/apc/apc_main.dm | 2 +- code/modules/power/lighting/light.dm | 32 +++++++--- .../modules/power/lighting/light_construct.dm | 9 ++- code/modules/reagents/reagent_dispenser.dm | 4 +- .../security_levels/keycard_authentication.dm | 7 +-- code/modules/unit_tests/wallmount.dm | 24 ++++++- tgstation.dme | 2 +- 54 files changed, 228 insertions(+), 139 deletions(-) rename code/datums/components/{wall_mounted.dm => atom_mounted.dm} (75%) diff --git a/_maps/RandomRuins/SpaceRuins/old_infiltrator.dmm b/_maps/RandomRuins/SpaceRuins/old_infiltrator.dmm index 42a8781df73..082f1341908 100644 --- a/_maps/RandomRuins/SpaceRuins/old_infiltrator.dmm +++ b/_maps/RandomRuins/SpaceRuins/old_infiltrator.dmm @@ -268,7 +268,6 @@ "sL" = ( /obj/structure/table, /obj/effect/spawner/random/engineering/tool, -/obj/machinery/light/directional/north, /obj/item/stack/cable_coil, /turf/open/floor/mineral/plastitanium/red/airless, /area/ruin/space/unpowered) @@ -439,6 +438,7 @@ pixel_x = 8 }, /obj/machinery/status_display/evac/directional/north, +/obj/machinery/light/directional/north, /turf/open/floor/mineral/plastitanium/red/airless, /area/ruin/space/unpowered) "Da" = ( diff --git a/_maps/RandomRuins/SpaceRuins/russian_derelict.dmm b/_maps/RandomRuins/SpaceRuins/russian_derelict.dmm index 68b45ff5732..c1353452262 100644 --- a/_maps/RandomRuins/SpaceRuins/russian_derelict.dmm +++ b/_maps/RandomRuins/SpaceRuins/russian_derelict.dmm @@ -8139,9 +8139,9 @@ /turf/open/floor/circuit/red/off, /area/ruin/space/ks13/ai/corridor) "YE" = ( +/obj/effect/decal/cleanable/dirt, +/obj/effect/decal/cleanable/dirt, /obj/structure/plaque/static_plaque/golden/commission/ks13, -/obj/effect/decal/cleanable/dirt, -/obj/effect/decal/cleanable/dirt, /turf/open/floor/iron/airless, /area/ruin/space/ks13/hallway/central) "YF" = ( diff --git a/_maps/RandomZLevels/SnowCabin.dmm b/_maps/RandomZLevels/SnowCabin.dmm index 47ad98c5122..fb71dd7611b 100644 --- a/_maps/RandomZLevels/SnowCabin.dmm +++ b/_maps/RandomZLevels/SnowCabin.dmm @@ -3588,10 +3588,8 @@ /turf/open/floor/plating/snowed/snow_cabin, /area/awaymission/cabin/snowforest/sovietsurface) "yJ" = ( -/obj/structure/sign/poster/contraband/free_drone{ - desc = "This poster seems to be meant for a bunch of machines that used to be deployed on space stations." - }, /obj/effect/turf_decal/tile/blue/fourcorners, +/obj/structure/sign/poster/contraband/free_drone/directional/west, /turf/open/indestructible, /area/awaymission/cabin/caves/mountain) "yP" = ( diff --git a/_maps/RandomZLevels/museum.dmm b/_maps/RandomZLevels/museum.dmm index f94f93e2480..0260f945a1a 100644 --- a/_maps/RandomZLevels/museum.dmm +++ b/_maps/RandomZLevels/museum.dmm @@ -5370,8 +5370,8 @@ /turf/open/floor/iron/white/small, /area/awaymission/museum) "Tr" = ( -/obj/structure/plaque/static_plaque/golden/commission/kilo, /obj/machinery/light/floor, +/obj/structure/plaque/static_plaque/golden/commission/kilo, /turf/open/floor/mineral/gold, /area/awaymission/museum) "Tt" = ( diff --git a/_maps/map_files/CatwalkStation/CatwalkStation_2023.dmm b/_maps/map_files/CatwalkStation/CatwalkStation_2023.dmm index 1221c43feb1..5d19883e1f3 100644 --- a/_maps/map_files/CatwalkStation/CatwalkStation_2023.dmm +++ b/_maps/map_files/CatwalkStation/CatwalkStation_2023.dmm @@ -32945,8 +32945,10 @@ /turf/open/openspace, /area/station/construction/storage_wing) "jbh" = ( +/obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer2, +/obj/effect/decal/cleanable/dirt, /obj/machinery/light/floor/broken, -/turf/open/openspace, +/turf/open/floor/eighties, /area/station/maintenance/hallway/abandoned_recreation) "jbn" = ( /obj/structure/stairs/west, @@ -112454,7 +112456,7 @@ oLN vwl ilE chu -wNu +jbh sQY aHS pMT @@ -177990,7 +177992,7 @@ adC adC adC adC -jbh +adC fgT hdN cVm diff --git a/_maps/map_files/Deltastation/DeltaStation2.dmm b/_maps/map_files/Deltastation/DeltaStation2.dmm index 6157154b2d7..71676b5d5ab 100644 --- a/_maps/map_files/Deltastation/DeltaStation2.dmm +++ b/_maps/map_files/Deltastation/DeltaStation2.dmm @@ -4310,12 +4310,6 @@ /obj/effect/turf_decal/tile/neutral/fourcorners, /turf/open/floor/iron, /area/station/science/research) -"bbP" = ( -/obj/structure/plaque/static_plaque/golden/commission/delta, -/obj/effect/turf_decal/tile/neutral/fourcorners, -/obj/machinery/atmospherics/pipe/smart/manifold4w/cyan/hidden, -/turf/open/floor/iron, -/area/station/hallway/secondary/entry) "bbQ" = ( /obj/machinery/vending/wardrobe/hydro_wardrobe, /obj/effect/turf_decal/bot, @@ -16141,10 +16135,6 @@ /turf/open/floor/iron, /area/station/maintenance/port) "dXw" = ( -/obj/structure/sign/painting/large/library_private{ - dir = 1; - pixel_x = -29 - }, /obj/structure/destructible/cult/item_dispenser/archives/library, /obj/item/book/codex_gigas, /turf/open/floor/iron/dark, @@ -60154,6 +60144,12 @@ /obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer2, /turf/open/floor/plating, /area/station/maintenance/department/science) +"oVq" = ( +/obj/effect/turf_decal/tile/neutral/fourcorners, +/obj/machinery/atmospherics/pipe/smart/manifold4w/cyan/hidden, +/obj/structure/plaque/static_plaque/golden/commission/delta, +/turf/open/floor/iron, +/area/station/hallway/secondary/entry) "oVt" = ( /obj/structure/chair/pew, /turf/open/floor/iron/chapel{ @@ -61895,6 +61891,9 @@ /area/station/maintenance/department/crew_quarters/bar) "ptI" = ( /obj/effect/turf_decal/tile/neutral/fourcorners, +/obj/structure/sign/painting/large/library_private{ + dir = 1 + }, /turf/open/floor/iron/dark, /area/station/service/library/printer) "ptM" = ( @@ -64892,12 +64891,9 @@ /obj/machinery/status_display/ai/directional/south, /obj/machinery/camera/directional/south{ c_tag = "Service - Bar Aft"; - dir = 5; name = "service camera" }, -/obj/effect/turf_decal/tile/red/opposingcorners{ - dir = 1 - }, +/obj/effect/turf_decal/tile/red/opposingcorners, /obj/effect/turf_decal/tile/yellow/opposingcorners, /turf/open/floor/iron, /area/station/commons/lounge) @@ -67917,10 +67913,10 @@ /turf/open/floor/iron, /area/station/engineering/atmos) "qMS" = ( -/obj/item/kirbyplants/random, /obj/effect/decal/cleanable/dirt, /obj/effect/turf_decal/delivery, /obj/effect/turf_decal/tile/neutral/fourcorners, +/obj/item/kirbyplants/random, /turf/open/floor/iron/dark, /area/station/hallway/secondary/entry) "qNb" = ( @@ -132353,7 +132349,7 @@ aaa aaa qld lYd -bbP +oVq kJd xcm lSh diff --git a/_maps/map_files/IceBoxStation/IceBoxStation.dmm b/_maps/map_files/IceBoxStation/IceBoxStation.dmm index cb12cb2c51f..bdec1a0a208 100644 --- a/_maps/map_files/IceBoxStation/IceBoxStation.dmm +++ b/_maps/map_files/IceBoxStation/IceBoxStation.dmm @@ -2734,9 +2734,7 @@ /obj/structure/disposalpipe/segment{ dir = 6 }, -/obj/structure/sign/poster/contraband/random/directional/north{ - dir = 4 - }, +/obj/structure/sign/poster/contraband/random/directional/west, /turf/open/floor/plating, /area/station/maintenance/department/medical/central) "aMr" = ( @@ -6005,7 +6003,8 @@ /area/station/engineering/lobby) "bDB" = ( /obj/structure/plaque/static_plaque/golden/commission/icebox{ - pixel_y = 32 + pixel_y = 32; + dir = 1 }, /turf/open/floor/iron, /area/station/hallway/primary/starboard) @@ -81049,8 +81048,8 @@ /obj/effect/turf_decal/tile/blue{ dir = 1 }, -/obj/item/kirbyplants/random, /obj/structure/sign/poster/official/random/directional/north, +/obj/item/kirbyplants/random, /turf/open/floor/iron/cafeteria{ dir = 8 }, diff --git a/_maps/map_files/MetaStation/MetaStation.dmm b/_maps/map_files/MetaStation/MetaStation.dmm index 41b95477b8e..f3ffbf35807 100644 --- a/_maps/map_files/MetaStation/MetaStation.dmm +++ b/_maps/map_files/MetaStation/MetaStation.dmm @@ -13677,6 +13677,13 @@ /obj/machinery/atmospherics/pipe/smart/manifold4w/cyan/hidden/layer4, /turf/open/floor/iron, /area/station/cargo/miningoffice) +"eJR" = ( +/obj/structure/cable, +/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden/layer4, +/obj/effect/landmark/start/hangover, +/obj/structure/plaque/static_plaque/golden/commission/meta, +/turf/open/floor/iron, +/area/station/hallway/secondary/command) "eJZ" = ( /obj/effect/spawner/random/structure/chair_comfy{ dir = 4 @@ -21472,13 +21479,6 @@ /obj/structure/cable, /turf/open/floor/iron, /area/station/cargo/sorting) -"hvI" = ( -/obj/structure/cable, -/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden/layer4, -/obj/effect/landmark/start/hangover, -/obj/structure/plaque/static_plaque/golden/commission/meta, -/turf/open/floor/iron, -/area/station/hallway/secondary/command) "hvJ" = ( /obj/structure/disposalpipe/segment, /obj/effect/landmark/event_spawn, @@ -98576,7 +98576,7 @@ mrG lPZ mJE tWV -hvI +eJR nsq qnt nmm diff --git a/_maps/map_files/Mining/Lavaland.dmm b/_maps/map_files/Mining/Lavaland.dmm index cc5a78df78a..1529368eb9a 100644 --- a/_maps/map_files/Mining/Lavaland.dmm +++ b/_maps/map_files/Mining/Lavaland.dmm @@ -7833,6 +7833,18 @@ /obj/effect/decal/cleanable/dirt, /turf/open/floor/iron/smooth, /area/mine/laborcamp) +"Tv" = ( +/obj/machinery/door/airlock/external/glass{ + name = "Mining External Airlock" + }, +/obj/effect/mapping_helpers/airlock/cyclelink_helper_multi{ + cycle_id = "lavaland_living_west" + }, +/obj/structure/sign/directions/security/directional/west{ + pixel_y = -8 + }, +/turf/open/floor/iron/textured_large, +/area/mine/cafeteria) "Tx" = ( /obj/machinery/light/small/directional/north, /obj/effect/decal/cleanable/dirt, @@ -8606,19 +8618,6 @@ /obj/item/seeds/apple, /turf/open/floor/iron/dark, /area/mine/laborcamp) -"XM" = ( -/obj/machinery/door/airlock/external/glass{ - name = "Mining External Airlock" - }, -/obj/effect/mapping_helpers/airlock/cyclelink_helper_multi{ - cycle_id = "lavaland_living_west" - }, -/obj/structure/sign/directions/security/directional/west{ - pixel_y = -7; - pixel_x = 0 - }, -/turf/open/floor/iron/textured_large, -/area/mine/cafeteria) "XP" = ( /obj/structure/stone_tile/cracked, /obj/structure/stone_tile/block{ @@ -37499,7 +37498,7 @@ te dz px DI -XM +Tv BP ol aj diff --git a/_maps/map_files/NebulaStation/NebulaStation.dmm b/_maps/map_files/NebulaStation/NebulaStation.dmm index 10e15e9a29d..23145fcd017 100644 --- a/_maps/map_files/NebulaStation/NebulaStation.dmm +++ b/_maps/map_files/NebulaStation/NebulaStation.dmm @@ -69739,9 +69739,7 @@ /obj/machinery/light_switch/directional/south{ pixel_x = -6 }, -/obj/machinery/camera/autoname/directional/south{ - dir = 5 - }, +/obj/machinery/camera/autoname/directional/south, /turf/open/floor/carpet, /area/station/command/meeting_room) "knt" = ( @@ -71930,9 +71928,7 @@ /obj/item/stack/medical/suture, /obj/item/stack/medical/suture, /obj/machinery/airalarm/directional/west, -/obj/machinery/camera/autoname/directional/north{ - network = list("ss13","medbay") - }, +/obj/machinery/camera/autoname/directional/west, /turf/open/floor/iron/white, /area/station/medical/medbay/lobby) "kCp" = ( @@ -136478,9 +136474,7 @@ dir = 4 }, /obj/structure/table/reinforced/rglass, -/obj/machinery/camera/autoname/directional/east{ - dir = 6 - }, +/obj/machinery/camera/autoname/directional/east, /turf/open/floor/iron/dark, /area/station/command/bridge) "uiG" = ( @@ -149565,7 +149559,6 @@ dir = 8 }, /obj/machinery/camera/autoname/directional/south{ - dir = 5; network = list("prison") }, /obj/machinery/processor, diff --git a/_maps/map_files/tramstation/tramstation.dmm b/_maps/map_files/tramstation/tramstation.dmm index 2b6cad7636b..399aff633d8 100644 --- a/_maps/map_files/tramstation/tramstation.dmm +++ b/_maps/map_files/tramstation/tramstation.dmm @@ -17125,10 +17125,10 @@ /area/station/hallway/primary/tram/center) "eSH" = ( /obj/structure/window/reinforced/spawner/directional/south, +/obj/effect/turf_decal/tile/green/half/contrasted, /obj/machinery/computer/records/medical{ dir = 1 }, -/obj/effect/turf_decal/tile/green/half/contrasted, /turf/open/floor/iron, /area/station/command/bridge) "eSI" = ( @@ -48429,13 +48429,13 @@ /turf/open/floor/iron, /area/station/service/hydroponics/garden) "pWN" = ( -/obj/structure/plaque/static_plaque/golden/commission/tram, /obj/structure/disposalpipe/segment{ dir = 5 }, /obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden/layer4, /obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer2, /obj/structure/cable, +/obj/structure/plaque/static_plaque/golden/commission/tram, /turf/open/floor/iron/dark, /area/station/command/bridge) "pWO" = ( diff --git a/_maps/map_files/wawastation/wawastation.dmm b/_maps/map_files/wawastation/wawastation.dmm index 6b5d564c391..36df2c14123 100644 --- a/_maps/map_files/wawastation/wawastation.dmm +++ b/_maps/map_files/wawastation/wawastation.dmm @@ -31912,10 +31912,10 @@ /area/station/command/bridge) "kXV" = ( /obj/structure/cable, -/obj/structure/plaque/static_plaque/golden/commission/wawa, /obj/structure/disposalpipe/segment{ dir = 8 }, +/obj/structure/plaque/static_plaque/golden/commission/wawa, /turf/open/floor/iron, /area/station/hallway/primary/central) "kYc" = ( diff --git a/code/datums/components/wall_mounted.dm b/code/datums/components/atom_mounted.dm similarity index 75% rename from code/datums/components/wall_mounted.dm rename to code/datums/components/atom_mounted.dm index 56f59d8cacc..0d2382e6947 100644 --- a/code/datums/components/wall_mounted.dm +++ b/code/datums/components/atom_mounted.dm @@ -69,6 +69,55 @@ 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) + RETURN_TYPE(/list/turf) + + //Infer using icon offsets. Can support diagonal mounting + var/pixel_direction = NONE + if(pixel_x > (ICON_SIZE_X / 2)) + pixel_direction |= EAST + else if(pixel_x < -(ICON_SIZE_X / 2)) + pixel_direction |= WEST + if(pixel_y > (ICON_SIZE_Y / 2)) + pixel_direction |= NORTH + else if(pixel_y < -(ICON_SIZE_Y / 2)) + pixel_direction |= SOUTH + + . = list() + if(pixel_direction != NONE) + . += get_step(src, pixel_direction) + . += get_turf(src) + +/** + * Checks if our object can mount on this turf + * + * Arguments + * * turf/target - the turf we are trying to mount on +*/ +/obj/proc/is_mountable_turf(turf/target) + PROTECTED_PROC(TRUE) + SHOULD_BE_PURE(TRUE) + + return isclosedturf(target) + +/// Returns an list of object types we can mount on if the turf is unmountable +/obj/proc/get_moutable_objects() + PROTECTED_PROC(TRUE) + SHOULD_BE_PURE(TRUE) + RETURN_TYPE(/list/obj) + + var/static/list/obj/attachables = list( + /obj/structure/table, + /obj/structure/window, + /obj/structure/fence, + /obj/structure/falsewall, + ) + + return attachables + /** * Finds an support atom to hang this object on. If you need to mount the object on Late Initialize * then pass TRUE inside Initialize() but not in LateInitialize(). @@ -78,7 +127,7 @@ * * mark_for_late_init - if TRUE will apply the MOUNT_ON_LATE_INITIALIZE which gets cleared on every call * * late_init - should only be passed as TRUE from inside LateInitialize() */ -/obj/proc/find_and_hang_on_atom(mark_for_late_init = FALSE, late_init = FALSE) +/obj/proc/find_and_mount_on_atom(mark_for_late_init = FALSE, late_init = FALSE) if(obj_flags & MOUNT_ON_LATE_INITIALIZE) obj_flags &= ~MOUNT_ON_LATE_INITIALIZE else if(late_init) @@ -92,19 +141,13 @@ if(PERFORM_ALL_TESTS(focus_only/atom_mounted) && !mark_for_late_init) msg = "[type] Could not find attachable object at [location.type] " - var/list/turf/attachable_turfs = list() - attachable_turfs += get_step(src, dir) - attachable_turfs += get_turf(src) + var/list/turf/attachable_turfs = get_turfs_to_mount_on() for(var/turf/target as anything in attachable_turfs) var/atom/attachable_atom - if(isclosedturf(target)) + if(is_mountable_turf(target)) attachable_atom = target //your usual wallmount else - var/static/list/attachables = list( - /obj/structure/table, - /obj/structure/window, - /obj/structure/fence, - ) //list of structures to mount on + var/list/obj/attachables = get_moutable_objects() for(var/obj/attachable in target) if(is_type_in_list(attachable, attachables)) attachable_atom = attachable diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index a6526269b87..5bb2df1573a 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -209,7 +209,7 @@ PROTECTED_PROC(TRUE) SHOULD_CALL_PARENT(TRUE) - find_and_hang_on_atom(late_init = TRUE) + find_and_mount_on_atom(late_init = TRUE) power_change() if(use_power == NO_POWER_USE) diff --git a/code/game/machinery/barsigns.dm b/code/game/machinery/barsigns.dm index 1b366ef7a21..cabbc744c13 100644 --- a/code/game/machinery/barsigns.dm +++ b/code/game/machinery/barsigns.dm @@ -31,7 +31,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/barsign, 32) change_area_name = mapload set_sign(new /datum/barsign/hiddensigns/signoff) if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() /obj/machinery/barsign/proc/set_sign(datum/barsign/sign) if(!istype(sign)) diff --git a/code/game/machinery/buttons.dm b/code/game/machinery/buttons.dm index 84cef557138..c0a7ef8278c 100644 --- a/code/game/machinery/buttons.dm +++ b/code/game/machinery/buttons.dm @@ -62,7 +62,7 @@ setup_device(mapload) if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() register_context() /obj/machinery/button/Destroy() diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 835ba783a0e..526d6b2ab8d 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -131,7 +131,10 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/camera/xray, 0) alarm_manager = new(src) if(mapload) - find_and_hang_on_atom(mark_for_late_init = TRUE) + find_and_mount_on_atom(mark_for_late_init = TRUE) + +/obj/machinery/camera/get_turfs_to_mount_on() + return list(get_step(src, dir)) /obj/machinery/camera/Destroy(force) if(can_use()) diff --git a/code/game/machinery/computer/telescreen.dm b/code/game/machinery/computer/telescreen.dm index c3167eff4b2..91293383cb9 100644 --- a/code/game/machinery/computer/telescreen.dm +++ b/code/game/machinery/computer/telescreen.dm @@ -14,6 +14,11 @@ var/frame_type = /obj/item/wallframe/telescreen projectiles_pass_chance = 100 +/obj/machinery/computer/security/telescreen/Initialize(mapload) + . = ..() + if(mapload) + find_and_mount_on_atom() + /obj/item/wallframe/telescreen name = "telescreen frame" desc = "A wall-mountable telescreen frame. Apply to wall to use." @@ -70,8 +75,6 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/computer/security/telescreen/entertai /obj/machinery/computer/security/telescreen/entertainment/Initialize(mapload) . = ..() - if(mapload) - find_and_hang_on_atom() register_context() RegisterSignal(SSdcs, COMSIG_GLOB_NETWORK_BROADCAST_UPDATED, PROC_REF(on_network_broadcast_updated)) speakers = new(src) diff --git a/code/game/machinery/defibrillator_mount.dm b/code/game/machinery/defibrillator_mount.dm index 9668ebf07eb..7724bd888f1 100644 --- a/code/game/machinery/defibrillator_mount.dm +++ b/code/game/machinery/defibrillator_mount.dm @@ -21,11 +21,14 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/defibrillator_mount, 28) +/obj/machinery/defibrillator_mount/Initialize(mapload) + . = ..() + if(mapload) + find_and_mount_on_atom() + /obj/machinery/defibrillator_mount/loaded/Initialize(mapload) //loaded subtype for mapping use . = ..() defib = new/obj/item/defibrillator/loaded(src) - if(mapload) - find_and_hang_on_atom() /obj/machinery/defibrillator_mount/Destroy() QDEL_NULL(defib) @@ -233,6 +236,9 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/defibrillator_mount, 28) . = ..() AddElement(/datum/element/noisy_movement) +/obj/machinery/defibrillator_mount/mobile/find_and_mount_on_atom(mark_for_late_init, late_init) + return //its mobile + /obj/machinery/defibrillator_mount/mobile/wrench_act_secondary(mob/living/user, obj/item/tool) if(user.combat_mode) return ..() diff --git a/code/game/machinery/digital_clock.dm b/code/game/machinery/digital_clock.dm index d1ed97e7e27..57c58083aae 100644 --- a/code/game/machinery/digital_clock.dm +++ b/code/game/machinery/digital_clock.dm @@ -81,7 +81,7 @@ /obj/machinery/digital_clock/Initialize(mapload) . = ..() if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() AddElement(/datum/element/beauty, 200) /obj/machinery/digital_clock/process(seconds_per_tick) diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm index ec65d2c3a92..6c7a5c83dbd 100644 --- a/code/game/machinery/firealarm.dm +++ b/code/game/machinery/firealarm.dm @@ -86,7 +86,7 @@ register_context() if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() update_appearance() /obj/machinery/firealarm/Destroy() diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm index 98d176121ff..f08fc004682 100644 --- a/code/game/machinery/flasher.dm +++ b/code/game/machinery/flasher.dm @@ -28,7 +28,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/flasher, 26) . = ..() if(mapload) bulb = new(src) - find_and_hang_on_atom() + find_and_mount_on_atom() /obj/machinery/flasher/vv_edit_var(vname, vval) . = ..() @@ -170,8 +170,8 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/flasher, 26) . = ..() proximity_monitor = new(src, 0) -/obj/machinery/flasher/portable/find_and_hang_on_atom(mark_for_late_init = FALSE, late_init = FALSE) - return //its meant to be carried +/obj/machinery/flasher/portable/find_and_mount_on_atom(mark_for_late_init, late_init) + return //its meant to be carried and mobile /obj/machinery/flasher/portable/HasProximity(atom/movable/proximity_check_mob) if(!COOLDOWN_FINISHED(src, flash_cooldown)) diff --git a/code/game/machinery/igniter.dm b/code/game/machinery/igniter.dm index 39bdf7a8daa..74fc11c9257 100644 --- a/code/game/machinery/igniter.dm +++ b/code/game/machinery/igniter.dm @@ -164,7 +164,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/sparker, 26) spark_system.attach(src) register_context() if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() /obj/machinery/sparker/Destroy() QDEL_NULL(spark_system) diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm index 281528d635c..4004ecd9566 100644 --- a/code/game/machinery/lightswitch.dm +++ b/code/game/machinery/lightswitch.dm @@ -35,7 +35,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/light_switch, 26) if(autoname) name = "light switch ([area.name])" if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() register_context() update_appearance() diff --git a/code/game/machinery/newscaster/newscaster_machine.dm b/code/game/machinery/newscaster/newscaster_machine.dm index 63ed25a2c39..65a247f7f38 100644 --- a/code/game/machinery/newscaster/newscaster_machine.dm +++ b/code/game/machinery/newscaster/newscaster_machine.dm @@ -78,7 +78,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/newscaster, 30) GLOB.allbountyboards += src update_appearance() if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() /obj/machinery/newscaster/Destroy() GLOB.allCasters -= src diff --git a/code/game/machinery/porta_turret/turret_control.dm b/code/game/machinery/porta_turret/turret_control.dm index ecf98315b2b..ef1488cb1dc 100644 --- a/code/game/machinery/porta_turret/turret_control.dm +++ b/code/game/machinery/porta_turret/turret_control.dm @@ -27,7 +27,7 @@ . = ..() if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() else locked = FALSE power_change() diff --git a/code/game/machinery/requests_console.dm b/code/game/machinery/requests_console.dm index c0604a32e0a..15ae4f6406d 100644 --- a/code/game/machinery/requests_console.dm +++ b/code/game/machinery/requests_console.dm @@ -129,7 +129,7 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) LAZYADD(GLOB.reta_consoles_by_origin[dept_key], src) if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() /obj/machinery/requests_console/Destroy() QDEL_LIST(messages) diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index aa3c64800dc..c0cdcdd9aaa 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -408,7 +408,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/status_display/evac, 32) )) RegisterSignal(SSsecurity_level, COMSIG_SECURITY_LEVEL_CHANGED, PROC_REF(on_sec_level_change)) if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() /obj/machinery/status_display/evac/Destroy() SSradio.remove_object(src,frequency) @@ -745,7 +745,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/status_display/ai, 32) // register for radio system to receive AI emote signals SSradio.add_object(src, frequency) if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() /obj/machinery/status_display/ai/Destroy() SSradio.remove_object(src, frequency) diff --git a/code/game/machinery/wall_healer.dm b/code/game/machinery/wall_healer.dm index 2a924a102d0..3bcef5c124a 100644 --- a/code/game/machinery/wall_healer.dm +++ b/code/game/machinery/wall_healer.dm @@ -70,7 +70,7 @@ init_payment() register_context() if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() /obj/machinery/wall_healer/Destroy() clear_using_mob() diff --git a/code/game/objects/effects/posters/poster.dm b/code/game/objects/effects/posters/poster.dm index 19c73e8dcdd..6da53cd2c90 100644 --- a/code/game/objects/effects/posters/poster.dm +++ b/code/game/objects/effects/posters/poster.dm @@ -99,7 +99,7 @@ return ITEM_INTERACT_FAILURE placed_poster.setDir(get_dir(user_drop_location, wall_structure)) - placed_poster.find_and_hang_on_atom() + placed_poster.find_and_mount_on_atom() placed_poster.on_placed_poster(user) return ITEM_INTERACT_SUCCESS diff --git a/code/game/objects/items/devices/radio/intercom.dm b/code/game/objects/items/devices/radio/intercom.dm index 28ff3a13c29..7456828b92e 100644 --- a/code/game/objects/items/devices/radio/intercom.dm +++ b/code/game/objects/items/devices/radio/intercom.dm @@ -39,7 +39,7 @@ return RegisterSignal(current_area, COMSIG_AREA_POWER_CHANGE, PROC_REF(AreaPowerCheck)) if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() GLOB.intercoms_list += src /obj/item/radio/intercom/Destroy() diff --git a/code/game/objects/items/wall_mounted.dm b/code/game/objects/items/wall_mounted.dm index 923787cdd6f..d9fe5df5461 100644 --- a/code/game/objects/items/wall_mounted.dm +++ b/code/game/objects/items/wall_mounted.dm @@ -52,7 +52,7 @@ hanging_object.pixel_x = pixel_shift if(WEST) hanging_object.pixel_x = -pixel_shift - if(!hanging_object.find_and_hang_on_atom()) + if(!hanging_object.find_and_mount_on_atom()) to_chat(user, span_warning("[src] Could not find all to mount on!.")) return after_attach(hanging_object) diff --git a/code/game/objects/structures/detectiveboard.dm b/code/game/objects/structures/detectiveboard.dm index 4dca8b5dd6e..91df15cc443 100644 --- a/code/game/objects/structures/detectiveboard.dm +++ b/code/game/objects/structures/detectiveboard.dm @@ -34,7 +34,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/detectiveboard, 32) if(istype(item, /obj/item/paper) || istype(item, /obj/item/photo)) item.forceMove(src) cases[current_case].notices++ - find_and_hang_on_atom() + find_and_mount_on_atom() register_context() diff --git a/code/game/objects/structures/extinguisher.dm b/code/game/objects/structures/extinguisher.dm index c928f0d21bf..c807bc53df8 100644 --- a/code/game/objects/structures/extinguisher.dm +++ b/code/game/objects/structures/extinguisher.dm @@ -18,7 +18,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/extinguisher_cabinet, 29) opened = TRUE else stored_extinguisher = new /obj/item/extinguisher(src) - find_and_hang_on_atom() + find_and_mount_on_atom() update_appearance(UPDATE_ICON) register_context() diff --git a/code/game/objects/structures/fireaxe.dm b/code/game/objects/structures/fireaxe.dm index b9aab84f6db..70e56c2d501 100644 --- a/code/game/objects/structures/fireaxe.dm +++ b/code/game/objects/structures/fireaxe.dm @@ -39,7 +39,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/fireaxecabinet, 32) held_item = new item_path(src) update_appearance() if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() /obj/structure/fireaxecabinet/Destroy() if(held_item) diff --git a/code/game/objects/structures/mirror.dm b/code/game/objects/structures/mirror.dm index 7a524166cf8..af9bd578bf8 100644 --- a/code/game/objects/structures/mirror.dm +++ b/code/game/objects/structures/mirror.dm @@ -55,7 +55,7 @@ check_reflect_signals = list(SIGNAL_ADDTRAIT(TRAIT_NO_MIRROR_REFLECTION), SIGNAL_REMOVETRAIT(TRAIT_NO_MIRROR_REFLECTION)), \ ) if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() update_choices() register_context() diff --git a/code/game/objects/structures/noticeboard.dm b/code/game/objects/structures/noticeboard.dm index a5bd602952b..ed7ef50f383 100644 --- a/code/game/objects/structures/noticeboard.dm +++ b/code/game/objects/structures/noticeboard.dm @@ -36,7 +36,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/noticeboard, 32) notices++ update_appearance(UPDATE_ICON) if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() //attaching papers!! /obj/structure/noticeboard/attackby(obj/item/O, mob/user, list/modifiers, list/attack_modifiers) diff --git a/code/game/objects/structures/plaques/_plaques.dm b/code/game/objects/structures/plaques/_plaques.dm index 5baf25200fd..de143b17f9f 100644 --- a/code/game/objects/structures/plaques/_plaques.dm +++ b/code/game/objects/structures/plaques/_plaques.dm @@ -20,6 +20,8 @@ /obj/structure/plaque/Initialize(mapload) . = ..() + if(mapload) + find_and_mount_on_atom() register_context() /obj/structure/plaque/add_context(atom/source, list/context, obj/item/held_item, mob/user) diff --git a/code/game/objects/structures/plaques/static_plaques.dm b/code/game/objects/structures/plaques/static_plaques.dm index 62a4f396e09..853437eaf05 100644 --- a/code/game/objects/structures/plaques/static_plaques.dm +++ b/code/game/objects/structures/plaques/static_plaques.dm @@ -9,6 +9,13 @@ SET_PLANE_IMPLICIT(src, FLOOR_PLANE) layer = HIGH_TURF_LAYER +/obj/structure/plaque/static_plaque/get_moutable_objects() + return list() + +/obj/structure/plaque/static_plaque/find_and_mount_on_atom(mark_for_late_init, late_init) + if(isProbablyWallMounted(src)) + return ..() + /obj/structure/plaque/static_plaque/atmos name = "\improper FEA Atmospherics Division plaque" desc = "This plaque commemorates the fall of the Atmos FEA division. For all the charred, dizzy, and brittle men who have died in its hands." diff --git a/code/game/objects/structures/secure_safe.dm b/code/game/objects/structures/secure_safe.dm index d7bc88a5ea5..8642e6febe8 100644 --- a/code/game/objects/structures/secure_safe.dm +++ b/code/game/objects/structures/secure_safe.dm @@ -107,10 +107,10 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/secure_safe, 32) AddComponent(/datum/component/lockable_storage, stored_lock_code) if(mapload) PopulateContents() - find_and_hang_on_atom() + find_and_mount_on_atom() RegisterSignal(src, COMSIG_LOCKABLE_STORAGE_SET_CODE, PROC_REF(update_lock_code)) -/obj/structure/secure_safe/find_and_hang_on_atom(mark_for_late_init = FALSE, late_init = FALSE) +/obj/structure/secure_safe/find_and_mount_on_atom(mark_for_late_init, late_init) if(!density) return ..() diff --git a/code/game/objects/structures/signs/_signs.dm b/code/game/objects/structures/signs/_signs.dm index f0d517b733c..1c7afa414a9 100644 --- a/code/game/objects/structures/signs/_signs.dm +++ b/code/game/objects/structures/signs/_signs.dm @@ -23,11 +23,11 @@ /obj/structure/sign/Initialize(mapload) . = ..() register_context() - if(mapload && !find_and_hang_on_atom(mark_for_late_init = TRUE)) + if(mapload && !find_and_mount_on_atom(mark_for_late_init = TRUE)) return INITIALIZE_HINT_LATELOAD /obj/structure/sign/LateInitialize() - find_and_hang_on_atom(late_init = TRUE) + find_and_mount_on_atom(late_init = TRUE) /obj/structure/sign/add_context(atom/source, list/context, obj/item/held_item, mob/user) . = ..() @@ -220,7 +220,7 @@ playsound(target_turf, 'sound/items/deconstruct.ogg', 50, TRUE) placed_sign.update_integrity(get_integrity()) placed_sign.setDir(dir) - placed_sign.find_and_hang_on_atom() + placed_sign.find_and_mount_on_atom() qdel(src) return ITEM_INTERACT_SUCCESS diff --git a/code/game/objects/structures/water_structures/urinal.dm b/code/game/objects/structures/water_structures/urinal.dm index 467acd2c30a..485fe6fb3f4 100644 --- a/code/game/objects/structures/water_structures/urinal.dm +++ b/code/game/objects/structures/water_structures/urinal.dm @@ -16,7 +16,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/urinal, 32) . = ..() if(mapload) hidden_item = new /obj/item/food/urinalcake(src) - find_and_hang_on_atom() + find_and_mount_on_atom() /obj/structure/urinal/Exited(atom/movable/gone, direction) . = ..() diff --git a/code/modules/art/paintings.dm b/code/modules/art/paintings.dm index 9c99f49a6df..8515b179cb4 100644 --- a/code/modules/art/paintings.dm +++ b/code/modules/art/paintings.dm @@ -946,11 +946,11 @@ wallframe_type = /obj/item/wallframe/painting/large /obj/structure/sign/painting/large/Initialize(mapload) - . = ..() // Necessary so that the painting is framed correctly by the frame overlay when flipped. ADD_KEEP_TOGETHER(src, INNATE_TRAIT) if(mapload) finalize_size() + return ..() /** * This frame is visually put between two wall turfs and it has an icon that's bigger than 32px, and because @@ -973,6 +973,9 @@ if(EAST) bound_height = 64 +/obj/structure/sign/painting/large/get_turfs_to_mount_on() + return (!pixel_x && !pixel_y) ? list(get_step(src, dir)) : ..() + /obj/structure/sign/painting/large/frame_canvas(mob/living/user, obj/item/canvas/new_canvas) . = ..() if(.) diff --git a/code/modules/atmospherics/machinery/air_alarm/_air_alarm.dm b/code/modules/atmospherics/machinery/air_alarm/_air_alarm.dm index 202ea10402b..f1ce4a22c56 100644 --- a/code/modules/atmospherics/machinery/air_alarm/_air_alarm.dm +++ b/code/modules/atmospherics/machinery/air_alarm/_air_alarm.dm @@ -134,7 +134,7 @@ GLOBAL_LIST_EMPTY_TYPED(air_alarms, /obj/machinery/airalarm) GLOB.air_alarms += src if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() register_context() check_enviroment() diff --git a/code/modules/fishing/fish_mount.dm b/code/modules/fishing/fish_mount.dm index a4edf9f89e5..2363a206548 100644 --- a/code/modules/fishing/fish_mount.dm +++ b/code/modules/fishing/fish_mount.dm @@ -39,7 +39,7 @@ //Mounted fish shouldn't flop. It should also show size and weight to everyone. add_traits(list(TRAIT_STOP_FISH_FLOPPING, TRAIT_EXAMINE_FISH), INNATE_TRAIT) if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() if(!persistence_id) return if(SSfishing.initialized) diff --git a/code/modules/mapfluff/ruins/spaceruin_code/hauntedtradingpost.dm b/code/modules/mapfluff/ruins/spaceruin_code/hauntedtradingpost.dm index 1ffa06bd5ff..915e5ddf00b 100644 --- a/code/modules/mapfluff/ruins/spaceruin_code/hauntedtradingpost.dm +++ b/code/modules/mapfluff/ruins/spaceruin_code/hauntedtradingpost.dm @@ -170,6 +170,9 @@ ) AddElement(/datum/element/connect_loc, loc_connections) +/obj/machinery/button/door/invisible_tripwire/find_and_mount_on_atom(mark_for_late_init, late_init) + return //these exist independently on an turf + /obj/machinery/button/door/invisible_tripwire/post_machine_initialize() . = ..() if(!suicide_pact || isnull(SSqueuelinks.queues[suicide_pact_id])) diff --git a/code/modules/paperwork/ticketmachine.dm b/code/modules/paperwork/ticketmachine.dm index 1b09ff4f3c9..256926e7d52 100644 --- a/code/modules/paperwork/ticketmachine.dm +++ b/code/modules/paperwork/ticketmachine.dm @@ -32,7 +32,7 @@ . = ..() update_appearance() if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() /obj/machinery/ticket_machine/Destroy() for(var/obj/item/ticket_machine_ticket/ticket in tickets) diff --git a/code/modules/power/apc/apc_main.dm b/code/modules/power/apc/apc_main.dm index ff57e01761b..32b4a321f96 100644 --- a/code/modules/power/apc/apc_main.dm +++ b/code/modules/power/apc/apc_main.dm @@ -217,7 +217,7 @@ setDir(dir) if(abs(offset_old) != APC_PIXEL_OFFSET) log_mapping("APC: ([src]) at [AREACOORD(src)] with dir ([dir] | [uppertext(dir2text(dir))]) has pixel_[dir & (WEST|EAST) ? "x" : "y"] value [offset_old] - should be [dir & (SOUTH|EAST) ? "-" : ""][APC_PIXEL_OFFSET]. Use the directional/ helpers!") - find_and_hang_on_atom() + find_and_mount_on_atom() // For apcs created during the round players need to configure them from scratch else opened = APC_COVER_OPENED diff --git a/code/modules/power/lighting/light.dm b/code/modules/power/lighting/light.dm index c929bd5cf57..d1f292f77a1 100644 --- a/code/modules/power/lighting/light.dm +++ b/code/modules/power/lighting/light.dm @@ -84,11 +84,6 @@ ///break if moved, if false also makes it ignore if the wall its on breaks var/break_if_moved = TRUE -/obj/machinery/light/Move() - if(status != LIGHT_BROKEN && break_if_moved) - break_light_tube(TRUE) - return ..() - // create a new lighting fixture /obj/machinery/light/Initialize(mapload) . = ..() @@ -121,9 +116,12 @@ AddElement(/datum/element/atmos_sensitive, mapload) AddElement(/datum/element/contextual_screentip_bare_hands, rmb_text = "Remove bulb") if(mapload) - find_and_hang_on_atom(mark_for_late_init = TRUE) + find_and_mount_on_atom(mark_for_late_init = TRUE) -/obj/machinery/light/find_and_hang_on_atom(mark_for_late_init = FALSE, late_init = FALSE) +/obj/machinery/light/get_turfs_to_mount_on() + return list(get_step(src, dir)) + +/obj/machinery/light/find_and_mount_on_atom(mark_for_late_init, late_init) if(break_if_moved) return ..() @@ -147,6 +145,11 @@ QDEL_NULL(cell) return ..() +/obj/machinery/light/Move() + if(status != LIGHT_BROKEN && break_if_moved) + break_light_tube(TRUE) + return ..() + /obj/machinery/light/Exited(atom/movable/gone, direction) . = ..() if(gone == cell) @@ -753,8 +756,19 @@ nightshift_brightness = 4 fire_brightness = 4.5 -/obj/machinery/light/floor/find_and_hang_on_atom(mark_for_late_init = FALSE, late_init = FALSE) - return //its a floor light not a wall light +/obj/machinery/light/floor/get_turfs_to_mount_on() + return list(get_turf(src)) + +/obj/machinery/light/floor/is_mountable_turf(turf/target) + return !isgroundlessturf(target) + +/obj/machinery/light/floor/get_moutable_objects() + var/static/list/attachables = list( + /obj/structure/thermoplastic, + /obj/structure/lattice/catwalk, + ) + + return attachables /obj/machinery/light/floor/get_light_offset() return list(0, 0) diff --git a/code/modules/power/lighting/light_construct.dm b/code/modules/power/lighting/light_construct.dm index 9ba5ecb3362..cb090f4ac7e 100644 --- a/code/modules/power/lighting/light_construct.dm +++ b/code/modules/power/lighting/light_construct.dm @@ -30,16 +30,19 @@ /obj/structure/light_construct/Initialize(mapload) . = ..() - if(mapload && !find_and_hang_on_atom(mark_for_late_init = TRUE)) + if(mapload && !find_and_mount_on_atom(mark_for_late_init = TRUE)) return INITIALIZE_HINT_LATELOAD /obj/structure/light_construct/LateInitialize() - find_and_hang_on_atom(late_init = TRUE) + find_and_mount_on_atom(late_init = TRUE) /obj/structure/light_construct/Destroy() QDEL_NULL(cell) return ..() +/obj/structure/light_construct/get_turfs_to_mount_on() + return list(get_step(src, dir)) + /obj/structure/light_construct/get_cell() return cell @@ -150,7 +153,7 @@ if("floor") new_light = new /obj/machinery/light/floor/empty(loc) new_light.setDir(dir) - new_light.find_and_hang_on_atom() + new_light.find_and_mount_on_atom() transfer_fingerprints_to(new_light) if(!QDELETED(cell)) new_light.cell = cell diff --git a/code/modules/reagents/reagent_dispenser.dm b/code/modules/reagents/reagent_dispenser.dm index 8826ca897de..b07f7fc2629 100644 --- a/code/modules/reagents/reagent_dispenser.dm +++ b/code/modules/reagents/reagent_dispenser.dm @@ -370,7 +370,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/reagent_dispensers/wall/peppertank, 3 if(prob(1)) desc = "IT'S PEPPER TIME, BITCH!" if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() /obj/structure/reagent_dispensers/water_cooler name = "water cooler" @@ -629,7 +629,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/reagent_dispensers/wall/virusfood, 30 /obj/structure/reagent_dispensers/wall/virusfood/Initialize(mapload) . = ..() if(mapload) - find_and_hang_on_atom() + find_and_mount_on_atom() /obj/structure/reagent_dispensers/cooking_oil name = "vat of cooking oil" diff --git a/code/modules/security_levels/keycard_authentication.dm b/code/modules/security_levels/keycard_authentication.dm index c119ec90334..78b271bc55b 100644 --- a/code/modules/security_levels/keycard_authentication.dm +++ b/code/modules/security_levels/keycard_authentication.dm @@ -28,6 +28,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) @@ -182,11 +184,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(silent = FALSE) // BUBBER EDIT CHANGE - Silent Emergency Access for(var/area/station/maintenance/area in GLOB.areas) diff --git a/code/modules/unit_tests/wallmount.dm b/code/modules/unit_tests/wallmount.dm index b9b72c65345..92a071415e2 100644 --- a/code/modules/unit_tests/wallmount.dm +++ b/code/modules/unit_tests/wallmount.dm @@ -2,10 +2,28 @@ /datum/unit_test/wallmount /datum/unit_test/wallmount/Run() + //Test 1 light must priotize wall and not table var/obj/structure/table/test_table = EASY_ALLOCATE() var/obj/machinery/light/directional/south/test_light = EASY_ALLOCATE() - test_light.find_and_hang_on_atom() + test_light.find_and_mount_on_atom() var/datum/component/atom_mounted/wallmount_component = test_light.GetComponent(/datum/component/atom_mounted) - TEST_ASSERT_NOTNULL(wallmount_component, "Wall mount component was not added to the light!") - TEST_ASSERT_NOTEQUAL(wallmount_component.hanging_support_atom, test_table, "Wall mount component was mounted on the table rather than the wall!") + TEST_ASSERT_NOTNULL(wallmount_component, "[test_light.type] failed to mount") + TEST_ASSERT_NOTEQUAL(wallmount_component.hanging_support_atom, test_table, "[test_light.type] failed to mount on wall!") + + //Test 2 button must mount on table not wall + var/obj/machinery/button/test_button = EASY_ALLOCATE() + test_button.find_and_mount_on_atom() + + wallmount_component = test_button.GetComponent(/datum/component/atom_mounted) + TEST_ASSERT_NOTNULL(wallmount_component, "[test_button.type] 0 offsets failed to mount!") + TEST_ASSERT_EQUAL(wallmount_component.hanging_support_atom, test_table, "[test_button.type] 0 offsets failed to mount on table!") + + //Test 3 button must mount on wall not table because it now uses offsets + test_button = allocate(/obj/machinery/button, run_loc_floor_top_right) + test_button.pixel_y = 24 + test_button.find_and_mount_on_atom() + + wallmount_component = test_button.GetComponent(/datum/component/atom_mounted) + TEST_ASSERT_NOTNULL(wallmount_component, "[test_button.type] 24y offsets failed to mount!") + TEST_ASSERT(isindestructiblewall(wallmount_component.hanging_support_atom), "[test_button.type] 24y offsets failed to mount on wall!") diff --git a/tgstation.dme b/tgstation.dme index 0bec6285909..62c34b564b6 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -1243,6 +1243,7 @@ #include "code\datums\components\areabound.dm" #include "code\datums\components\armor_plate.dm" #include "code\datums\components\atmos_reaction_recorder.dm" +#include "code\datums\components\atom_mounted.dm" #include "code\datums\components\aura_healing.dm" #include "code\datums\components\bakeable.dm" #include "code\datums\components\banned_from_space.dm" @@ -1497,7 +1498,6 @@ #include "code\datums\components\usb_port.dm" #include "code\datums\components\vacuum.dm" #include "code\datums\components\vision_hurting.dm" -#include "code\datums\components\wall_mounted.dm" #include "code\datums\components\wearertargeting.dm" #include "code\datums\components\weatherannouncer.dm" #include "code\datums\components\wet_floor.dm"