Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions code/__DEFINES/dcs/signals/signals_atom/signals_atom_main.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@
#define COMSIG_ATOM_ABSTRACT_EXITED "atom_abstract_exited"
///from base of atom/Bumped(): (/atom/movable)
#define COMSIG_ATOM_BUMPED "atom_bumped"
///from base of atom/handle_atom_del(): (atom/deleted)
#define COMSIG_ATOM_CONTENTS_DEL "atom_contents_del"
///from base of atom/has_gravity(): (turf/location, list/forced_gravities)
#define COMSIG_ATOM_HAS_GRAVITY "atom_has_gravity"
///from internal loop in atom/movable/proc/CanReach(): (list/next)
Expand Down
8 changes: 0 additions & 8 deletions code/game/atoms/_atom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -687,14 +687,6 @@
/atom/proc/get_dumping_location()
return null

/**
* This proc is called when an atom in our contents has it's [Destroy][/atom/proc/Destroy] called
*
* Default behaviour is to simply send [COMSIG_ATOM_CONTENTS_DEL]
*/
/atom/proc/handle_atom_del(atom/deleting_atom)
SEND_SIGNAL(src, COMSIG_ATOM_CONTENTS_DEL, deleting_atom)

/**
* the vision impairment to give to the mob whose perspective is set to that atom
*
Expand Down
1 change: 0 additions & 1 deletion code/game/atoms/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@
if(((can_atmos_pass == ATMOS_PASS_DENSITY && density) || can_atmos_pass == ATMOS_PASS_NO) && isturf(loc))
can_atmos_pass = ATMOS_PASS_YES
air_update_turf(TRUE, FALSE)
loc.handle_atom_del(src)

if(opacity)
RemoveElement(/datum/element/light_blocking)
Expand Down
7 changes: 4 additions & 3 deletions code/game/machinery/PDApainter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,12 @@
if(stored_id_card)
SSexplosions.low_mov_atom += stored_id_card

/obj/machinery/pdapainter/handle_atom_del(atom/A)
if(A == stored_pda)
/obj/machinery/pdapainter/Exited(atom/movable/gone, direction)
. = ..()
if(gone == stored_pda)
stored_pda = null
update_appearance(UPDATE_ICON)
if(A == stored_id_card)
if(gone == stored_id_card)
stored_id_card = null
update_appearance(UPDATE_ICON)

Expand Down
50 changes: 25 additions & 25 deletions code/game/machinery/_machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,7 @@
end_processing()
dump_inventory_contents()

if (!isnull(component_parts))
// Don't delete the stock part singletons
for (var/atom/atom_part in component_parts)
qdel(atom_part)
component_parts.Cut()
component_parts = null

QDEL_NULL(circuit)
clear_components()
unset_static_power()
return ..()

Expand Down Expand Up @@ -879,6 +872,7 @@
qdel(item)
else
var/obj/item/obj_part = part
component_parts -= part
obj_part.forceMove(loc)
if(istype(A) && obj_part.get_shipbreaking_reward()) //shipbreaking
var/obj/item/reward = obj_part.get_shipbreaking_reward()
Expand Down Expand Up @@ -945,21 +939,35 @@
if(EXPLODE_LIGHT)
SSexplosions.low_mov_atom += occupant

/obj/machinery/handle_atom_del(atom/deleting_atom)
if(deleting_atom == occupant)
/obj/machinery/Exited(atom/movable/gone, direction)
. = ..()
if(gone == occupant)
set_occupant(null)
update_appearance()
updateUsrDialog()
return ..()

// The circuit should also be in component parts, so don't early return.
if(deleting_atom == circuit)
if(gone == circuit)
circuit = null
if((deleting_atom in component_parts) && !QDELETED(src))
component_parts.Remove(deleting_atom)
if((gone in component_parts) && !QDELETED(src))
component_parts -= gone
// It would be unusual for a component_part to be qdel'd ordinarily.
deconstruct(FALSE)
return ..()
// Check if component removed is an assembly because they get moved to component parts on attach
if(!istype(gone, /obj/item/assembly))
deconstruct(FALSE)

/**
* This should be called before mass qdeling components to make space for replacements.
* If not done, things will go awry as Exited() destroys the machine when it detects
* even a single component exiting the atom.
*/
/obj/machinery/proc/clear_components()
if(!component_parts)
return
var/list/old_components = component_parts
circuit = null
component_parts = null
for(var/atom/atom_part in old_components)
qdel(atom_part)

/obj/machinery/proc/default_deconstruction_screwdriver(mob/user, icon_state_open, icon_state_closed, obj/item/screwdriver)
if((flags_1 & NODECONSTRUCT_1) || screwdriver.tool_behaviour != TOOL_SCREWDRIVER)
Expand Down Expand Up @@ -1186,14 +1194,6 @@
power -= power * 0.0005
return ..()

