[MIRROR] Fixes loading shells with their own initial circuits [MDB IGNORE] (#10293)

* save shell component properly loads shells that come with their own circuit (#63628)

Attempting to load a BCI or circuit MODsuit module with the save shell component yields an empty circuit. This PR fixes that by making the save shell component check for and delete any pre-existing circuit in the loaded shell.

* Fixes loading shells with their own initial circuits

Co-authored-by: Y0SH1M4S73R <legoboyo@earthlink.net>
This commit is contained in:
SkyratBot
2021-12-27 03:25:37 +01:00
committed by GitHub
parent 744f695a4c
commit edcd051e56

View File

@@ -28,7 +28,12 @@
/obj/item/circuit_component/save_shell/proc/on_post_load(datum/source)
SIGNAL_HANDLER
loaded_shell.AddComponent(/datum/component/shell, starting_circuit = parent)
var/datum/component/shell/shell_component = loaded_shell.GetComponent(/datum/component/shell)
if(!istype(shell_component))
loaded_shell.AddComponent(/datum/component/shell, starting_circuit = parent)
else
QDEL_NULL(shell_component.attached_circuit)
shell_component.attach_circuit(parent)
on_loaded.set_output(COMPONENT_SIGNAL)
/obj/item/circuit_component/save_shell/proc/on_pre_save_to_json(datum/source, list/general_data)