General maintenance for wall mounts (#93534)

## About The Pull Request
- Fixes #93392
- Replaces all custom callbacks with call to `deconstruct()`. The
callbacks weren't necessary as it did the same thing as `deconstruct()`
but in an round about way
- Removed duplicate `Initialize()` procs and the params `building` &
`ndir` from all wall mounts. Makes everything cleaner

## Changelog
🆑
fix: wall mounts placed by player now falls off when the wall they are
mounted on is destroyed
code: cleaned up wall mount code
/🆑
This commit is contained in:
SyncIt21
2025-10-23 17:26:19 +02:00
committed by GitHub
parent d2a9f9b191
commit 9740c687de
39 changed files with 173 additions and 223 deletions
@@ -28,24 +28,27 @@
icon_state = "intercom_prison"
icon_off = "intercom_prison-p"
/obj/item/radio/intercom/prison/Initialize(mapload, ndir, building)
/obj/item/radio/intercom/prison/Initialize(mapload)
. = ..()
wires?.cut(WIRE_TX)
/obj/item/radio/intercom/Initialize(mapload, ndir, building)
/obj/item/radio/intercom/Initialize(mapload)
. = ..()
var/area/current_area = get_area(src)
if(!current_area)
return
RegisterSignal(current_area, COMSIG_AREA_POWER_CHANGE, PROC_REF(AreaPowerCheck))
if(mapload)
find_and_hang_on_wall()
GLOB.intercoms_list += src
/obj/item/radio/intercom/find_and_hang_on_wall()
if(!unscrewed)
find_and_hang_on_wall(directional = TRUE, \
custom_drop_callback = CALLBACK(src, PROC_REF(knock_down)))
return ..()
/obj/item/radio/intercom/Destroy()
. = ..()
GLOB.intercoms_list -= src
return ..()
/obj/item/radio/intercom/examine(mob/user)
. = ..()
@@ -87,7 +90,7 @@
if(tool.use_tool(src, user, 80))
user.visible_message(span_notice("[user] unsecures [src]!"), span_notice("You detach [src] from the wall."))
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
knock_down()
deconstruct(TRUE)
/**
* Override attack_tk_grab instead of attack_tk because we actually want attack_tk's
@@ -187,9 +190,8 @@
/**
* Called by the wall mount component and reused during the tool deconstruction proc.
*/
/obj/item/radio/intercom/proc/knock_down()
/obj/item/radio/intercom/atom_deconstruct(disassembled)
new/obj/item/wallframe/intercom(get_turf(src))
qdel(src)
//Created through the autolathe or through deconstructing intercoms. Can be applied to wall to make a new intercom on it!
/obj/item/wallframe/intercom
@@ -209,7 +211,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/item/radio/intercom, 27)
anonymize = TRUE
freqlock = RADIO_FREQENCY_EMAGGABLE_LOCK
/obj/item/radio/intercom/chapel/Initialize(mapload, ndir, building)
/obj/item/radio/intercom/chapel/Initialize(mapload)
. = ..()
set_frequency(1481)
set_broadcasting(TRUE)
+2 -1
View File
@@ -40,7 +40,7 @@
span_hear("You hear clicking."))
var/floor_to_wall = get_dir(user, on_wall)
var/obj/hanging_object = new result_path(get_turf(user), floor_to_wall, TRUE)
var/obj/hanging_object = new result_path(get_turf(user))
hanging_object.setDir(floor_to_wall)
if(pixel_shift)
switch(floor_to_wall)
@@ -52,6 +52,7 @@
hanging_object.pixel_x = pixel_shift
if(WEST)
hanging_object.pixel_x = -pixel_shift
hanging_object.find_and_hang_on_wall()
after_attach(hanging_object)
qdel(src)