/obj/machinery/Exited(atom/movable/gone, direction)
. = ..()
if(gone == occupant)
set_occupant(null)
if(gone == circuit)
LAZYREMOVE(component_parts, gone)
circuit = null

/obj/machinery/proc/adjust_item_drop_location(atom/movable/dropped_atom) // Adjust item drop location to a 3x3 grid inside the tile, returns slot id from 0 to 8
var/md5 = md5(dropped_atom.name) // Oh, and it's deterministic too. A specific item will always drop from the same slot.
for (var/i in 1 to 32)
Expand Down
14 changes: 1 addition & 13 deletions code/game/machinery/computer/buildandrepair.dm
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,7 @@
if(istype(new_machine, /obj/machinery/computer))
var/obj/machinery/computer/new_computer = new_machine

// Machines will init with a set of default components.
// Triggering handle_atom_del will make the machine realise it has lost a component_parts and then deconstruct.
// Move to nullspace so we don't trigger handle_atom_del, then qdel.
// Finally, replace new machine's parts with this frame's parts.
if(new_computer.circuit)
// Move to nullspace and delete.
new_computer.circuit.moveToNullspace()
QDEL_NULL(new_computer.circuit)
for(var/old_part in new_computer.component_parts)
var/atom/movable/movable_part = old_part
// Move to nullspace and delete.
movable_part.moveToNullspace()
qdel(movable_part)
new_machine.clear_components()

// Set anchor state and move the frame's parts over to the new machine.
// Then refresh parts and call on_construction().
Expand Down
10 changes: 1 addition & 9 deletions code/game/machinery/constructable_frame.dm
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,7 @@
P.play_tool_sound(src)
var/obj/machinery/new_machine = new circuit.build_path(loc)
if(istype(new_machine))
// Machines will init with a set of default components. Move to nullspace so we don't trigger handle_atom_del, then qdel.
// Finally, replace with this frame's parts.
if(new_machine.circuit)
// Move to nullspace and delete.
new_machine.circuit.moveToNullspace()
QDEL_NULL(new_machine.circuit)
for(var/obj/old_part in new_machine.component_parts)
old_part.moveToNullspace()
qdel(old_part)
new_machine.clear_components()

// Set anchor state
new_machine.set_anchored(anchored)
Expand Down
15 changes: 8 additions & 7 deletions code/game/machinery/defibrillator_mount.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/defibrillator_mount, 28)
MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/defibrillator_mount/loaded, 28)

/obj/machinery/defibrillator_mount/Destroy()
if(defib)
QDEL_NULL(defib)
. = ..()
QDEL_NULL(defib)
return ..()

/obj/machinery/defibrillator_mount/handle_atom_del(atom/A)
if(A == defib)
defib = null
/obj/machinery/defibrillator_mount/Exited(atom/movable/gone, direction)
. = ..()
if(gone == defib)
// Make sure processing ends before the defib is nulled
end_processing()
return ..()
defib = null
update_appearance()

/obj/machinery/defibrillator_mount/examine(mob/user)
. = ..()
Expand Down
7 changes: 4 additions & 3 deletions code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,12 @@
diag_hud.remove_atom_from_hud(src)
return ..()

/obj/machinery/door/airlock/handle_atom_del(atom/A)
if(A == note)
/obj/machinery/door/airlock/Exited(atom/movable/gone, direction)
. = ..()
if(gone == note)
note = null
update_appearance()
if(A == seal)
if(gone == seal)
seal = null
update_appearance()

Expand Down
6 changes: 3 additions & 3 deletions code/game/machinery/gulag_item_reclaimer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
///Icon of the current screen status
var/screen_icon = "gulag_on"

/obj/machinery/gulag_item_reclaimer/handle_atom_del(atom/deleting_atom)
/obj/machinery/gulag_item_reclaimer/Exited(atom/movable/gone, direction)
. = ..()
for(var/person in stored_items)
stored_items[person] -= deleting_atom
return ..()
stored_items[person] -= gone

/obj/machinery/gulag_item_reclaimer/update_overlays()
. = ..()
Expand Down
5 changes: 0 additions & 5 deletions code/game/objects/effects/posters/poster.dm
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@
if(!QDELING(src))
qdel(src) //we're now a poster, huzzah!

/obj/item/poster/handle_atom_del(atom/deleting_atom)
if(deleting_atom == poster_structure)
poster_structure.moveToNullspace() //get it the fuck out of us since atom/destroy qdels contents and it'll cause a qdel loop
return ..()

/obj/item/poster/Destroy(force)
QDEL_NULL(poster_structure)
return ..()
Expand Down
8 changes: 3 additions & 5 deletions code/game/objects/items/circuitboards/circuitboard.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
// This really shouldn't happen. If it somehow does, print out a stack trace and gracefully handle it.
stack_trace("apply_defauly_parts called on machine that already had component_parts: [machine]")

