Convert most of /obj/machinery to use Initialize rather than New (#17845)

* Switch a bunch of /obj/machinery from /New to /Initialize

This is an easy and uncontroversial batch.
No globs, no late init, and stuff.

* Move more machinery to Initialize

This time the ones dealing with GLOB vars,
as well as some simpler ones i missed previously.

* More tricky New -> Initialize migrations

* The last of machinery Initialize conversion

* fixups

* Newscaster armor fix

* styling

* Comment on armor handling

* Move newscaster armor definition back to datum

* farie82 review

* kill extra .=

Co-authored-by: Farie82 <farie82@users.noreply.github.com>

* farie's review part 2

Co-authored-by: Farie82 <farie82@users.noreply.github.com>

Co-authored-by: Farie82 <farie82@users.noreply.github.com>
This commit is contained in:
moxian
2022-06-29 06:33:52 +00:00
committed by GitHub
parent 3807bf43c7
commit 09e7f54a43
101 changed files with 410 additions and 453 deletions
+4 -4
View File
@@ -23,8 +23,8 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis).
"Teleportation Machinery"
)
/obj/machinery/r_n_d/circuit_imprinter/New()
..()
/obj/machinery/r_n_d/circuit_imprinter/Initialize(mapload)
. = ..()
component_parts = list()
component_parts += new /obj/item/circuitboard/circuit_imprinter(null)
component_parts += new /obj/item/stock_parts/matter_bin(null)
@@ -34,8 +34,8 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis).
create_reagents()
RefreshParts()
/obj/machinery/r_n_d/circuit_imprinter/upgraded/New()
..()
/obj/machinery/r_n_d/circuit_imprinter/upgraded/Initialize(mapload)
. = ..()
component_parts = list()
component_parts += new /obj/item/circuitboard/circuit_imprinter(null)
component_parts += new /obj/item/stock_parts/matter_bin/super(null)
@@ -11,8 +11,8 @@ Note: Must be placed within 3 tiles of the R&D Console
icon_state = "d_analyzer"
var/decon_mod = 0
/obj/machinery/r_n_d/destructive_analyzer/New()
..()
/obj/machinery/r_n_d/destructive_analyzer/Initialize(mapload)
. = ..()
component_parts = list()
component_parts += new /obj/item/circuitboard/destructive_analyzer(null)
component_parts += new /obj/item/stock_parts/scanning_module(null)
@@ -20,8 +20,8 @@ Note: Must be placed within 3 tiles of the R&D Console
component_parts += new /obj/item/stock_parts/micro_laser(null)
RefreshParts()
/obj/machinery/r_n_d/destructive_analyzer/upgraded/New()
..()
/obj/machinery/r_n_d/destructive_analyzer/upgraded/Initialize(mapload)
. = ..()
component_parts = list()
component_parts += new /obj/item/circuitboard/destructive_analyzer(null)
component_parts += new /obj/item/stock_parts/scanning_module/phasic(null)
+9 -5
View File
@@ -78,8 +78,7 @@
if(initial(tempCheck.icon_state) != null)
critical_items += I
/obj/machinery/r_n_d/experimentor/New()
/obj/machinery/r_n_d/experimentor/Initialize(mapload)
..()
component_parts = list()
component_parts += new /obj/item/circuitboard/experimentor(src)
@@ -88,11 +87,16 @@
component_parts += new /obj/item/stock_parts/manipulator(src)
component_parts += new /obj/item/stock_parts/micro_laser(src)
component_parts += new /obj/item/stock_parts/micro_laser(src)
spawn(1)
trackedIan = locate(/mob/living/simple_animal/pet/dog/corgi/Ian) in GLOB.mob_living_list
trackedRuntime = locate(/mob/living/simple_animal/pet/cat/Runtime) in GLOB.mob_living_list
SetTypeReactions()
RefreshParts()
return INITIALIZE_HINT_LATELOAD
/obj/machinery/r_n_d/experimentor/LateInitialize()
..()
// GLOB.mob_living_list gets populated in /mob/Initialize()
// so we need to delay searching for those until after the Initialize()
trackedIan = locate(/mob/living/simple_animal/pet/dog/corgi/Ian) in GLOB.mob_living_list
trackedRuntime = locate(/mob/living/simple_animal/pet/cat/Runtime) in GLOB.mob_living_list
/obj/machinery/r_n_d/experimentor/RefreshParts()
for(var/obj/item/stock_parts/manipulator/M in component_parts)
+4 -4
View File
@@ -25,8 +25,8 @@ Note: Must be placed west/left of and R&D console to function.
"Weapons"
)
/obj/machinery/r_n_d/protolathe/New()
..()
/obj/machinery/r_n_d/protolathe/Initialize(mapload)
. = ..()
component_parts = list()
component_parts += new /obj/item/circuitboard/protolathe(null)
component_parts += new /obj/item/stock_parts/matter_bin(null)
@@ -38,8 +38,8 @@ Note: Must be placed west/left of and R&D console to function.
create_reagents()
RefreshParts()
/obj/machinery/r_n_d/protolathe/upgraded/New()
..()
/obj/machinery/r_n_d/protolathe/upgraded/Initialize(mapload)
. = ..()
component_parts = list()
component_parts += new /obj/item/circuitboard/protolathe(null)
component_parts += new /obj/item/stock_parts/matter_bin/super(null)
+2 -9
View File
@@ -162,17 +162,10 @@ won't update every console in existence) but it's more of a hassle to do. Also,
KT.level=KT.max_level
files.RefreshResearch()
/obj/machinery/computer/rdconsole/New()
..()
/obj/machinery/computer/rdconsole/Initialize(mapload)
. = ..()
files = new /datum/research(src) //Setup the research data holder.
matching_designs = list()
if(!id)
for(var/obj/machinery/r_n_d/server/centcom/S in GLOB.machines)
S.initialize_serv()
break
/obj/machinery/computer/rdconsole/Initialize()
..()
SyncRDevices()
/obj/machinery/computer/rdconsole/Destroy()
+9 -4
View File
@@ -21,10 +21,10 @@
var/efficiency_coeff = 1
var/list/categories = list()
/obj/machinery/r_n_d/New()
materials = AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TRANQUILLITE, MAT_TITANIUM, MAT_BLUESPACE, MAT_PLASTIC), 0, TRUE, /obj/item/stack, CALLBACK(src, .proc/is_insertion_ready), CALLBACK(src, .proc/AfterMaterialInsert))
materials.precise_insertion = TRUE
..()
/obj/machinery/r_n_d/Initialize(mapload)
. = ..()
wires["Red"] = 0
wires["Blue"] = 0
wires["Green"] = 0
@@ -36,6 +36,11 @@
shock_wire = pick_n_take(w)
disable_wire = pick_n_take(w)
/obj/machinery/r_n_d/ComponentInitialize()
..()
materials = AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TRANQUILLITE, MAT_TITANIUM, MAT_BLUESPACE, MAT_PLASTIC), 0, TRUE, /obj/item/stack, CALLBACK(src, .proc/is_insertion_ready), CALLBACK(src, .proc/AfterMaterialInsert))
materials.precise_insertion = TRUE
/obj/machinery/r_n_d/Destroy()
if(loaded_item)
loaded_item.forceMove(get_turf(src))
+4 -4
View File
@@ -15,8 +15,8 @@
req_access = list(ACCESS_RD) //Only the R&D can change server settings.
var/plays_sound = 0
/obj/machinery/r_n_d/server/New()
..()
/obj/machinery/r_n_d/server/Initialize(mapload)
. = ..()
component_parts = list()
component_parts += new /obj/item/circuitboard/rdserver(null)
component_parts += new /obj/item/stock_parts/scanning_module(null)
@@ -25,8 +25,8 @@
RefreshParts()
initialize_serv(); //Agouri // fuck you agouri
/obj/machinery/r_n_d/server/upgraded/New()
..()
/obj/machinery/r_n_d/server/upgraded/Initialize(mapload)
. = ..()
component_parts = list()
component_parts += new /obj/item/circuitboard/rdserver(null)
component_parts += new /obj/item/stock_parts/scanning_module/phasic(null)
@@ -41,7 +41,11 @@
icon_screen = "slime_comp"
icon_keyboard = "rd_key"
/obj/machinery/computer/camera_advanced/xenobio/New()
/obj/machinery/computer/camera_advanced/xenobio/Initialize(mapload)
..()
return INITIALIZE_HINT_LATELOAD
/obj/machinery/computer/camera_advanced/xenobio/LateInitialize()
..()
for(var/obj/machinery/monkey_recycler/recycler in GLOB.monkey_recyclers)
if(get_area(recycler.loc) == get_area(loc))