diff --git a/code/game/machinery/PDApainter.dm b/code/game/machinery/PDApainter.dm index c4cf5bb125a..679a3182a57 100644 --- a/code/game/machinery/PDApainter.dm +++ b/code/game/machinery/PDApainter.dm @@ -67,7 +67,7 @@ QDEL_NULL(stored_id_card) return ..() -/obj/machinery/pdapainter/on_deconstruction() +/obj/machinery/pdapainter/on_deconstruction(disassembled) // Don't use ejection procs as we're gonna be destroyed anyway, so no need to update icons or anything. if(stored_pda) stored_pda.forceMove(loc) diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index 65c47e42801..0a915f57571 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -198,9 +198,8 @@ end_processing() clear_components() - dump_contents() - unset_static_power() + return ..() /** @@ -818,11 +817,15 @@ deconstruct(TRUE) /obj/machinery/deconstruct(disassembled = TRUE) + SHOULD_NOT_OVERRIDE(TRUE) + if(obj_flags & NO_DECONSTRUCTION) + dump_contents() //drop everything inside us return ..() //Just delete us, no need to call anything else. - on_deconstruction() + on_deconstruction(disassembled) if(!LAZYLEN(component_parts)) + dump_contents() //drop everything inside us return ..() //we don't have any parts. spawn_frame(disassembled) @@ -841,8 +844,12 @@ continue var/obj/item/stack/stack_path = component new stack_path(loc, board.req_components[component]) - LAZYCLEARLIST(component_parts) + + //drop everything inside us. we do this last to give machines a chance + //to handle their contents before we dump them + dump_contents() + return ..() /** @@ -1128,8 +1135,14 @@ /obj/machinery/proc/on_construction(mob/user) return -//called on deconstruction before the final deletion -/obj/machinery/proc/on_deconstruction() +/** + * called on deconstruction before the final deletion + * Arguments + * + * * disassembled - if TRUE means we used tools to deconstruct it, FALSE means it got destroyed by other means + */ +/obj/machinery/proc/on_deconstruction(disassembled) + PROTECTED_PROC(TRUE) return /obj/machinery/proc/can_be_overridden() diff --git a/code/game/machinery/barsigns.dm b/code/game/machinery/barsigns.dm index 593a58d165c..faa29c2673e 100644 --- a/code/game/machinery/barsigns.dm +++ b/code/game/machinery/barsigns.dm @@ -91,15 +91,12 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/barsign, 32) if((machine_stat & BROKEN) && !(obj_flags & NO_DECONSTRUCTION)) set_sign(new /datum/barsign/hiddensigns/signoff) -/obj/machinery/barsign/deconstruct(disassembled = TRUE) - if(!(obj_flags & NO_DECONSTRUCTION)) - if(disassembled) - new disassemble_result(drop_location()) - else - new /obj/item/stack/sheet/iron(drop_location(), 2) - new /obj/item/stack/cable_coil(drop_location(), 2) - - qdel(src) +/obj/machinery/barsign/on_deconstruction(disassembled) + if(disassembled) + new disassemble_result(drop_location()) + else + new /obj/item/stack/sheet/iron(drop_location(), 2) + new /obj/item/stack/cable_coil(drop_location(), 2) /obj/machinery/barsign/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0) switch(damage_type) diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 3f7ee067459..257cce51ab8 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -443,21 +443,20 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/camera/xray, 0) triggerCameraAlarm() toggle_cam(null, 0) -/obj/machinery/camera/deconstruct(disassembled = TRUE) - if(!(obj_flags & NO_DECONSTRUCTION)) - if(disassembled) - var/obj/structure/camera_assembly/assembly = assembly_ref?.resolve() - if(!assembly) - assembly = new() - assembly.forceMove(drop_location()) - assembly.state = 1 - assembly.setDir(dir) - assembly_ref = null - else - var/obj/item/I = new /obj/item/wallframe/camera (loc) - I.update_integrity(I.max_integrity * 0.5) - new /obj/item/stack/cable_coil(loc, 2) - qdel(src) +/obj/machinery/camera/on_deconstruction(disassembled) + if(disassembled) + var/obj/structure/camera_assembly/assembly = assembly_ref?.resolve() + if(!assembly) + assembly = new() + assembly.forceMove(drop_location()) + assembly.state = 1 + assembly.setDir(dir) + assembly_ref = null + return + + var/obj/item/I = new /obj/item/wallframe/camera (loc) + I.update_integrity(I.max_integrity * 0.5) + new /obj/item/stack/cable_coil(loc, 2) /obj/machinery/camera/update_icon_state() //TO-DO: Make panel open states, xray camera, and indicator lights overlays instead. var/xray_module diff --git a/code/game/machinery/cell_charger.dm b/code/game/machinery/cell_charger.dm index b217db9707f..7cc10dcb840 100644 --- a/code/game/machinery/cell_charger.dm +++ b/code/game/machinery/cell_charger.dm @@ -72,10 +72,9 @@ return return ..() -/obj/machinery/cell_charger/deconstruct() +/obj/machinery/cell_charger/on_deconstruction(disassembled) if(charging) charging.forceMove(drop_location()) - return ..() /obj/machinery/cell_charger/Destroy() QDEL_NULL(charging) diff --git a/code/game/machinery/computer/_computer.dm b/code/game/machinery/computer/_computer.dm index d9cc62c6420..1323fbbb862 100644 --- a/code/game/machinery/computer/_computer.dm +++ b/code/game/machinery/computer/_computer.dm @@ -98,33 +98,25 @@ if(prob(10)) atom_break(ENERGY) -/obj/machinery/computer/deconstruct(disassembled = TRUE, mob/user) - on_deconstruction() - if(!(obj_flags & NO_DECONSTRUCTION)) - if(circuit) //no circuit, no computer frame - var/obj/structure/frame/computer/A = new /obj/structure/frame/computer(src.loc) - A.setDir(dir) - A.circuit = circuit - // Circuit removal code is handled in /obj/machinery/Exited() - circuit.forceMove(A) - A.set_anchored(TRUE) - if(machine_stat & BROKEN) - if(user) - to_chat(user, span_notice("The broken glass falls out.")) - else - playsound(src, 'sound/effects/hit_on_shattered_glass.ogg', 70, TRUE) - new /obj/item/shard(drop_location()) - new /obj/item/shard(drop_location()) - A.state = 3 - A.icon_state = "3" - else - if(user) - to_chat(user, span_notice("You disconnect the monitor.")) - A.state = 4 - A.icon_state = "4" - for(var/obj/C in src) - C.forceMove(loc) - qdel(src) +/obj/machinery/computer/spawn_frame(disassembled) + if(QDELETED(circuit)) //no circuit, no computer frame + return + + var/obj/structure/frame/computer/A = new /obj/structure/frame/computer(src.loc) + A.setDir(dir) + A.circuit = circuit + // Circuit removal code is handled in /obj/machinery/Exited() + circuit.forceMove(A) + A.set_anchored(TRUE) + if(machine_stat & BROKEN) + playsound(src, 'sound/effects/hit_on_shattered_glass.ogg', 70, TRUE) + new /obj/item/shard(drop_location()) + new /obj/item/shard(drop_location()) + A.state = 3 + A.icon_state = "3" + else + A.state = 4 + A.icon_state = "4" /obj/machinery/computer/AltClick(mob/user) . = ..() diff --git a/code/game/machinery/computer/aifixer.dm b/code/game/machinery/computer/aifixer.dm index 2ddbb3baadd..74632b926b1 100644 --- a/code/game/machinery/computer/aifixer.dm +++ b/code/game/machinery/computer/aifixer.dm @@ -138,6 +138,6 @@ QDEL_NULL(occupier) return ..() -/obj/machinery/computer/aifixer/on_deconstruction() +/obj/machinery/computer/aifixer/on_deconstruction(disassembled) if(occupier) QDEL_NULL(occupier) diff --git a/code/game/machinery/computer/prisoner/_prisoner.dm b/code/game/machinery/computer/prisoner/_prisoner.dm index 5785734a437..f1ce2555936 100644 --- a/code/game/machinery/computer/prisoner/_prisoner.dm +++ b/code/game/machinery/computer/prisoner/_prisoner.dm @@ -3,9 +3,8 @@ /// ID card currently inserted into the computer. VAR_FINAL/obj/item/card/id/advanced/prisoner/contained_id -/obj/machinery/computer/prisoner/deconstruct(disassembled, mob/user) +/obj/machinery/computer/prisoner/on_deconstruction(disassembled) contained_id?.forceMove(drop_location()) - return ..() /obj/machinery/computer/prisoner/Destroy() QDEL_NULL(contained_id) diff --git a/code/game/machinery/computer/telescreen.dm b/code/game/machinery/computer/telescreen.dm index 90e53c2f452..7b1e62e2cb7 100644 --- a/code/game/machinery/computer/telescreen.dm +++ b/code/game/machinery/computer/telescreen.dm @@ -21,10 +21,8 @@ result_path = /obj/machinery/computer/security/telescreen pixel_shift = 32 -/obj/machinery/computer/security/telescreen/deconstruct(disassembled = TRUE) - if(!(obj_flags & NO_DECONSTRUCTION)) - new frame_type(loc) - qdel(src) +/obj/machinery/computer/security/telescreen/on_deconstruction(disassembled) + new frame_type(loc) /obj/machinery/computer/security/telescreen/update_icon_state() icon_state = initial(icon_state) diff --git a/code/game/machinery/digital_clock.dm b/code/game/machinery/digital_clock.dm index a0dc87dba08..febc6a4b091 100644 --- a/code/game/machinery/digital_clock.dm +++ b/code/game/machinery/digital_clock.dm @@ -69,16 +69,13 @@ . = ..() emag_act() -/obj/machinery/digital_clock/deconstruct(disassembled = TRUE) - if(obj_flags & NO_DECONSTRUCTION) - return +/obj/machinery/digital_clock/on_deconstruction(disassembled) if(disassembled) new /obj/item/wallframe/digital_clock(drop_location()) else new /obj/item/stack/sheet/iron(drop_location(), 2) new /obj/item/shard(drop_location()) new /obj/item/shard(drop_location()) - qdel(src) /obj/machinery/digital_clock/Initialize(mapload) . = ..() diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index d6e10006673..abe2fc0c736 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -1511,38 +1511,32 @@ assembly.update_name() assembly.update_appearance() -/obj/machinery/door/airlock/deconstruct(disassembled = TRUE, mob/user) - if(!(obj_flags & NO_DECONSTRUCTION)) - var/obj/structure/door_assembly/A - if(assemblytype) - A = new assemblytype(loc) - else - A = new /obj/structure/door_assembly(loc) - //If you come across a null assemblytype, it will produce the default assembly instead of disintegrating. - prepare_deconstruction_assembly(A) +/obj/machinery/door/airlock/on_deconstruction(disassembled) + var/obj/structure/door_assembly/A + if(assemblytype) + A = new assemblytype(loc) + else + A = new /obj/structure/door_assembly(loc) + //If you come across a null assemblytype, it will produce the default assembly instead of disintegrating. + prepare_deconstruction_assembly(A) - if(!disassembled) - A?.update_integrity(A.max_integrity * 0.5) - else if(obj_flags & EMAGGED) - if(user) - to_chat(user, span_warning("You discard the damaged electronics.")) - else - if(user) - to_chat(user, span_notice("You remove the airlock electronics.")) - - var/obj/item/electronics/airlock/ae - if(!electronics) - ae = new/obj/item/electronics/airlock(loc) - if(length(req_one_access)) - ae.one_access = 1 - ae.accesses = req_one_access - else - ae.accesses = req_access + if(!disassembled) + A?.update_integrity(A.max_integrity * 0.5) + else if(obj_flags & EMAGGED) + //no electronics nothing + else + var/obj/item/electronics/airlock/ae + if(!electronics) + ae = new/obj/item/electronics/airlock(loc) + if(length(req_one_access)) + ae.one_access = 1 + ae.accesses = req_one_access else - ae = electronics - electronics = null - ae.forceMove(drop_location()) - qdel(src) + ae.accesses = req_access + else + ae = electronics + electronics = null + ae.forceMove(drop_location()) /obj/machinery/door/airlock/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd) switch(the_rcd.mode) diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 5521bd6a25c..6d3f93d0001 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -658,20 +658,18 @@ if(old_activity != active) //Something changed while we were sleeping correct_state() //So we should re-evaluate our state -/obj/machinery/door/firedoor/deconstruct(disassembled = TRUE) - if(!(obj_flags & NO_DECONSTRUCTION)) - var/turf/targetloc = get_turf(src) - if(disassembled || prob(40)) - var/obj/structure/firelock_frame/unbuilt_lock = new assemblytype(targetloc) - if(disassembled) - unbuilt_lock.constructionStep = CONSTRUCTION_PANEL_OPEN - else - unbuilt_lock.constructionStep = CONSTRUCTION_NO_CIRCUIT - unbuilt_lock.update_integrity(unbuilt_lock.max_integrity * 0.5) - unbuilt_lock.update_appearance() +/obj/machinery/door/firedoor/on_deconstruction(disassembled) + var/turf/targetloc = get_turf(src) + if(disassembled || prob(40)) + var/obj/structure/firelock_frame/unbuilt_lock = new assemblytype(targetloc) + if(disassembled) + unbuilt_lock.constructionStep = CONSTRUCTION_PANEL_OPEN else - new /obj/item/electronics/firelock (targetloc) - qdel(src) + unbuilt_lock.constructionStep = CONSTRUCTION_NO_CIRCUIT + unbuilt_lock.update_integrity(unbuilt_lock.max_integrity * 0.5) + unbuilt_lock.update_appearance() + else + new /obj/item/electronics/firelock (targetloc) /obj/machinery/door/firedoor/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change = TRUE) . = ..() diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 9179dbaf94f..1b690ee4f3b 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -301,15 +301,16 @@ playsound(src, 'sound/items/welder.ogg', 100, TRUE) -/obj/machinery/door/window/deconstruct(disassembled = TRUE) - if(!(obj_flags & NO_DECONSTRUCTION) && !disassembled) - for(var/i in 1 to shards) - drop_debris(new /obj/item/shard(src)) - if(rods) - drop_debris(new /obj/item/stack/rods(src, rods)) - if(cable) - drop_debris(new /obj/item/stack/cable_coil(src, cable)) - qdel(src) +/obj/machinery/door/window/on_deconstruction(disassembled) + if(disassembled) + return + + for(var/i in 1 to shards) + drop_debris(new /obj/item/shard(src)) + if(rods) + drop_debris(new /obj/item/stack/rods(src, rods)) + if(cable) + drop_debris(new /obj/item/stack/cable_coil(src, cable)) /obj/machinery/door/window/proc/drop_debris(obj/item/debris) debris.forceMove(loc) diff --git a/code/game/machinery/droneDispenser.dm b/code/game/machinery/droneDispenser.dm index 1d428e7547e..91e7d1a3d48 100644 --- a/code/game/machinery/droneDispenser.dm +++ b/code/game/machinery/droneDispenser.dm @@ -260,11 +260,6 @@ if(break_sound) playsound(src, break_sound, 50, TRUE) -/obj/machinery/drone_dispenser/deconstruct(disassembled = TRUE) - if(!(obj_flags & NO_DECONSTRUCTION)) - new /obj/item/stack/sheet/iron(loc, 5) - qdel(src) - #undef DRONE_PRODUCTION #undef DRONE_RECHARGING #undef DRONE_READY diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm index 1f6b4c7def0..bec9c50bdab 100644 --- a/code/game/machinery/firealarm.dm +++ b/code/game/machinery/firealarm.dm @@ -440,16 +440,14 @@ return return ..() -/obj/machinery/firealarm/deconstruct(disassembled = TRUE) - if(!(obj_flags & NO_DECONSTRUCTION)) - new /obj/item/stack/sheet/iron(loc, 1) - if(buildstage > FIRE_ALARM_BUILD_NO_CIRCUIT) - var/obj/item/item = new /obj/item/electronics/firealarm(loc) - if(!disassembled) - item.update_integrity(item.max_integrity * 0.5) - if(buildstage > FIRE_ALARM_BUILD_NO_WIRES) - new /obj/item/stack/cable_coil(loc, 3) - qdel(src) +/obj/machinery/firealarm/on_deconstruction(disassembled) + new /obj/item/stack/sheet/iron(loc, 1) + if(buildstage > FIRE_ALARM_BUILD_NO_CIRCUIT) + var/obj/item/item = new /obj/item/electronics/firealarm(loc) + if(!disassembled) + item.update_integrity(item.max_integrity * 0.5) + if(buildstage > FIRE_ALARM_BUILD_NO_WIRES) + new /obj/item/stack/cable_coil(loc, 3) // Allows users to examine the state of the thermal sensor /obj/machinery/firealarm/examine(mob/user) diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm index efe28051a21..678b2c65509 100644 --- a/code/game/machinery/flasher.dm +++ b/code/game/machinery/flasher.dm @@ -144,18 +144,16 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/flasher, 26) bulb.burn_out() power_change() -/obj/machinery/flasher/deconstruct(disassembled = TRUE) - if(!(obj_flags & NO_DECONSTRUCTION)) - if(bulb) - bulb.forceMove(loc) - if(disassembled) - var/obj/item/wallframe/flasher/flasher_obj = new(get_turf(src)) - transfer_fingerprints_to(flasher_obj) - flasher_obj.id = id - playsound(loc, 'sound/items/deconstruct.ogg', 50, TRUE) - else - new /obj/item/stack/sheet/iron (loc, 2) - qdel(src) +/obj/machinery/flasher/on_deconstruction(disassembled) + if(bulb) + bulb.forceMove(loc) + if(disassembled) + var/obj/item/wallframe/flasher/flasher_obj = new(get_turf(src)) + transfer_fingerprints_to(flasher_obj) + flasher_obj.id = id + playsound(loc, 'sound/items/deconstruct.ogg', 50, TRUE) + else + new /obj/item/stack/sheet/iron (loc, 2) /obj/machinery/flasher/portable //Portable version of the flasher. Only flashes when anchored name = "portable flasher" diff --git a/code/game/machinery/igniter.dm b/code/game/machinery/igniter.dm index a28f855862a..75d0566e42c 100644 --- a/code/game/machinery/igniter.dm +++ b/code/game/machinery/igniter.dm @@ -55,11 +55,9 @@ deconstruct(TRUE) return ITEM_INTERACT_SUCCESS -/obj/machinery/igniter/deconstruct(disassembled) - if(!(obj_flags & NO_DECONSTRUCTION)) - new /obj/item/stack/sheet/iron(loc, 5) - new /obj/item/assembly/igniter(loc) - return ..() +/obj/machinery/igniter/on_deconstruction(disassembled) + new /obj/item/stack/sheet/iron(loc, 5) + new /obj/item/assembly/igniter(loc) /obj/machinery/igniter/multitool_act(mob/living/user, obj/item/tool) var/change_id = tgui_input_number(user, "Set the igniter controller's ID", "Igniter ID", id, 100) @@ -200,10 +198,8 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/sparker, 26) deconstruct(TRUE) return ITEM_INTERACT_SUCCESS -/obj/machinery/sparker/deconstruct(disassembled) - if(!(obj_flags & NO_DECONSTRUCTION)) - new /obj/item/wallframe/sparker(loc) - return ..() +/obj/machinery/sparker/on_deconstruction(disassembled) + new /obj/item/wallframe/sparker(loc) /obj/machinery/sparker/multitool_act(mob/living/user, obj/item/tool) var/change_id = tgui_input_number(user, "Set the sparker controller's ID", "Sparker ID", id, 100) diff --git a/code/game/machinery/incident_display.dm b/code/game/machinery/incident_display.dm index 63418e4457e..fcdfecf6a31 100644 --- a/code/game/machinery/incident_display.dm +++ b/code/game/machinery/incident_display.dm @@ -164,16 +164,11 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/incident_display/tram, 32) delam_record = rand(1,99) update_appearance() -/obj/machinery/incident_display/deconstruct() - if(obj_flags & NO_DECONSTRUCTION) - return - +/obj/machinery/incident_display/on_deconstruction(disassembled) new /obj/item/stack/sheet/mineral/titanium(drop_location(), 2) new /obj/item/shard(drop_location()) new /obj/item/shard(drop_location()) - qdel(src) - /obj/machinery/incident_display/proc/update_delam_count(new_count, record) delam_record = record last_delam = min(new_count, 199) diff --git a/code/game/machinery/iv_drip.dm b/code/game/machinery/iv_drip.dm index 25e963ad6d5..6244dcdd2db 100644 --- a/code/game/machinery/iv_drip.dm +++ b/code/game/machinery/iv_drip.dm @@ -217,10 +217,8 @@ return ..() set_transfer_rate(transfer_rate > MIN_IV_TRANSFER_RATE ? MIN_IV_TRANSFER_RATE : MAX_IV_TRANSFER_RATE) -/obj/machinery/iv_drip/deconstruct(disassembled = TRUE) - if(!(obj_flags & NO_DECONSTRUCTION)) - new /obj/item/stack/sheet/iron(loc) - qdel(src) +/obj/machinery/iv_drip/on_deconstruction(disassembled = TRUE) + new /obj/item/stack/sheet/iron(loc) /obj/machinery/iv_drip/process(seconds_per_tick) if(!attached) diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm index a4646136aaf..f9075b4318f 100644 --- a/code/game/machinery/lightswitch.dm +++ b/code/game/machinery/lightswitch.dm @@ -107,10 +107,8 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/light_switch, 26) if(!(machine_stat & (BROKEN|NOPOWER))) power_change() -/obj/machinery/light_switch/deconstruct(disassembled = TRUE) - if(!(obj_flags & NO_DECONSTRUCTION)) - new /obj/item/wallframe/light_switch(loc) - qdel(src) +/obj/machinery/light_switch/on_deconstruction(disassembled) + new /obj/item/wallframe/light_switch(loc) /obj/item/wallframe/light_switch name = "light switch" diff --git a/code/game/machinery/limbgrower.dm b/code/game/machinery/limbgrower.dm index 0e81f839838..197feb4118d 100644 --- a/code/game/machinery/limbgrower.dm +++ b/code/game/machinery/limbgrower.dm @@ -116,7 +116,7 @@ return data -/obj/machinery/limbgrower/on_deconstruction() +/obj/machinery/limbgrower/on_deconstruction(disassembled) for(var/obj/item/reagent_containers/cup/our_beaker in component_parts) reagents.trans_to(our_beaker, our_beaker.reagents.maximum_volume) return ..() diff --git a/code/game/machinery/newscaster/newscaster_machine.dm b/code/game/machinery/newscaster/newscaster_machine.dm index e667fe5b96f..7f3d8ea806f 100644 --- a/code/game/machinery/newscaster/newscaster_machine.dm +++ b/code/game/machinery/newscaster/newscaster_machine.dm @@ -534,12 +534,10 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/newscaster, 30) playsound(src.loc, 'sound/items/welder.ogg', 100, TRUE) -/obj/machinery/newscaster/deconstruct(disassembled = TRUE) - if(!(obj_flags & NO_DECONSTRUCTION)) - new /obj/item/stack/sheet/iron(loc, 2) - new /obj/item/shard(loc) - new /obj/item/shard(loc) - qdel(src) +/obj/machinery/newscaster/on_deconstruction(disassembled) + new /obj/item/stack/sheet/iron(loc, 2) + new /obj/item/shard(loc) + new /obj/item/shard(loc) /obj/machinery/newscaster/atom_break(damage_flag) . = ..() diff --git a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm index 76b1b73ba53..d0c0744f19e 100644 --- a/code/game/machinery/porta_turret/portable_turret.dm +++ b/code/game/machinery/porta_turret/portable_turret.dm @@ -402,9 +402,6 @@ DEFINE_BITFIELD(turret_flags, list( /obj/machinery/porta_turret/proc/reset_attacked() turret_flags &= ~TURRET_FLAG_SHOOT_ALL_REACT -/obj/machinery/porta_turret/deconstruct(disassembled = TRUE) - qdel(src) - /obj/machinery/porta_turret/atom_break(damage_flag) . = ..() if(.) diff --git a/code/game/machinery/recycler.dm b/code/game/machinery/recycler.dm index 2ee22338d0e..1014393c008 100644 --- a/code/game/machinery/recycler.dm +++ b/code/game/machinery/recycler.dm @@ -247,7 +247,7 @@ L.Unconscious(100) L.adjustBruteLoss(crush_damage) -/obj/machinery/recycler/on_deconstruction() +/obj/machinery/recycler/on_deconstruction(disassembled) safety_mode = TRUE /obj/machinery/recycler/deathtrap diff --git a/code/game/machinery/requests_console.dm b/code/game/machinery/requests_console.dm index b31b982f911..54bdeb666d9 100644 --- a/code/game/machinery/requests_console.dm +++ b/code/game/machinery/requests_console.dm @@ -394,10 +394,8 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) return return ..() -/obj/machinery/requests_console/deconstruct(disassembled = TRUE) - if(!(obj_flags & NO_DECONSTRUCTION)) - new /obj/item/wallframe/requests_console(loc) - qdel(src) +/obj/machinery/requests_console/on_deconstruction(disassembled) + new /obj/item/wallframe/requests_console(loc) /obj/machinery/requests_console/auto_name // Register an autoname variant and then make the directional helpers before undefing all the magic bits auto_name = TRUE diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm index d5dfc335c7c..6a5b53e2a0b 100644 --- a/code/game/machinery/spaceheater.dm +++ b/code/game/machinery/spaceheater.dm @@ -81,7 +81,7 @@ set_panel_open(TRUE) QDEL_NULL(cell) -/obj/machinery/space_heater/on_deconstruction() +/obj/machinery/space_heater/on_deconstruction(disassembled) if(cell) LAZYADD(component_parts, cell) cell = null diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index 71a327ba85f..c1be0917bf3 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -72,16 +72,13 @@ update_appearance() return TRUE -/obj/machinery/status_display/deconstruct(disassembled = TRUE) - if(obj_flags & NO_DECONSTRUCTION) - return +/obj/machinery/status_display/on_deconstruction(disassembled) if(!disassembled) new /obj/item/stack/sheet/iron(drop_location(), 2) new /obj/item/shard(drop_location()) new /obj/item/shard(drop_location()) else new /obj/item/wallframe/status_display(drop_location()) - qdel(src) /// Immediately change the display to the given picture. /obj/machinery/status_display/proc/set_picture(state) diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index 0bf6bf7872d..b34f7873648 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -307,13 +307,9 @@ storage = null set_occupant(null) -/obj/machinery/suit_storage_unit/deconstruct(disassembled = TRUE) - if(!(obj_flags & NO_DECONSTRUCTION)) - open_machine() - dump_inventory_contents() - if(card_reader_installed) - new /obj/item/stock_parts/card_reader(loc) - return ..() +/obj/machinery/suit_storage_unit/on_deconstruction(disassembled) + if(card_reader_installed) + new /obj/item/stock_parts/card_reader(loc) /obj/machinery/suit_storage_unit/proc/access_check(mob/living/user) if(!isnull(id_card)) diff --git a/code/game/machinery/washing_machine.dm b/code/game/machinery/washing_machine.dm index de83d6d20df..52644b8918b 100644 --- a/code/game/machinery/washing_machine.dm +++ b/code/game/machinery/washing_machine.dm @@ -415,10 +415,8 @@ GLOBAL_LIST_INIT(dye_registry, list( /obj/machinery/washing_machine/attack_ai_secondary(mob/user, modifiers) return attack_hand_secondary(user, modifiers) -/obj/machinery/washing_machine/deconstruct(disassembled = TRUE) - if (!(obj_flags & NO_DECONSTRUCTION)) - new /obj/item/stack/sheet/iron(drop_location(), 2) - qdel(src) +/obj/machinery/washing_machine/on_deconstruction(disassembled) + new /obj/item/stack/sheet/iron(drop_location(), 2) /obj/machinery/washing_machine/open_machine(drop = TRUE, density_to_set = FALSE) . = ..() diff --git a/code/game/objects/items/devices/traitordevices.dm b/code/game/objects/items/devices/traitordevices.dm index 99322597b4b..ce1245098c8 100644 --- a/code/game/objects/items/devices/traitordevices.dm +++ b/code/game/objects/items/devices/traitordevices.dm @@ -410,7 +410,7 @@ effective or pretty fucking useless. balloon_alert(user, "repaired!") -/obj/machinery/porta_turret/syndicate/toolbox/deconstruct(disassembled) +/obj/machinery/porta_turret/syndicate/toolbox/on_deconstruction(disassembled) if(disassembled) var/atom/movable/old_toolbox = toolbox toolbox = null diff --git a/code/game/objects/structures/shower.dm b/code/game/objects/structures/shower.dm index f14c1dfa227..af7fc92c657 100644 --- a/code/game/objects/structures/shower.dm +++ b/code/game/objects/structures/shower.dm @@ -315,11 +315,10 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/shower, (-16)) reagents.remove_any(SHOWER_SPRAY_VOLUME) -/obj/machinery/shower/deconstruct(disassembled = TRUE) +/obj/machinery/shower/on_deconstruction(disassembled = TRUE) new /obj/item/stack/sheet/iron(drop_location(), 2) if(has_water_reclaimer) new /obj/item/stock_parts/water_recycler(drop_location()) - qdel(src) /obj/machinery/shower/proc/check_heat(mob/living/L) var/mob/living/carbon/C = L diff --git a/code/modules/atmospherics/machinery/air_alarm/air_alarm_interact.dm b/code/modules/atmospherics/machinery/air_alarm/air_alarm_interact.dm index 3d93338fbee..f39b2a780d1 100644 --- a/code/modules/atmospherics/machinery/air_alarm/air_alarm_interact.dm +++ b/code/modules/atmospherics/machinery/air_alarm/air_alarm_interact.dm @@ -89,16 +89,14 @@ playsound(src, SFX_SPARKS, 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) return TRUE -/obj/machinery/airalarm/deconstruct(disassembled = TRUE) - if(!(obj_flags & NO_DECONSTRUCTION)) - new /obj/item/stack/sheet/iron(loc, 2) - if((buildstage == AIR_ALARM_BUILD_NO_WIRES) || (buildstage == AIR_ALARM_BUILD_COMPLETE)) - var/obj/item/electronics/airalarm/alarm = new(loc) - if(!disassembled) - alarm.take_damage(alarm.max_integrity * 0.5, sound_effect = FALSE) - if((buildstage == AIR_ALARM_BUILD_COMPLETE)) - new /obj/item/stack/cable_coil(loc, 3) - qdel(src) +/obj/machinery/airalarm/on_deconstruction(disassembled = TRUE) + new /obj/item/stack/sheet/iron(loc, 2) + if((buildstage == AIR_ALARM_BUILD_NO_WIRES) || (buildstage == AIR_ALARM_BUILD_COMPLETE)) + var/obj/item/electronics/airalarm/alarm = new(loc) + if(!disassembled) + alarm.take_damage(alarm.max_integrity * 0.5, sound_effect = FALSE) + if((buildstage == AIR_ALARM_BUILD_COMPLETE)) + new /obj/item/stack/cable_coil(loc, 3) /obj/machinery/airalarm/attackby(obj/item/W, mob/user, params) update_last_used(user) diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm index fe6806c9b58..0429b92377e 100644 --- a/code/modules/atmospherics/machinery/atmosmachinery.dm +++ b/code/modules/atmospherics/machinery/atmosmachinery.dm @@ -468,16 +468,16 @@ * * Called by wrench_act(), create a pipe fitting and remove the pipe */ -/obj/machinery/atmospherics/deconstruct(disassembled = TRUE) - if(!(obj_flags & NO_DECONSTRUCTION)) - if(can_unwrench) - var/obj/item/pipe/stored = new construction_type(loc, null, dir, src, pipe_color) - stored.set_piping_layer(piping_layer) - if(!disassembled) - stored.take_damage(stored.max_integrity * 0.5, sound_effect=FALSE) - transfer_fingerprints_to(stored) - . = stored - ..() +/obj/machinery/atmospherics/on_deconstruction(disassembled = TRUE) + if(!can_unwrench) + return + + var/obj/item/pipe/stored = new construction_type(loc, null, dir, src, pipe_color) + stored.set_piping_layer(piping_layer) + if(!disassembled) + stored.take_damage(stored.max_integrity * 0.5, sound_effect=FALSE) + transfer_fingerprints_to(stored) + . = stored /** * Getter for piping layer shifted, pipe colored overlays diff --git a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm index a4910905049..1816ca19637 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm @@ -157,7 +157,7 @@ return TRUE return ..() -/obj/machinery/atmospherics/components/binary/circulator/on_deconstruction() +/obj/machinery/atmospherics/components/binary/circulator/on_deconstruction(disassembled) if(generator) disconnectFromGenerator() diff --git a/code/modules/atmospherics/machinery/components/components_base.dm b/code/modules/atmospherics/machinery/components/components_base.dm index 1aae85d2a14..931a952658c 100644 --- a/code/modules/atmospherics/machinery/components/components_base.dm +++ b/code/modules/atmospherics/machinery/components/components_base.dm @@ -105,7 +105,7 @@ . = ..() update_parents() -/obj/machinery/atmospherics/components/on_deconstruction() +/obj/machinery/atmospherics/components/on_deconstruction(disassembled) relocate_airs() return ..() @@ -231,7 +231,7 @@ if(!panel_open) balloon_alert(user, "open panel!") return ITEM_INTERACT_SUCCESS - + var/unsafe_wrenching = FALSE var/filled_pipe = FALSE var/datum/gas_mixture/environment_air = loc.return_air() @@ -246,7 +246,7 @@ if(!filled_pipe) default_deconstruction_crowbar(tool) return ITEM_INTERACT_SUCCESS - + to_chat(user, span_notice("You begin to unfasten \the [src]...")) internal_pressure -= environment_air.return_pressure() diff --git a/code/modules/atmospherics/machinery/components/electrolyzer/electrolyzer.dm b/code/modules/atmospherics/machinery/components/electrolyzer/electrolyzer.dm index fef2c072cd8..7cee01e0cf7 100644 --- a/code/modules/atmospherics/machinery/components/electrolyzer/electrolyzer.dm +++ b/code/modules/atmospherics/machinery/components/electrolyzer/electrolyzer.dm @@ -57,7 +57,7 @@ QDEL_NULL(cell) return ..() -/obj/machinery/electrolyzer/on_deconstruction() +/obj/machinery/electrolyzer/on_deconstruction(disassembled) if(cell) LAZYADD(component_parts, cell) cell = null diff --git a/code/modules/atmospherics/machinery/components/fusion/hfr_core.dm b/code/modules/atmospherics/machinery/components/fusion/hfr_core.dm index 6d3d5d31a16..55111e731fc 100644 --- a/code/modules/atmospherics/machinery/components/fusion/hfr_core.dm +++ b/code/modules/atmospherics/machinery/components/fusion/hfr_core.dm @@ -200,7 +200,7 @@ machine_parts = null return..() -/obj/machinery/atmospherics/components/unary/hypertorus/core/on_deconstruction() +/obj/machinery/atmospherics/components/unary/hypertorus/core/on_deconstruction(disassembled) var/turf/local_turf = get_turf(loc) var/datum/gas_mixture/to_release = moderator_internal || internal_fusion if(to_release == moderator_internal) diff --git a/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm b/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm index 1db5f8ad1c6..44695b61047 100644 --- a/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm +++ b/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm @@ -40,7 +40,7 @@ internal = new register_context() -/obj/machinery/atmospherics/components/binary/crystallizer/on_deconstruction() +/obj/machinery/atmospherics/components/binary/crystallizer/on_deconstruction(disassembled) var/turf/local_turf = get_turf(loc) if(internal.total_moles()) local_turf.assume_air(internal) @@ -67,7 +67,7 @@ return ..() /obj/machinery/atmospherics/components/binary/crystallizer/crowbar_act(mob/living/user, obj/item/tool) - return crowbar_deconstruction_act(user, tool, internal.return_pressure()) + return crowbar_deconstruction_act(user, tool, internal.return_pressure()) /obj/machinery/atmospherics/components/binary/crystallizer/update_overlays() . = ..() diff --git a/code/modules/atmospherics/machinery/components/tank.dm b/code/modules/atmospherics/machinery/components/tank.dm index 6e778168a32..cf18488f052 100644 --- a/code/modules/atmospherics/machinery/components/tank.dm +++ b/code/modules/atmospherics/machinery/components/tank.dm @@ -338,7 +338,7 @@ deconstruct(disassembled=TRUE) to_chat(user, span_notice("You finish cutting open the sealed gas tank, revealing the innards.")) -/obj/machinery/atmospherics/components/tank/deconstruct(disassembled) +/obj/machinery/atmospherics/components/tank/on_deconstruction(disassembled) var/turf/location = drop_location() . = ..() location.assume_air(air_contents) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm index c6814c41da3..beded509497 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm @@ -133,7 +133,7 @@ return ..() -/obj/machinery/cryo_cell/on_deconstruction() +/obj/machinery/cryo_cell/on_deconstruction(disassembled) if(occupant) occupant.vis_flags &= ~VIS_INHERIT_PLANE REMOVE_TRAIT(occupant, TRAIT_IMMOBILIZED, CRYO_TRAIT) diff --git a/code/modules/atmospherics/machinery/other/meter.dm b/code/modules/atmospherics/machinery/other/meter.dm index 656b6582a00..ee1d052b7ed 100644 --- a/code/modules/atmospherics/machinery/other/meter.dm +++ b/code/modules/atmospherics/machinery/other/meter.dm @@ -134,10 +134,8 @@ deconstruct() return TRUE -/obj/machinery/meter/deconstruct(disassembled = TRUE) - if(!(obj_flags & NO_DECONSTRUCTION)) - new /obj/item/pipe_meter(loc) - . = ..() +/obj/machinery/meter/on_deconstruction(disassembled) + new /obj/item/pipe_meter(loc) /obj/machinery/meter/interact(mob/user) if(machine_stat & (NOPOWER|BROKEN)) diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm index 18fe9817e81..8c3a3301b68 100644 --- a/code/modules/atmospherics/machinery/portable/canister.dm +++ b/code/modules/atmospherics/machinery/portable/canister.dm @@ -353,10 +353,7 @@ /obj/machinery/portable_atmospherics/canister/atmos_expose(datum/gas_mixture/air, exposed_temperature) take_damage(5, BURN, 0) -/obj/machinery/portable_atmospherics/canister/deconstruct(disassembled = TRUE) - if((obj_flags & NO_DECONSTRUCTION)) - qdel(src) - return +/obj/machinery/portable_atmospherics/canister/on_deconstruction(disassembled = TRUE) if(!(machine_stat & BROKEN)) canister_break() if(!disassembled) @@ -366,7 +363,6 @@ new /obj/item/stack/sheet/iron (drop_location(), 10) if(internal_cell) internal_cell.forceMove(drop_location()) - qdel(src) /obj/machinery/portable_atmospherics/canister/attackby(obj/item/item, mob/user, params) if(istype(item, /obj/item/stock_parts/cell)) diff --git a/code/modules/food_and_drinks/machinery/coffeemaker.dm b/code/modules/food_and_drinks/machinery/coffeemaker.dm index 36ef9a76384..8490b2b5cfb 100644 --- a/code/modules/food_and_drinks/machinery/coffeemaker.dm +++ b/code/modules/food_and_drinks/machinery/coffeemaker.dm @@ -45,10 +45,9 @@ coffeepot = new /obj/item/reagent_containers/cup/coffeepot(src) cartridge = new /obj/item/coffee_cartridge(src) -/obj/machinery/coffeemaker/deconstruct() +/obj/machinery/coffeemaker/on_deconstruction(disassembled) coffeepot?.forceMove(drop_location()) cartridge?.forceMove(drop_location()) - return ..() /obj/machinery/coffeemaker/Destroy() QDEL_NULL(coffeepot) diff --git a/code/modules/food_and_drinks/machinery/deep_fryer.dm b/code/modules/food_and_drinks/machinery/deep_fryer.dm index 2a172df811f..a6c3daf5cca 100644 --- a/code/modules/food_and_drinks/machinery/deep_fryer.dm +++ b/code/modules/food_and_drinks/machinery/deep_fryer.dm @@ -61,11 +61,10 @@ GLOBAL_LIST_INIT(oilfry_blacklisted_items, typecacheof(list( QDEL_NULL(frying) return ..() -/obj/machinery/deepfryer/deconstruct(disassembled) +/obj/machinery/deepfryer/on_deconstruction(disassembled) // This handles nulling out frying via exited if(frying) frying.forceMove(drop_location()) - return ..() /obj/machinery/deepfryer/RefreshParts() . = ..() diff --git a/code/modules/food_and_drinks/machinery/grill.dm b/code/modules/food_and_drinks/machinery/grill.dm index 695c70b75da..a98848b1ab2 100644 --- a/code/modules/food_and_drinks/machinery/grill.dm +++ b/code/modules/food_and_drinks/machinery/grill.dm @@ -106,13 +106,11 @@ if(default_unfasten_wrench(user, I) != CANT_UNFASTEN) return TRUE -/obj/machinery/grill/deconstruct(disassembled = TRUE) +/obj/machinery/grill/on_deconstruction(disassembled) if(grilled_item) finish_grill() - if(!(obj_flags & NO_DECONSTRUCTION)) - new /obj/item/stack/sheet/iron(loc, 5) - new /obj/item/stack/rods(loc, 5) - ..() + new /obj/item/stack/sheet/iron(loc, 5) + new /obj/item/stack/rods(loc, 5) /obj/machinery/grill/attack_ai(mob/user) return diff --git a/code/modules/food_and_drinks/machinery/icecream_vat.dm b/code/modules/food_and_drinks/machinery/icecream_vat.dm index e3abf6bf9de..e5742418c14 100644 --- a/code/modules/food_and_drinks/machinery/icecream_vat.dm +++ b/code/modules/food_and_drinks/machinery/icecream_vat.dm @@ -211,12 +211,10 @@ ice_cream_icon.color = flavor.color return ice_cream_icon -/obj/machinery/icecream_vat/deconstruct(disassembled = TRUE) - if(!(obj_flags & NO_DECONSTRUCTION)) - new /obj/item/stack/sheet/iron(loc, 4) +/obj/machinery/icecream_vat/on_deconstruction(disassembled = TRUE) + new /obj/item/stack/sheet/iron(loc, 4) if(custom_ice_cream_beaker) custom_ice_cream_beaker.forceMove(loc) - qdel(src) ///Makes an ice cream cone of the make_type, using ingredients list as reagents used to make it. Puts in user's hand if possible. /obj/machinery/icecream_vat/proc/make_cone(mob/user, make_type, list/ingredients) diff --git a/code/modules/food_and_drinks/machinery/microwave.dm b/code/modules/food_and_drinks/machinery/microwave.dm index c4cc6d378e3..ec5df27ca5a 100644 --- a/code/modules/food_and_drinks/machinery/microwave.dm +++ b/code/modules/food_and_drinks/machinery/microwave.dm @@ -105,7 +105,7 @@ itemized_ingredient.pixel_y = itemized_ingredient.base_pixel_y + rand(-5, 6) return ..() -/obj/machinery/microwave/on_deconstruction() +/obj/machinery/microwave/on_deconstruction(disassembled) eject() return ..() diff --git a/code/modules/food_and_drinks/machinery/smartfridge.dm b/code/modules/food_and_drinks/machinery/smartfridge.dm index 69f62b77d20..eeb5efd2642 100644 --- a/code/modules/food_and_drinks/machinery/smartfridge.dm +++ b/code/modules/food_and_drinks/machinery/smartfridge.dm @@ -491,7 +491,7 @@ /obj/machinery/smartfridge/drying_rack/exchange_parts() return -/obj/machinery/smartfridge/drying_rack/on_deconstruction() +/obj/machinery/smartfridge/drying_rack/on_deconstruction(disassembled) new /obj/item/stack/sheet/mineral/wood(drop_location(), 10) /obj/machinery/smartfridge/drying_rack/crowbar_act(mob/living/user, obj/item/tool) diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 56f967a0380..ca3fee495ce 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -1184,9 +1184,8 @@ /obj/machinery/hydroponics/soil/CtrlClick(mob/user) return //Soil has no electricity. -/obj/machinery/hydroponics/soil/deconstruct(disassembled) +/obj/machinery/hydroponics/soil/on_deconstruction(disassembled) new /obj/item/stack/ore/glass(drop_location(), 3) - return ..() ///The usb port circuit diff --git a/code/modules/mining/boulder_processing/_boulder_processing.dm b/code/modules/mining/boulder_processing/_boulder_processing.dm index daa6620a233..3372f77ebb5 100644 --- a/code/modules/mining/boulder_processing/_boulder_processing.dm +++ b/code/modules/mining/boulder_processing/_boulder_processing.dm @@ -126,8 +126,7 @@ remove_boulder(pick(boulders_contained)) return SECONDARY_ATTACK_CONTINUE_CHAIN -/obj/machinery/bouldertech/deconstruct(disassembled) - . = ..() +/obj/machinery/bouldertech/on_deconstruction(disassembled) if(length(contents)) for(var/obj/item/boulder/boulder in contents) remove_boulder(boulder) diff --git a/code/modules/paperwork/ticketmachine.dm b/code/modules/paperwork/ticketmachine.dm index c24b8fd73e8..56b7343995a 100644 --- a/code/modules/paperwork/ticketmachine.dm +++ b/code/modules/paperwork/ticketmachine.dm @@ -39,10 +39,8 @@ tickets.Cut() return ..() -/obj/machinery/ticket_machine/deconstruct(disassembled = TRUE) - if(!(obj_flags & NO_DECONSTRUCTION)) - new /obj/item/wallframe/ticket_machine(loc) - qdel(src) +/obj/machinery/ticket_machine/on_deconstruction(disassembled = TRUE) + new /obj/item/wallframe/ticket_machine(loc) MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/ticket_machine, 32) diff --git a/code/modules/plumbing/plumbers/iv_drip.dm b/code/modules/plumbing/plumbers/iv_drip.dm index 4bf4d71ec9f..bbdb80f57b1 100644 --- a/code/modules/plumbing/plumbers/iv_drip.dm +++ b/code/modules/plumbing/plumbers/iv_drip.dm @@ -36,5 +36,5 @@ if(default_unfasten_wrench(user, tool) == SUCCESSFUL_UNFASTEN) return ITEM_INTERACT_SUCCESS -/obj/machinery/iv_drip/plumbing/deconstruct(disassembled = TRUE) +/obj/machinery/iv_drip/plumbing/on_deconstruction(disassembled) qdel(src) diff --git a/code/modules/power/apc/apc_main.dm b/code/modules/power/apc/apc_main.dm index 450142b7e92..c36d9c108e2 100644 --- a/code/modules/power/apc/apc_main.dm +++ b/code/modules/power/apc/apc_main.dm @@ -299,9 +299,7 @@ else . += "The cover is closed." -/obj/machinery/power/apc/deconstruct(disassembled = TRUE) - if(obj_flags & NO_DECONSTRUCTION) - return +/obj/machinery/power/apc/on_deconstruction(disassembled = TRUE) if(!(machine_stat & BROKEN)) set_broken() if(opened != APC_COVER_REMOVED) diff --git a/code/modules/power/lighting/light.dm b/code/modules/power/lighting/light.dm index a2307039959..45a8c71d765 100644 --- a/code/modules/power/lighting/light.dm +++ b/code/modules/power/lighting/light.dm @@ -384,10 +384,7 @@ if (prob(75)) electrocute_mob(user, get_area(src), src, (rand(7,10) * 0.1), TRUE) -/obj/machinery/light/deconstruct(disassembled = TRUE) - if(obj_flags & NO_DECONSTRUCTION) - qdel(src) - return +/obj/machinery/light/on_deconstruction(disassembled) var/obj/structure/light_construct/new_light = null var/current_stage = 2 if(!disassembled) @@ -416,7 +413,6 @@ new_light.cell = real_cell real_cell.forceMove(new_light) cell = null - qdel(src) /obj/machinery/light/attacked_by(obj/item/attacking_object, mob/living/user) ..() diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index a4e24c5a728..308b8bc2465 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -189,7 +189,7 @@ return ..() -/obj/machinery/power/smes/on_deconstruction() +/obj/machinery/power/smes/on_deconstruction(disassembled) for(var/obj/item/stock_parts/cell/cell in component_parts) cell.charge = (charge / capacity) * cell.maxcharge diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm index 64c09a987ed..c62552913bb 100644 --- a/code/modules/power/solar.dm +++ b/code/modules/power/solar.dm @@ -121,18 +121,16 @@ visually_turn(new_angle) azimuth_current = new_angle -/obj/machinery/power/solar/deconstruct(disassembled = TRUE) - if(!(obj_flags & NO_DECONSTRUCTION)) - if(disassembled) - var/obj/item/solar_assembly/S = locate() in src - if(S) - S.forceMove(loc) - S.give_glass(machine_stat & BROKEN) - else - playsound(src, SFX_SHATTER, 70, TRUE) - new /obj/item/shard(src.loc) - new /obj/item/shard(src.loc) - qdel(src) +/obj/machinery/power/solar/on_deconstruction(disassembled) + if(disassembled) + var/obj/item/solar_assembly/S = locate() in src + if(S) + S.forceMove(loc) + S.give_glass(machine_stat & BROKEN) + else + playsound(src, SFX_SHATTER, 70, TRUE) + new /obj/item/shard(src.loc) + new /obj/item/shard(src.loc) /obj/machinery/power/solar/update_overlays() . = ..() diff --git a/code/modules/power/thermoelectric_generator.dm b/code/modules/power/thermoelectric_generator.dm index 1f8319ad51d..bded1482825 100644 --- a/code/modules/power/thermoelectric_generator.dm +++ b/code/modules/power/thermoelectric_generator.dm @@ -42,7 +42,7 @@ SSair.stop_processing_machine(src) return ..() -/obj/machinery/power/thermoelectric_generator/on_deconstruction() +/obj/machinery/power/thermoelectric_generator/on_deconstruction(disassembled) null_circulators() /obj/machinery/power/thermoelectric_generator/update_overlays() diff --git a/code/modules/power/tracker.dm b/code/modules/power/tracker.dm index d39840f875e..a6118e9ac09 100644 --- a/code/modules/power/tracker.dm +++ b/code/modules/power/tracker.dm @@ -137,18 +137,16 @@ playsound(loc, 'sound/effects/glassbr3.ogg', 100, TRUE) unset_control() -/obj/machinery/power/tracker/deconstruct(disassembled = TRUE) - if(!(obj_flags & NO_DECONSTRUCTION)) - if(disassembled) - var/obj/item/solar_assembly/S = locate() in src - if(S) - S.forceMove(loc) - S.give_glass(machine_stat & BROKEN) - else - playsound(src, SFX_SHATTER, 70, TRUE) - new /obj/item/shard(src.loc) - new /obj/item/shard(src.loc) - qdel(src) +/obj/machinery/power/tracker/on_deconstruction(disassembled) + if(disassembled) + var/obj/item/solar_assembly/S = locate() in src + if(S) + S.forceMove(loc) + S.give_glass(machine_stat & BROKEN) + else + playsound(src, SFX_SHATTER, 70, TRUE) + new /obj/item/shard(src.loc) + new /obj/item/shard(src.loc) // Tracker Electronic diff --git a/code/modules/power/turbine/turbine.dm b/code/modules/power/turbine/turbine.dm index fa1a885044a..3f4d3fd8446 100644 --- a/code/modules/power/turbine/turbine.dm +++ b/code/modules/power/turbine/turbine.dm @@ -179,7 +179,7 @@ if(default_deconstruction_crowbar(tool)) return ITEM_INTERACT_SUCCESS -/obj/machinery/power/turbine/on_deconstruction() +/obj/machinery/power/turbine/on_deconstruction(disassembled) installed_part?.forceMove(loc) return ..() @@ -547,7 +547,7 @@ disconnect_from_network() SSair.stop_processing_machine(src) -/obj/machinery/power/turbine/core_rotor/on_deconstruction() +/obj/machinery/power/turbine/core_rotor/on_deconstruction(disassembled) deactivate_parts() return ..() diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm index 0f6ea479a96..c3910529fc8 100644 --- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm +++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm @@ -464,7 +464,7 @@ update_appearance() return TRUE -/obj/machinery/chem_dispenser/on_deconstruction() +/obj/machinery/chem_dispenser/on_deconstruction(disassembled) cell = null if(beaker) beaker.forceMove(drop_location()) diff --git a/code/modules/reagents/chemistry/machinery/chem_heater.dm b/code/modules/reagents/chemistry/machinery/chem_heater.dm index 6c036d37bef..a07fd289f07 100644 --- a/code/modules/reagents/chemistry/machinery/chem_heater.dm +++ b/code/modules/reagents/chemistry/machinery/chem_heater.dm @@ -25,7 +25,7 @@ create_reagents(200, NO_REACT) register_context() -/obj/machinery/chem_heater/on_deconstruction() +/obj/machinery/chem_heater/on_deconstruction(disassembled) beaker?.forceMove(drop_location()) /obj/machinery/chem_heater/Destroy() diff --git a/code/modules/reagents/chemistry/machinery/chem_mass_spec.dm b/code/modules/reagents/chemistry/machinery/chem_mass_spec.dm index e49bc3ec5d6..c23a86ca9dc 100644 --- a/code/modules/reagents/chemistry/machinery/chem_mass_spec.dm +++ b/code/modules/reagents/chemistry/machinery/chem_mass_spec.dm @@ -58,14 +58,13 @@ This will not clean any inverted reagents. Inverted reagents will still be corre for(var/datum/stock_part/micro_laser/laser in component_parts) cms_coefficient /= laser.tier -/obj/machinery/chem_mass_spec/deconstruct(disassembled) +/obj/machinery/chem_mass_spec/on_deconstruction(disassembled) if(beaker1) beaker1.forceMove(drop_location()) beaker1 = null if(beaker2) beaker2.forceMove(drop_location()) beaker2 = null - . = ..() /obj/machinery/chem_mass_spec/update_overlays() . = ..() diff --git a/code/modules/reagents/chemistry/machinery/chem_master.dm b/code/modules/reagents/chemistry/machinery/chem_master.dm index bbc06437b84..6c961571b61 100644 --- a/code/modules/reagents/chemistry/machinery/chem_master.dm +++ b/code/modules/reagents/chemistry/machinery/chem_master.dm @@ -59,7 +59,7 @@ QDEL_NULL(beaker) return ..() -/obj/machinery/chem_master/on_deconstruction() +/obj/machinery/chem_master/on_deconstruction(disassembled) replace_beaker() return ..() diff --git a/code/modules/reagents/chemistry/machinery/pandemic.dm b/code/modules/reagents/chemistry/machinery/pandemic.dm index 586cb0ce8fa..bbde13c78a8 100644 --- a/code/modules/reagents/chemistry/machinery/pandemic.dm +++ b/code/modules/reagents/chemistry/machinery/pandemic.dm @@ -108,7 +108,7 @@ update_appearance() SStgui.update_uis(src) -/obj/machinery/computer/pandemic/on_deconstruction() +/obj/machinery/computer/pandemic/on_deconstruction(disassembled) eject_beaker() . = ..() diff --git a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm index f4be905a073..e7a6c9839eb 100644 --- a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm +++ b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm @@ -42,11 +42,10 @@ QDEL_NULL(beaker) update_appearance() -/obj/machinery/reagentgrinder/deconstruct() +/obj/machinery/reagentgrinder/on_deconstruction(disassmbled) drop_all_items() beaker?.forceMove(drop_location()) beaker = null - return ..() /obj/machinery/reagentgrinder/Destroy() QDEL_NULL(beaker) diff --git a/code/modules/reagents/chemistry/machinery/smoke_machine.dm b/code/modules/reagents/chemistry/machinery/smoke_machine.dm index a8d1765891b..e91aea78d59 100644 --- a/code/modules/reagents/chemistry/machinery/smoke_machine.dm +++ b/code/modules/reagents/chemistry/machinery/smoke_machine.dm @@ -111,10 +111,9 @@ return return ..() -/obj/machinery/smoke_machine/deconstruct() +/obj/machinery/smoke_machine/on_deconstruction(disassembled) reagents.expose(loc, TOUCH) reagents.clear_reagents() - return ..() /obj/machinery/smoke_machine/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) diff --git a/code/modules/recycling/disposal/bin.dm b/code/modules/recycling/disposal/bin.dm index 47f477382e4..b966ca1db6c 100644 --- a/code/modules/recycling/disposal/bin.dm +++ b/code/modules/recycling/disposal/bin.dm @@ -276,20 +276,18 @@ H.vent_gas(loc) qdel(H) -/obj/machinery/disposal/deconstruct(disassembled = TRUE) +/obj/machinery/disposal/on_deconstruction(disassembled) var/turf/T = loc - if(!(obj_flags & NO_DECONSTRUCTION)) - if(stored) - var/obj/structure/disposalconstruct/construct = stored - stored = null - construct.forceMove(T) - transfer_fingerprints_to(construct) - construct.set_anchored(FALSE) - construct.set_density(TRUE) - construct.update_appearance() + if(stored) + var/obj/structure/disposalconstruct/construct = stored + stored = null + construct.forceMove(T) + transfer_fingerprints_to(construct) + construct.set_anchored(FALSE) + construct.set_density(TRUE) + construct.update_appearance() for(var/atom/movable/AM in src) //out, out, darned crowbar! AM.forceMove(T) - ..() ///How disposal handles getting a storage dump from a storage object /obj/machinery/disposal/proc/on_storage_dump(datum/source, datum/storage/storage, mob/user) diff --git a/code/modules/research/anomaly/anomaly_refinery.dm b/code/modules/research/anomaly/anomaly_refinery.dm index 533443a1995..1805a252318 100644 --- a/code/modules/research/anomaly/anomaly_refinery.dm +++ b/code/modules/research/anomaly/anomaly_refinery.dm @@ -295,7 +295,7 @@ return FALSE tank_to_target = (tank_to_target == inserted_bomb.tank_one) ? inserted_bomb.tank_two : inserted_bomb.tank_one -/obj/machinery/research/anomaly_refinery/on_deconstruction() +/obj/machinery/research/anomaly_refinery/on_deconstruction(disassembled) eject_bomb() eject_core() return ..() diff --git a/code/modules/research/machinery/protolathe.dm b/code/modules/research/machinery/protolathe.dm index fb912bba67c..7a81a5cd36f 100644 --- a/code/modules/research/machinery/protolathe.dm +++ b/code/modules/research/machinery/protolathe.dm @@ -6,7 +6,7 @@ production_animation = "protolathe_n" allowed_buildtypes = PROTOLATHE -/obj/machinery/rnd/production/protolathe/deconstruct(disassembled) +/obj/machinery/rnd/production/protolathe/on_deconstruction(disassembled) log_game("Protolathe of type [type] [disassembled ? "disassembled" : "deconstructed"] by [key_name(usr)] at [get_area_name(src, TRUE)]") return ..() diff --git a/code/modules/research/ordnance/doppler_array.dm b/code/modules/research/ordnance/doppler_array.dm index a109e5061df..6ed039a2062 100644 --- a/code/modules/research/ordnance/doppler_array.dm +++ b/code/modules/research/ordnance/doppler_array.dm @@ -237,7 +237,7 @@ else if (machine_stat & NOPOWER) . += mutable_appearance(icon, "[base_icon_state]_screen-off") -/obj/machinery/doppler_array/on_deconstruction() +/obj/machinery/doppler_array/on_deconstruction(disassembled) eject_disk() . = ..() diff --git a/code/modules/research/ordnance/tank_compressor.dm b/code/modules/research/ordnance/tank_compressor.dm index ff03b368291..830c004acad 100644 --- a/code/modules/research/ordnance/tank_compressor.dm +++ b/code/modules/research/ordnance/tank_compressor.dm @@ -238,7 +238,7 @@ update_appearance() return ..() -/obj/machinery/atmospherics/components/binary/tank_compressor/on_deconstruction() +/obj/machinery/atmospherics/components/binary/tank_compressor/on_deconstruction(disassembled) eject_tank() eject_disk() return ..() diff --git a/code/modules/research/rdmachines.dm b/code/modules/research/rdmachines.dm index a8fa3e36d47..58d7f1f29cf 100644 --- a/code/modules/research/rdmachines.dm +++ b/code/modules/research/rdmachines.dm @@ -150,7 +150,7 @@ return TRUE //we eject the loaded item when deconstructing the machine -/obj/machinery/rnd/on_deconstruction() +/obj/machinery/rnd/on_deconstruction(disassembled) if(loaded_item) loaded_item.forceMove(drop_location()) ..() diff --git a/code/modules/research/server.dm b/code/modules/research/server.dm index b3c10eaac93..e446672bc33 100644 --- a/code/modules/research/server.dm +++ b/code/modules/research/server.dm @@ -230,7 +230,7 @@ to_chat(user, span_notice("You delicately cut the wire. [hdd_wires] wire\s left...")) return TRUE -/obj/machinery/rnd/server/master/on_deconstruction() +/obj/machinery/rnd/server/master/on_deconstruction(disassembled) // If the machine contains a source code HDD, destroying it will negatively impact research speed. Safest to log this. if(source_code_hdd) // Destroyed with a hard drive inside = harm income diff --git a/code/modules/transport/tram/tram_controller.dm b/code/modules/transport/tram/tram_controller.dm index 22504b6118b..c7fc895184f 100644 --- a/code/modules/transport/tram/tram_controller.dm +++ b/code/modules/transport/tram/tram_controller.dm @@ -857,10 +857,7 @@ balloon_alert(user, "[panel_open ? "mounting bolts exposed" : "mounting bolts hidden"]") return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN -/obj/machinery/transport/tram_controller/deconstruct(disassembled = TRUE) - if(obj_flags & NO_DECONSTRUCTION) - return - +/obj/machinery/transport/tram_controller/on_deconstruction(disassembled) var/turf/drop_location = find_obstruction_free_location(1, src) if(disassembled) @@ -868,7 +865,6 @@ else new /obj/item/stack/sheet/mineral/titanium(drop_location, 2) new /obj/item/stack/sheet/iron(drop_location, 1) - qdel(src) /** * Update the blinky lights based on the controller status, allowing to quickly check without opening up the cabinet. diff --git a/code/modules/transport/tram/tram_displays.dm b/code/modules/transport/tram/tram_displays.dm index 0e36295f97e..47fe21f2ff1 100644 --- a/code/modules/transport/tram/tram_displays.dm +++ b/code/modules/transport/tram/tram_displays.dm @@ -81,9 +81,7 @@ if(panel_open) . += span_notice("It is secured to the tram wall with [EXAMINE_HINT("bolts.")]") -/obj/machinery/transport/destination_sign/deconstruct(disassembled = TRUE) - if(obj_flags & NO_DECONSTRUCTION) - return +/obj/machinery/transport/destination_sign/on_deconstruction(disassembled) if(disassembled) new /obj/item/wallframe/indicator_display(drop_location()) else @@ -91,7 +89,6 @@ new /obj/item/stack/sheet/iron(drop_location(), 1) new /obj/item/shard(drop_location()) new /obj/item/shard(drop_location()) - qdel(src) /obj/machinery/transport/destination_sign/indicator/wrench_act_secondary(mob/living/user, obj/item/tool) . = ..() diff --git a/code/modules/vending/_vending.dm b/code/modules/vending/_vending.dm index 41ed5a04457..47bb9665556 100644 --- a/code/modules/vending/_vending.dm +++ b/code/modules/vending/_vending.dm @@ -298,12 +298,10 @@ for(var/obj/item/vending_refill/installed_refill in component_parts) restock(installed_refill) -/obj/machinery/vending/deconstruct(disassembled = TRUE) +/obj/machinery/vending/on_deconstruction(disassembled) if(refill_canister) return ..() - if(!(obj_flags & NO_DECONSTRUCTION)) //the non constructable vendors drop metal instead of a machine frame. - new /obj/item/stack/sheet/iron(loc, 3) - qdel(src) + new /obj/item/stack/sheet/iron(loc, 3) /obj/machinery/vending/update_appearance(updates=ALL) . = ..() @@ -1085,7 +1083,7 @@ replacer.play_rped_sound() return TRUE -/obj/machinery/vending/on_deconstruction() +/obj/machinery/vending/on_deconstruction(disassembled) update_canister() . = ..() @@ -1656,14 +1654,13 @@ /obj/machinery/vending/custom/crowbar_act(mob/living/user, obj/item/attack_item) return FALSE -/obj/machinery/vending/custom/deconstruct(disassembled) +/obj/machinery/vending/custom/on_deconstruction(disassembled) unbuckle_all_mobs(TRUE) var/turf/current_turf = get_turf(src) if(current_turf) for(var/obj/item/stored_item in contents) stored_item.forceMove(current_turf) explosion(src, devastation_range = -1, light_impact_range = 3) - return ..() /** * Vends an item to the user. Handles all the logic: diff --git a/code/modules/wiremod/shell/brain_computer_interface.dm b/code/modules/wiremod/shell/brain_computer_interface.dm index f41d4fa8bf1..57bb2ed45cb 100644 --- a/code/modules/wiremod/shell/brain_computer_interface.dm +++ b/code/modules/wiremod/shell/brain_computer_interface.dm @@ -283,7 +283,7 @@ . = ..() occupant_typecache = typecacheof(/mob/living/carbon) -/obj/machinery/bci_implanter/on_deconstruction() +/obj/machinery/bci_implanter/on_deconstruction(disassembled) drop_stored_bci() /obj/machinery/bci_implanter/Destroy()