// Move to nullspace so you don't trigger handle_atom_del logic and remove existing parts.
// Remove references of components so it doesn't trigger Exited logic and remove existing parts.
for(var/obj/item/part as anything in machine.component_parts)
part.moveToNullspace(loc)
machine.component_parts -= part
qdel(part)

// List of components always contains the circuit board used to build it.
Expand All @@ -47,9 +47,7 @@
// This really shouldn't happen. If it somehow does, print out a stack trace and gracefully handle it.
stack_trace("apply_default_parts called from a circuit board that does not belong to machine: [machine]")

// Move to nullspace so you don't trigger handle_atom_del logic, remove old circuit, add new circuit.
machine.circuit.moveToNullspace()
qdel(machine.circuit)
QDEL_NULL(machine.circuit)
machine.circuit = src

return
Expand Down
10 changes: 3 additions & 7 deletions code/game/objects/items/devices/transfer_valve.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@
/obj/item/transfer_valve/IsAssemblyHolder()
return TRUE

/obj/item/transfer_valve/handle_atom_del(atom/deleted_atom)
/obj/item/transfer_valve/Exited(atom/movable/gone, direction)
. = ..()
if(deleted_atom == tank_one)
if(gone == tank_one)
tank_one = null
update_appearance()
return
if(deleted_atom == tank_two)
else if(gone == tank_two)
tank_two = null
update_appearance()
return

/obj/item/transfer_valve/attackby(obj/item/item, mob/user, params)
if(istype(item, /obj/item/tank))
Expand Down Expand Up @@ -263,14 +261,12 @@
split_gases()
valve_open = FALSE
tank_one.forceMove(drop_location())
tank_one = null
. = TRUE
if("tanktwo")
if(tank_two)
split_gases()
valve_open = FALSE
tank_two.forceMove(drop_location())
tank_two = null
. = TRUE
if("toggle")
toggle_valve()
Expand Down
7 changes: 0 additions & 7 deletions code/game/objects/items/implants/implantpad.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@
inserted_case = null
update_appearance(UPDATE_ICON)

/obj/item/implantpad/handle_atom_del(atom/A)
if(A == inserted_case)
inserted_case = null
update_appearance()
updateSelfDialog()
. = ..()

/obj/item/implantpad/click_alt(mob/user)
remove_implant(user)
return CLICK_ACTION_SUCCESS
Expand Down
12 changes: 3 additions & 9 deletions code/game/objects/items/inspector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,10 @@
cell = new cell(src)

// Clean up the cell on destroy
/obj/item/clothing/suit/space/Destroy()
if(isatom(cell))
QDEL_NULL(cell)
return ..()

// Clean up the cell on destroy
/obj/item/inspector/handle_atom_del(atom/A)
if(A == cell)
/obj/item/inspector/Exited(atom/movable/gone, direction)
. = ..()
if(gone == cell)
cell = null
return ..()

// support for items that interact with the cell
/obj/item/inspector/get_cell()
Expand Down
5 changes: 3 additions & 2 deletions code/game/objects/items/melee/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,9 @@
roastableicon.color = held_sausage.color
. += roastableicon

/obj/item/melee/roastingstick/handle_atom_del(atom/target)
if (target == held_sausage)
/obj/item/melee/roastingstick/Exited(atom/movable/gone, direction)
. = ..()
if (gone == held_sausage)
held_sausage = null
update_appearance()

Expand Down
12 changes: 3 additions & 9 deletions code/game/objects/items/pet_carrier.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,11 @@
return ..()

/obj/item/pet_carrier/Exited(atom/movable/gone, direction)
. = ..()
if(isliving(gone) && (gone in occupants))
var/mob/living/L = gone
var/mob/living/living_gone = gone
occupants -= gone
occupant_weight -= L.mob_size

/obj/item/pet_carrier/handle_atom_del(atom/A)
if((A in occupants) && isliving(A))
var/mob/living/L = A
occupants -= L
occupant_weight -= L.mob_size
..()
occupant_weight -= living_gone.mob_size

/obj/item/pet_carrier/examine(mob/user)
. = ..()
Expand Down
7 changes: 3 additions & 4 deletions code/game/objects/items/plushes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@

return ..()

/obj/item/toy/plush/handle_atom_del(atom/A)
if(A == grenade)
/obj/item/toy/plush/Exited(atom/movable/gone, direction)
. = ..()
if(gone == grenade)
grenade = null
..()

/obj/item/toy/plush/attack_self(mob/user)
. = ..()
Expand Down Expand Up @@ -152,7 +152,6 @@
else
to_chat(user, span_notice("You remove the grenade from [src]."))
user.put_in_hands(grenade)
grenade = null
return
if(isgrenade(attacking_item))
if(stuffed)
Expand Down
Loading
Loading