diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm
index 87d83bc2f60..89a2a27cb29 100644
--- a/code/game/machinery/Sleeper.dm
+++ b/code/game/machinery/Sleeper.dm
@@ -32,7 +32,7 @@
/obj/machinery/sleeper/Initialize(mapload)
. = ..()
if(mapload)
- component_parts -= circuit
+ LAZYREMOVE(component_parts, circuit)
QDEL_NULL(circuit)
occupant_typecache = GLOB.typecache_living
update_icon()
@@ -267,12 +267,18 @@
/obj/machinery/sleeper/syndie/fullupgrade/Initialize()
. = ..()
+
+ // Cache the old_parts first, we'll delete it after we've changed component_parts to a new list.
+ // This stops handle_atom_del being called on every part when not necessary.
+ var/list/old_parts = component_parts
+
component_parts = list()
- component_parts += new /obj/item/stock_parts/matter_bin/bluespace(null)
- component_parts += new /obj/item/stock_parts/manipulator/femto(null)
- component_parts += new /obj/item/stack/sheet/glass(null)
- component_parts += new /obj/item/stack/sheet/glass(null)
- component_parts += new /obj/item/stack/cable_coil(null)
+ component_parts += new /obj/item/stock_parts/matter_bin/bluespace(src)
+ component_parts += new /obj/item/stock_parts/manipulator/femto(src)
+ component_parts += new /obj/item/stack/sheet/glass(src, 2)
+ component_parts += new /obj/item/stack/cable_coil(src, 1)
+
+ QDEL_LIST(old_parts)
RefreshParts()
/obj/machinery/sleeper/old
diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm
index 604b9bdc276..e1b65d06c99 100644
--- a/code/game/machinery/_machinery.dm
+++ b/code/game/machinery/_machinery.dm
@@ -135,7 +135,7 @@ Class Procs:
GLOB.machines += src
if(ispath(circuit, /obj/item/circuitboard))
- circuit = new circuit
+ circuit = new circuit(src)
circuit.apply_default_parts(src)
if(processing_flags & START_PROCESSING_ON_INIT)
@@ -164,7 +164,7 @@ Class Procs:
/obj/machinery/Destroy()
GLOB.machines.Remove(src)
end_processing()
- dropContents()
+ drop_contents()
QDEL_LIST(component_parts)
QDEL_NULL(circuit)
return ..()
@@ -203,24 +203,63 @@ Class Procs:
use_power(7500/severity)
new /obj/effect/temp_visual/emp(loc)
+/**
+ * Opens the machine.
+ *
+ * Will update the machine icon and any user interfaces currently open.
+ * Arguments:
+ * * drop - Boolean. Whether to drop any stored items in the machine. Does not include components.
+ */
/obj/machinery/proc/open_machine(drop = TRUE)
state_open = TRUE
density = FALSE
if(drop)
- dropContents()
+ drop_stored_items()
update_icon()
updateUsrDialog()
-/obj/machinery/proc/dropContents(list/subset = null)
- var/turf/T = get_turf(src)
- for(var/atom/movable/A in contents)
- if(subset && !(A in subset))
- continue
- A.forceMove(T)
- if(isliving(A))
- var/mob/living/L = A
- L.update_mobility()
+/**
+ * Drop every movable atom in the machine's contents list.
+ */
+/obj/machinery/proc/drop_contents()
+ // Start by calling the drop_stored_items proc. Will allow machines with special contents
+ // to handle their dropping.
+ drop_stored_items()
+
+ // Then we can clean up and drop everything else.
+ var/turf/this_turf = get_turf(src)
+ for(var/atom/movable/movable_atom in contents)
+ movable_atom.forceMove(this_turf)
+
+ // We'll have dropped the occupant, circuit and component parts as part of this.
occupant = null
+ circuit = null
+ LAZYCLEARLIST(component_parts)
+
+/**
+ * Drop every movable atom in the machine's contents list.
+ *
+ * Proc does not drop components and will skip over anything in the component_parts list.
+ * Call drop_contents() to drop all contents including components.
+ * Arguments:
+ * * subset - If this is not null, only atoms that are also contained within the subset list will be dropped.
+ */
+/obj/machinery/proc/drop_stored_items(list/subset = null)
+ var/turf/this_turf = get_turf(src)
+ for(var/atom/movable/movable_atom in contents)
+ if(subset && !(movable_atom in subset))
+ continue
+
+ if(movable_atom in component_parts)
+ continue
+
+ movable_atom.forceMove(this_turf)
+ if(isliving(movable_atom))
+ var/mob/living/living_mob = movable_atom
+ living_mob.update_mobility()
+
+ if(occupant == movable_atom)
+ occupant = null
/**
* Puts passed object in to user's hand
@@ -397,8 +436,6 @@ Class Procs:
var/damage = damage_deflection / 10
arm.receive_damage(brute=damage, wound_bonus = CANT_WOUND)
-
-
/obj/machinery/attack_robot(mob/user)
if(!(interaction_flags_machine & INTERACT_MACHINE_ALLOW_SILICON) && !isAdminGhostAI(user))
return FALSE
@@ -448,12 +485,11 @@ Class Procs:
/obj/machinery/deconstruct(disassembled = TRUE)
if(!(flags_1 & NODECONSTRUCT_1))
on_deconstruction()
- if(component_parts && component_parts.len)
+ if(LAZYLEN(component_parts))
spawn_frame(disassembled)
for(var/obj/item/I in component_parts)
I.forceMove(loc)
- component_parts.Cut()
- circuit = null
+ LAZYCLEARLIST(component_parts)
return ..()
/obj/machinery/proc/spawn_frame(disassembled)
@@ -484,8 +520,15 @@ Class Procs:
occupant = null
update_icon()
updateUsrDialog()
+ return ..()
+
+ // The circuit should also be in component parts, so don't early return.
if(A == circuit)
circuit = null
+ if((A in component_parts) && !QDELETED(src))
+ component_parts.Remove(A)
+ // It would be unusual for a component_part to be qdel'd ordinarily.
+ deconstruct(FALSE)
return ..()
/obj/machinery/CanAllowThrough(atom/movable/mover, turf/target)
@@ -579,7 +622,7 @@ Class Procs:
else
if(SEND_SIGNAL(W, COMSIG_TRY_STORAGE_TAKE, B, src))
component_parts += B
- B.moveToNullspace()
+ B.forceMove(src)
SEND_SIGNAL(W, COMSIG_TRY_STORAGE_INSERT, A, null, null, TRUE)
component_parts -= A
to_chat(user, "[capitalize(A.name)] replaced with [B.name].")
@@ -641,7 +684,7 @@ Class Procs:
/obj/machinery/Exited(atom/movable/AM, atom/newloc)
. = ..()
- if (AM == occupant)
+ if(AM == occupant)
occupant = null
if(AM == circuit)
circuit = null
diff --git a/code/game/machinery/computer/_computer.dm b/code/game/machinery/computer/_computer.dm
index 9a9eef0371a..5bc7e0d2b60 100644
--- a/code/game/machinery/computer/_computer.dm
+++ b/code/game/machinery/computer/_computer.dm
@@ -17,11 +17,8 @@
/obj/machinery/computer/Initialize(mapload, obj/item/circuitboard/C)
. = ..()
+
power_change()
- if(!QDELETED(C))
- qdel(circuit)
- circuit = C
- C.moveToNullspace()
/obj/machinery/computer/process()
if(machine_stat & (NOPOWER|BROKEN))
@@ -96,6 +93,7 @@
var/obj/structure/frame/computer/A = new /obj/structure/frame/computer(src.loc)
A.setDir(dir)
A.circuit = circuit
+ circuit.forceMove(A)
A.set_anchored(TRUE)
if(machine_stat & BROKEN)
if(user)
diff --git a/code/game/machinery/computer/arcade.dm b/code/game/machinery/computer/arcade.dm
index a43c78643a0..8f2cd9298c4 100644
--- a/code/game/machinery/computer/arcade.dm
+++ b/code/game/machinery/computer/arcade.dm
@@ -69,18 +69,16 @@ GLOBAL_LIST_INIT(arcade_prize_pool, list(
return
/obj/machinery/computer/arcade/Initialize()
- . = ..()
// If it's a generic arcade machine, pick a random arcade
- // circuit board for it and make the new machine
+ // circuit board for it
if(!circuit)
var/list/gameodds = list(/obj/item/circuitboard/computer/arcade/battle = 49,
/obj/item/circuitboard/computer/arcade/orion_trail = 49,
/obj/item/circuitboard/computer/arcade/amputation = 2)
- var/thegame = pickweight(gameodds)
- var/obj/item/circuitboard/new_board = new thegame()
- var/obj/new_cabinet = new new_board.build_path(loc, new_board)
- new_cabinet.setDir(dir)
- return INITIALIZE_HINT_QDEL
+ circuit = pickweight(gameodds)
+
+ . = ..()
+
Reset()
/obj/machinery/computer/arcade/proc/prizevend(mob/user, prizes = 1)
diff --git a/code/game/machinery/computer/buildandrepair.dm b/code/game/machinery/computer/buildandrepair.dm
index 4aa36f998c6..66a66efe991 100644
--- a/code/game/machinery/computer/buildandrepair.dm
+++ b/code/game/machinery/computer/buildandrepair.dm
@@ -113,7 +113,7 @@
if(P.tool_behaviour == TOOL_SCREWDRIVER)
P.play_tool_sound(src)
to_chat(user, "You connect the monitor.")
- var/obj/B = new circuit.build_path (loc, circuit)
+ var/obj/B = new circuit.build_path(loc)
B.setDir(dir)
transfer_fingerprints_to(B)
qdel(src)
diff --git a/code/game/machinery/constructable_frame.dm b/code/game/machinery/constructable_frame.dm
index efd71785d72..58f3eaf7f62 100644
--- a/code/game/machinery/constructable_frame.dm
+++ b/code/game/machinery/constructable_frame.dm
@@ -176,28 +176,33 @@
return
if(P.tool_behaviour == TOOL_SCREWDRIVER)
- var/component_check = 1
+ var/component_check = TRUE
for(var/R in req_components)
if(req_components[R] > 0)
- component_check = 0
+ component_check = FALSE
break
if(component_check)
P.play_tool_sound(src)
- var/obj/potential_machine = new circuit.build_path(loc)
- if(ismachinery(potential_machine))
- var/obj/machinery/new_machine = potential_machine
+ 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 to 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)
+ circuit.forceMove(new_machine)
new_machine.circuit = circuit
new_machine.set_anchored(anchored)
new_machine.on_construction()
- for(var/obj/O in new_machine.component_parts)
- qdel(O)
+ for(var/obj/old_part in new_machine.component_parts)
+ // Move to nullspace and delete.
+ old_part.moveToNullspace()
+ qdel(old_part)
new_machine.component_parts = list()
- for(var/obj/O in src)
- O.moveToNullspace()
- new_machine.component_parts += O
- circuit.moveToNullspace()
+ for(var/obj/new_part in src)
+ new_part.forceMove(new_machine)
+ new_machine.component_parts += new_part
new_machine.RefreshParts()
qdel(src)
return
@@ -238,6 +243,7 @@
S.merge(NS)
if(!QDELETED(part)) //If we're a stack and we merged we might not exist anymore
components += part
+ part.forceMove(src)
to_chat(user, "[part.name] applied.")
if(added_components.len)
replacer.play_rped_sound()
diff --git a/code/game/machinery/electrolyzer.dm b/code/game/machinery/electrolyzer.dm
index 59079a8324a..f992383a8f4 100644
--- a/code/game/machinery/electrolyzer.dm
+++ b/code/game/machinery/electrolyzer.dm
@@ -41,7 +41,7 @@
/obj/machinery/electrolyzer/on_deconstruction()
if(cell)
- component_parts += cell
+ LAZYADD(component_parts, cell)
cell = null
return ..()
diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm
index d02d4d90128..3faf275254d 100644
--- a/code/game/machinery/spaceheater.dm
+++ b/code/game/machinery/spaceheater.dm
@@ -43,7 +43,7 @@
/obj/machinery/space_heater/on_deconstruction()
if(cell)
- component_parts += cell
+ LAZYADD(component_parts, cell)
cell = null
return ..()
diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm
index 46b5f3bd3cc..d339fd3bc3f 100644
--- a/code/game/machinery/suit_storage_unit.dm
+++ b/code/game/machinery/suit_storage_unit.dm
@@ -190,8 +190,8 @@
dump_contents()
update_icon()
-/obj/machinery/suit_storage_unit/dump_contents()
- dropContents()
+/obj/machinery/suit_storage_unit/drop_stored_items()
+ . = ..()
helmet = null
suit = null
mask = null
diff --git a/code/game/machinery/teleporter.dm b/code/game/machinery/teleporter.dm
index 96bbf82affc..e51a6315914 100644
--- a/code/game/machinery/teleporter.dm
+++ b/code/game/machinery/teleporter.dm
@@ -99,10 +99,10 @@
/obj/machinery/teleport/hub/syndicate/Initialize()
. = ..()
- component_parts += new /obj/item/stock_parts/matter_bin/super(null)
+ var/obj/item/stock_parts/matter_bin/super/super_bin = new(src)
+ LAZYADD(component_parts, super_bin)
RefreshParts()
-
/obj/machinery/teleport/station
name = "teleporter station"
desc = "The power control station for a bluespace teleporter. Used for toggling power, and can activate a test-fire to prevent malfunctions."
diff --git a/code/game/objects/items/circuitboards/circuitboard.dm b/code/game/objects/items/circuitboards/circuitboard.dm
index e2529aa1c5d..e4c5549cb8e 100644
--- a/code/game/objects/items/circuitboards/circuitboard.dm
+++ b/code/game/objects/items/circuitboards/circuitboard.dm
@@ -37,7 +37,7 @@ micro-manipulator, console screen, beaker, Microlaser, matter bin, power cells.
return
M.component_parts = list(src) // List of components always contains a board
- moveToNullspace()
+ forceMove(M)
for(var/comp_path in req_components)
var/comp_amt = req_components[comp_path]
@@ -48,10 +48,10 @@ micro-manipulator, console screen, beaker, Microlaser, matter bin, power cells.
comp_path = def_components[comp_path]
if(ispath(comp_path, /obj/item/stack))
- M.component_parts += new comp_path(null, comp_amt)
+ M.component_parts += new comp_path(M, comp_amt)
else
for(var/i in 1 to comp_amt)
- M.component_parts += new comp_path(null)
+ M.component_parts += new comp_path(M)
M.RefreshParts()
diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm
index bb559f74894..c27f9ad75d3 100644
--- a/code/modules/atmospherics/machinery/atmosmachinery.dm
+++ b/code/modules/atmospherics/machinery/atmosmachinery.dm
@@ -68,7 +68,6 @@
SSair.stop_processing_machine(src)
SSair.pipenets_needing_rebuilt -= src
- dropContents()
if(pipe_vision_img)
qdel(pipe_vision_img)
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm
index c8ad46a47f7..d5a02e7cc7d 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm
@@ -15,6 +15,7 @@
density = TRUE
+ circuit = /obj/item/circuitboard/machine/circulator
var/flipped = 0
var/mode = CIRCULATOR_HOT
@@ -24,10 +25,6 @@
/obj/machinery/atmospherics/components/binary/circulator/cold
mode = CIRCULATOR_COLD
-/obj/machinery/atmospherics/components/binary/circulator/Initialize(mapload)
- .=..()
- component_parts = list(new /obj/item/circuitboard/machine/circulator)
-
/obj/machinery/atmospherics/components/binary/circulator/ComponentInitialize()
. = ..()
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS )
diff --git a/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm b/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm
index 9811cd008b7..e342f322760 100644
--- a/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm
+++ b/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm
@@ -32,6 +32,7 @@ God bless America.
use_power = IDLE_POWER_USE
idle_power_usage = 5
layer = BELOW_OBJ_LAYER
+ circuit = /obj/item/circuitboard/machine/deep_fryer
var/obj/item/food/deepfryholder/frying //What's being fried RIGHT NOW?
var/cook_time = 0
var/oil_use = 0.025 //How much cooking oil is used per second
@@ -57,10 +58,6 @@ God bless America.
. = ..()
create_reagents(50, OPENCONTAINER)
reagents.add_reagent(/datum/reagent/consumable/cooking_oil, 25)
- component_parts = list()
- component_parts += new /obj/item/circuitboard/machine/deep_fryer(null)
- component_parts += new /obj/item/stock_parts/micro_laser(null)
- RefreshParts()
fry_loop = new(list(src), FALSE)
/obj/machinery/deepfryer/RefreshParts()
diff --git a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm
index 62e17b9020e..7c4637da6f0 100644
--- a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm
+++ b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm
@@ -132,7 +132,7 @@
return
/obj/machinery/gibber/proc/go_out()
- dropContents()
+ drop_stored_items()
update_icon()
/obj/machinery/gibber/proc/startgibbing(mob/user)
diff --git a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm
index 46c0319e731..d4704ab1e08 100644
--- a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm
+++ b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm
@@ -327,11 +327,14 @@
if(prob(max(metal / 2, 33)))
explosion(loc, 0, 1, 2)
else
- dropContents(ingredients)
- ingredients.Cut()
+ drop_stored_items()
after_finish_loop()
+/obj/machinery/microwave/drop_stored_items()
+ . = ..()
+ ingredients.Cut()
+
/obj/machinery/microwave/proc/pre_fail()
broken = 2
operating = FALSE
diff --git a/code/modules/food_and_drinks/kitchen_machinery/processor.dm b/code/modules/food_and_drinks/kitchen_machinery/processor.dm
index e7dc449ec3c..bd0cd5a9dfa 100644
--- a/code/modules/food_and_drinks/kitchen_machinery/processor.dm
+++ b/code/modules/food_and_drinks/kitchen_machinery/processor.dm
@@ -153,11 +153,7 @@
/obj/machinery/processor/slime
name = "slime processor"
desc = "An industrial grinder with a sticker saying appropriated for science department. Keep hands clear of intake area while operating."
-
-/obj/machinery/processor/slime/Initialize()
- . = ..()
- var/obj/item/circuitboard/machine/B = new /obj/item/circuitboard/machine/processor/slime(null)
- B.apply_default_parts(src)
+ circuit = /obj/item/circuitboard/machine/processor/slime
/obj/machinery/processor/slime/adjust_item_drop_location(atom/movable/AM)
var/static/list/slimecores = subtypesof(/obj/item/slime_extract)
diff --git a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm
index cd89d727ac7..050bfa19ab0 100644
--- a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm
+++ b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm
@@ -248,9 +248,16 @@
/obj/machinery/smartfridge/drying_rack/Initialize()
. = ..()
- if(component_parts && component_parts.len)
- component_parts.Cut()
+
+ // Cache the old_parts first, we'll delete it after we've changed component_parts to a new list.
+ // This stops handle_atom_del being called on every part when not necessary.
+ var/list/old_parts = component_parts
+
component_parts = null
+ circuit = null
+
+ QDEL_LIST(old_parts)
+ RefreshParts()
/obj/machinery/smartfridge/drying_rack/on_deconstruction()
new /obj/item/stack/sheet/mineral/wood(drop_location(), 10)
diff --git a/code/modules/library/skill_learning/skill_station.dm b/code/modules/library/skill_learning/skill_station.dm
index eb8062e566b..53f1deaa10e 100644
--- a/code/modules/library/skill_learning/skill_station.dm
+++ b/code/modules/library/skill_learning/skill_station.dm
@@ -92,9 +92,15 @@
return
return ..()
-/obj/machinery/skill_station/dropContents(list/subset)
+/obj/machinery/skill_station/drop_contents()
+ . = ..()
+ inserted_skillchip = null
+
+/obj/machinery/skill_station/drop_stored_items(list/subset = null)
+ // Don't drop the skillchip, it's directly inserted into the machine.
+ // drop_contents() will drop everything including the skillchip.
subset = contents - inserted_skillchip
- return ..() //This is kinda annoying
+ return ..()
/obj/machinery/skill_station/proc/toggle_open(mob/user)
state_open ? close_machine() : open_machine()
diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm
index 0b21ff3365d..8efd5a68773 100644
--- a/code/modules/power/generator.dm
+++ b/code/modules/power/generator.dm
@@ -5,6 +5,8 @@
density = TRUE
use_power = NO_POWER_USE
+ circuit = /obj/item/circuitboard/machine/generator
+
var/obj/machinery/atmospherics/components/binary/circulator/cold_circ
var/obj/machinery/atmospherics/components/binary/circulator/hot_circ
@@ -19,7 +21,6 @@
connect_to_network()
SSair.start_processing_machine(src)
update_icon()
- component_parts = list(new /obj/item/circuitboard/machine/generator)
/obj/machinery/power/generator/ComponentInitialize()
. = ..()
diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm
index 095c25ad6cd..b9a5a244a0d 100644
--- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm
+++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm
@@ -497,14 +497,21 @@
/obj/machinery/chem_dispenser/drinks/fullupgrade/Initialize()
. = ..()
dispensable_reagents |= emagged_reagents //adds emagged reagents
+
+ // Cache the old_parts first, we'll delete it after we've changed component_parts to a new list.
+ // This stops handle_atom_del being called on every part when not necessary.
+ var/list/old_parts = component_parts
+
component_parts = list()
- component_parts += new /obj/item/circuitboard/machine/chem_dispenser/drinks(null)
- component_parts += new /obj/item/stock_parts/matter_bin/bluespace(null)
- component_parts += new /obj/item/stock_parts/matter_bin/bluespace(null)
- component_parts += new /obj/item/stock_parts/capacitor/quadratic(null)
- component_parts += new /obj/item/stock_parts/manipulator/femto(null)
- component_parts += new /obj/item/stack/sheet/glass(null)
- component_parts += new /obj/item/stock_parts/cell/bluespace(null)
+ component_parts += new /obj/item/circuitboard/machine/chem_dispenser/drinks(src)
+ component_parts += new /obj/item/stock_parts/matter_bin/bluespace(src)
+ component_parts += new /obj/item/stock_parts/matter_bin/bluespace(src)
+ component_parts += new /obj/item/stock_parts/capacitor/quadratic(src)
+ component_parts += new /obj/item/stock_parts/manipulator/femto(src)
+ component_parts += new /obj/item/stack/sheet/glass(src, 1)
+ component_parts += new /obj/item/stock_parts/cell/bluespace(src)
+
+ QDEL_LIST(old_parts)
RefreshParts()
/obj/machinery/chem_dispenser/drinks/beer
@@ -551,14 +558,21 @@
/obj/machinery/chem_dispenser/drinks/beer/fullupgrade/Initialize()
. = ..()
dispensable_reagents |= emagged_reagents //adds emagged reagents
+
+ // Cache the old_parts first, we'll delete it after we've changed component_parts to a new list.
+ // This stops handle_atom_del being called on every part when not necessary.
+ var/list/old_parts = component_parts
+
component_parts = list()
- component_parts += new /obj/item/circuitboard/machine/chem_dispenser/drinks/beer(null)
- component_parts += new /obj/item/stock_parts/matter_bin/bluespace(null)
- component_parts += new /obj/item/stock_parts/matter_bin/bluespace(null)
- component_parts += new /obj/item/stock_parts/capacitor/quadratic(null)
- component_parts += new /obj/item/stock_parts/manipulator/femto(null)
- component_parts += new /obj/item/stack/sheet/glass(null)
- component_parts += new /obj/item/stock_parts/cell/bluespace(null)
+ component_parts += new /obj/item/circuitboard/machine/chem_dispenser/drinks/beer(src)
+ component_parts += new /obj/item/stock_parts/matter_bin/bluespace(src)
+ component_parts += new /obj/item/stock_parts/matter_bin/bluespace(src)
+ component_parts += new /obj/item/stock_parts/capacitor/quadratic(src)
+ component_parts += new /obj/item/stock_parts/manipulator/femto(src)
+ component_parts += new /obj/item/stack/sheet/glass(src, 1)
+ component_parts += new /obj/item/stock_parts/cell/bluespace(src)
+
+ QDEL_LIST(old_parts)
RefreshParts()
/obj/machinery/chem_dispenser/mutagen
@@ -592,14 +606,21 @@
/obj/machinery/chem_dispenser/mutagensaltpeter/Initialize()
. = ..()
+
+ // Cache the old_parts first, we'll delete it after we've changed component_parts to a new list.
+ // This stops handle_atom_del being called on every part when not necessary.
+ var/list/old_parts = component_parts
+
component_parts = list()
- component_parts += new /obj/item/circuitboard/machine/chem_dispenser(null)
- component_parts += new /obj/item/stock_parts/matter_bin/bluespace(null)
- component_parts += new /obj/item/stock_parts/matter_bin/bluespace(null)
- component_parts += new /obj/item/stock_parts/capacitor/quadratic(null)
- component_parts += new /obj/item/stock_parts/manipulator/femto(null)
- component_parts += new /obj/item/stack/sheet/glass(null)
- component_parts += new /obj/item/stock_parts/cell/bluespace(null)
+ component_parts += new /obj/item/circuitboard/machine/chem_dispenser(src)
+ component_parts += new /obj/item/stock_parts/matter_bin/bluespace(src)
+ component_parts += new /obj/item/stock_parts/matter_bin/bluespace(src)
+ component_parts += new /obj/item/stock_parts/capacitor/quadratic(src)
+ component_parts += new /obj/item/stock_parts/manipulator/femto(src)
+ component_parts += new /obj/item/stack/sheet/glass(src, 1)
+ component_parts += new /obj/item/stock_parts/cell/bluespace(src)
+
+ QDEL_LIST(old_parts)
RefreshParts()
/obj/machinery/chem_dispenser/fullupgrade //fully ugpraded stock parts, emagged
@@ -610,14 +631,21 @@
/obj/machinery/chem_dispenser/fullupgrade/Initialize()
. = ..()
dispensable_reagents |= emagged_reagents //adds emagged reagents
+
+ // Cache the old_parts first, we'll delete it after we've changed component_parts to a new list.
+ // This stops handle_atom_del being called on every part when not necessary.
+ var/list/old_parts = component_parts
+
component_parts = list()
- component_parts += new /obj/item/circuitboard/machine/chem_dispenser(null)
- component_parts += new /obj/item/stock_parts/matter_bin/bluespace(null)
- component_parts += new /obj/item/stock_parts/matter_bin/bluespace(null)
- component_parts += new /obj/item/stock_parts/capacitor/quadratic(null)
- component_parts += new /obj/item/stock_parts/manipulator/femto(null)
- component_parts += new /obj/item/stack/sheet/glass(null)
- component_parts += new /obj/item/stock_parts/cell/bluespace(null)
+ component_parts += new /obj/item/circuitboard/machine/chem_dispenser(src)
+ component_parts += new /obj/item/stock_parts/matter_bin/bluespace(src)
+ component_parts += new /obj/item/stock_parts/matter_bin/bluespace(src)
+ component_parts += new /obj/item/stock_parts/capacitor/quadratic(src)
+ component_parts += new /obj/item/stock_parts/manipulator/femto(src)
+ component_parts += new /obj/item/stack/sheet/glass(src, 1)
+ component_parts += new /obj/item/stock_parts/cell/bluespace(src)
+
+ QDEL_LIST(old_parts)
RefreshParts()
/obj/machinery/chem_dispenser/abductor
@@ -672,12 +700,19 @@
/obj/machinery/chem_dispenser/abductor/Initialize()
. = ..()
+
+ // Cache the old_parts first, we'll delete it after we've changed component_parts to a new list.
+ // This stops handle_atom_del being called on every part when not necessary.
+ var/list/old_parts = component_parts
+
component_parts = list()
- component_parts += new /obj/item/circuitboard/machine/chem_dispenser(null)
- component_parts += new /obj/item/stock_parts/matter_bin/bluespace(null)
- component_parts += new /obj/item/stock_parts/matter_bin/bluespace(null)
- component_parts += new /obj/item/stock_parts/capacitor/quadratic(null)
- component_parts += new /obj/item/stock_parts/manipulator/femto(null)
- component_parts += new /obj/item/stack/sheet/glass(null)
- component_parts += new /obj/item/stock_parts/cell/bluespace(null)
+ component_parts += new /obj/item/circuitboard/machine/chem_dispenser(src)
+ component_parts += new /obj/item/stock_parts/matter_bin/bluespace(src)
+ component_parts += new /obj/item/stock_parts/matter_bin/bluespace(src)
+ component_parts += new /obj/item/stock_parts/capacitor/quadratic(src)
+ component_parts += new /obj/item/stock_parts/manipulator/femto(src)
+ component_parts += new /obj/item/stack/sheet/glass(src, 1)
+ component_parts += new /obj/item/stock_parts/cell/bluespace(src)
+
+ QDEL_LIST(old_parts)
RefreshParts()
diff --git a/code/modules/research/server.dm b/code/modules/research/server.dm
index d98fb0333d5..4390075f65c 100644
--- a/code/modules/research/server.dm
+++ b/code/modules/research/server.dm
@@ -22,8 +22,6 @@
. = ..()
name += " [num2hex(rand(1,65535), -1)]" //gives us a random four-digit hex number as part of the name. Y'know, for fluff.
SSresearch.servers |= src
- var/obj/item/circuitboard/machine/B = new /obj/item/circuitboard/machine/rdserver(null)
- B.apply_default_parts(src)
current_temp = get_env_temp()
/obj/machinery/rnd/server/Destroy()
diff --git a/code/modules/swarmers/swarmer.dm b/code/modules/swarmers/swarmer.dm
index eeff8509de1..05d92defe56 100644
--- a/code/modules/swarmers/swarmer.dm
+++ b/code/modules/swarmers/swarmer.dm
@@ -283,7 +283,7 @@
disintegration_effect.pixel_x = target.pixel_x
disintegration_effect.pixel_y = target.pixel_y
disintegration_effect.pixel_z = target.pixel_z
- target.dropContents()
+ target.drop_contents()
if(istype(target, /obj/machinery/computer))
var/obj/machinery/computer/computer_target = target
if(computer_target.circuit)
diff --git a/code/modules/vending/cola.dm b/code/modules/vending/cola.dm
index 42f5f5a7fe9..1afc1308e6f 100644
--- a/code/modules/vending/cola.dm
+++ b/code/modules/vending/cola.dm
@@ -36,7 +36,9 @@
desc = "Uh oh!"
/obj/machinery/vending/cola/random/Initialize()
- ..()
+ // No need to call parent, we're not doing anything with this machine. Just picking a new type of machine to use, spawning it and deleting ourselves.
+ SHOULD_CALL_PARENT(FALSE)
+
var/T = pick(subtypesof(/obj/machinery/vending/cola) - /obj/machinery/vending/cola/random)
new T(loc)
return INITIALIZE_HINT_QDEL
diff --git a/code/modules/vending/snack.dm b/code/modules/vending/snack.dm
index ddddf8daee3..79803894a2d 100644
--- a/code/modules/vending/snack.dm
+++ b/code/modules/vending/snack.dm
@@ -32,7 +32,9 @@
desc = "Uh oh!"
/obj/machinery/vending/snack/random/Initialize()
- ..()
+ // No need to call parent, we're not doing anything with this machine. Just picking a new type of machine to use, spawning it and deleting ourselves.
+ SHOULD_CALL_PARENT(FALSE)
+
var/T = pick(subtypesof(/obj/machinery/vending/snack) - /obj/machinery/vending/snack/random)
new T(loc)
return INITIALIZE_HINT_QDEL