mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-25 17:41:56 +00: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:
@@ -19,6 +19,11 @@
|
||||
var/dos_capacity = 500 // Amount of DoS "packets" in buffer required to crash the relay
|
||||
var/dos_dissipate = 1 // Amount of DoS "packets" dissipated over time.
|
||||
|
||||
component_types = list(
|
||||
/obj/item/stack/cable_coil{amount = 15},
|
||||
/obj/item/weapon/circuitboard/ntnet_relay
|
||||
)
|
||||
|
||||
// TODO: Implement more logic here. For now it's only a placeholder.
|
||||
/obj/machinery/ntnet_relay/operable()
|
||||
if(!..(EMPED))
|
||||
@@ -100,12 +105,10 @@
|
||||
ntnet_global.add_log("Quantum relay manually [enabled ? "enabled" : "disabled"].")
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/ntnet_relay/New()
|
||||
/obj/machinery/ntnet_relay/Initialize()
|
||||
. = ..()
|
||||
uid = gl_uid
|
||||
gl_uid++
|
||||
component_parts = list()
|
||||
component_parts += new /obj/item/stack/cable_coil(src,15)
|
||||
component_parts += new /obj/item/weapon/circuitboard/ntnet_relay(src)
|
||||
|
||||
update_icon()
|
||||
|
||||
@@ -113,7 +116,6 @@
|
||||
ntnet_global.relays.Add(src)
|
||||
NTNet = ntnet_global
|
||||
ntnet_global.add_log("New quantum relay activated. Current amount of linked relays: [NTNet.relays.len]")
|
||||
..()
|
||||
|
||||
/obj/machinery/ntnet_relay/Destroy()
|
||||
if(ntnet_global)
|
||||
|
||||
Reference in New Issue
Block a user