mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-23 21:12:24 +01:00
Machinery Component Initialization Refactor (#3258)
Machinery objects' component_parts list is now automatically populated with the types in the component_types list. Types can have an associated number which is interpreted as an instruction to spawn that number of that type. This eliminates a few Initialize() procs, and simplifies others.
Example:
component_types = list(
/obj/foo/bar,
/obj/baz = 2
)
Other changes:
Cable coils will now no longer force a stack size of 30 when created without their stack size passed as a parameter - this fixes anonymous types not working correctly with cable coils.
This commit is contained in:
@@ -40,20 +40,18 @@
|
||||
|
||||
var/datum/effect_system/sparks/spark_system
|
||||
|
||||
component_types = list(
|
||||
/obj/item/weapon/circuitboard/miningdrill,
|
||||
/obj/item/weapon/stock_parts/matter_bin,
|
||||
/obj/item/weapon/stock_parts/capacitor,
|
||||
/obj/item/weapon/stock_parts/micro_laser,
|
||||
/obj/item/weapon/cell/high
|
||||
)
|
||||
|
||||
/obj/machinery/mining/drill/Initialize()
|
||||
. = ..()
|
||||
|
||||
component_parts = list()
|
||||
component_parts += new /obj/item/weapon/circuitboard/miningdrill(src)
|
||||
component_parts += new /obj/item/weapon/stock_parts/matter_bin(src)
|
||||
component_parts += new /obj/item/weapon/stock_parts/capacitor(src)
|
||||
component_parts += new /obj/item/weapon/stock_parts/micro_laser(src)
|
||||
component_parts += new /obj/item/weapon/cell/high(src)
|
||||
|
||||
spark_system = bind_spark(src, 3)
|
||||
|
||||
RefreshParts()
|
||||
|
||||
/obj/machinery/mining/drill/Destroy()
|
||||
QDEL_NULL(spark_system)
|
||||
return ..()
|
||||
@@ -339,11 +337,9 @@
|
||||
icon_state = "mining_brace"
|
||||
var/obj/machinery/mining/drill/connected
|
||||
|
||||
/obj/machinery/mining/brace/Initialize()
|
||||
. = ..()
|
||||
|
||||
component_parts = list()
|
||||
component_parts += new /obj/item/weapon/circuitboard/miningdrillbrace(src)
|
||||
component_types = list(
|
||||
/obj/item/weapon/circuitboard/miningdrillbrace
|
||||
)
|
||||
|
||||
/obj/machinery/mining/brace/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(connected && connected.active)
|
||||
|
||||
Reference in New Issue
Block a user