mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 21:18:37 +01:00
Fixes various issues related to machine component contents. (#53943)
Fixes machines not referencing their circuits in their component parts when built manually, causing them to vomit out their circuit board when opened. This also fixes Runtime in _machinery.dm, line 607: Cannot read null.req_components from using the B/RPEDs. Fixes computers not storing circuits in the contents. Fixes smartfridges vending their components.
This commit is contained in:
@@ -16,6 +16,28 @@
|
||||
var/build_path = null
|
||||
|
||||
/obj/item/circuitboard/proc/apply_default_parts(obj/machinery/M)
|
||||
if(LAZYLEN(M.component_parts))
|
||||
// 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: [M]")
|
||||
|
||||
// Move to nullspace so you don't trigger handle_atom_del logic and remove existing parts.
|
||||
for(var/obj/item/part in M.component_parts)
|
||||
part.moveToNullspace(loc)
|
||||
qdel(part)
|
||||
|
||||
// List of components always contains the circuit board used to build it.
|
||||
M.component_parts = list(src)
|
||||
forceMove(M)
|
||||
|
||||
if(M.circuit != src)
|
||||
// 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: [M]")
|
||||
|
||||
// Move to nullspace so you don't trigger handle_atom_del logic, remove old circuit, add new circuit.
|
||||
M.circuit.moveToNullspace()
|
||||
qdel(M.circuit)
|
||||
M.circuit = src
|
||||
|
||||
return
|
||||
|
||||
// Circuitboard/machine
|
||||
@@ -36,8 +58,7 @@ micro-manipulator, console screen, beaker, Microlaser, matter bin, power cells.
|
||||
if(!req_components)
|
||||
return
|
||||
|
||||
M.component_parts = list(src) // List of components always contains a board
|
||||
forceMove(M)
|
||||
. = ..()
|
||||
|
||||
for(var/comp_path in req_components)
|
||||
var/comp_amt = req_components[comp_path]
|
||||
|
||||
Reference in New Issue
Block a user