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
@@ -153,8 +153,8 @@
icon_state = "sleeper-open"
density = FALSE
/obj/machinery/sleeper/survival_pod/New()
..()
/obj/machinery/sleeper/survival_pod/Initialize(mapload)
. = ..()
component_parts = list()
component_parts += new /obj/item/circuitboard/sleeper/survival(null)
var/obj/item/stock_parts/matter_bin/B = new(null)
@@ -33,9 +33,10 @@
var/list/affected_targets = list()
var/activation_sound = 'sound/effects/break_stone.ogg'
/obj/machinery/anomalous_crystal/New()
/obj/machinery/anomalous_crystal/Initialize(mapload)
. = ..()
activation_method = pick("touch","laser","bullet","energy","bomb","mob_bump","weapon","speech") // "heat" removed due to lack of is_hot()
..()
/obj/machinery/anomalous_crystal/hear_talk(mob/speaker, list/message_pieces)
..()
@@ -76,11 +77,11 @@
/obj/machinery/anomalous_crystal/ex_act()
ActivationReaction(null,"bomb")
/obj/machinery/anomalous_crystal/random/New() //Just a random crysal spawner for loot
/obj/machinery/anomalous_crystal/random/Initialize() //Just a random crysal spawner for loot
. = ..()
var/random_crystal = pick(typesof(/obj/machinery/anomalous_crystal) - /obj/machinery/anomalous_crystal/random - /obj/machinery/anomalous_crystal)
new random_crystal(loc)
qdel(src)
return INITIALIZE_HINT_QDEL
/obj/machinery/anomalous_crystal/theme_warp //Warps the area you're in to look like a new one
activation_method = "touch"
@@ -93,8 +94,8 @@
var/list/NewFlora = list()
var/florachance = 8
/obj/machinery/anomalous_crystal/theme_warp/New()
..()
/obj/machinery/anomalous_crystal/theme_warp/Initialize(mapload)
. = ..()
terrain_theme = pick("lavaland","winter","jungle","alien")
switch(terrain_theme)
if("lavaland")//Depressurizes the place... and free cult metal, I guess.
@@ -161,8 +162,8 @@
cooldown_add = 50
var/generated_projectile = /obj/item/projectile/beam/emitter
/obj/machinery/anomalous_crystal/emitter/New()
..()
/obj/machinery/anomalous_crystal/emitter/Initialize(mapload)
. = ..()
generated_projectile = pick(/obj/item/projectile/magic/fireball/infernal,
/obj/item/projectile/bullet/meteorshot, /obj/item/projectile/beam/xray, /obj/item/projectile/colossus)
@@ -299,8 +300,8 @@
var/list/banned_items_typecache = list(/obj/item/storage, /obj/item/implant, /obj/item/implanter, /obj/item/disk/nuclear,
/obj/item/projectile, /obj/item/spellbook, /obj/item/clothing/mask/facehugger, /obj/item/contractor_uplink)
/obj/machinery/anomalous_crystal/refresher/New()
..()
/obj/machinery/anomalous_crystal/refresher/Initialize(mapload)
. = ..()
banned_items_typecache = typecacheof(banned_items_typecache)
+11 -9
View File
@@ -55,11 +55,13 @@
/// The currently inserted design disk.
var/obj/item/disk/design_disk/inserted_disk
/obj/machinery/mineral/ore_redemption/New()
/obj/machinery/mineral/ore_redemption/ComponentInitialize()
..()
ore_buffer = list()
// Components
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), INFINITY, FALSE, /obj/item/stack, null, CALLBACK(src, .proc/on_material_insert))
/obj/machinery/mineral/ore_redemption/Initialize(mapload)
. = ..()
ore_buffer = list()
files = new /datum/research/smelter(src)
// Stock parts
component_parts = list()
@@ -71,8 +73,8 @@
component_parts += new /obj/item/stack/sheet/glass(null)
RefreshParts()
/obj/machinery/mineral/ore_redemption/upgraded/New()
..()
/obj/machinery/mineral/ore_redemption/upgraded/Initialize(mapload)
. = ..()
component_parts = list()
component_parts += new /obj/item/circuitboard/ore_redemption(null)
component_parts += new /obj/item/stock_parts/matter_bin/super(null)
@@ -91,8 +93,8 @@
req_access = list(ACCESS_FREE_GOLEMS)
req_access_claim = ACCESS_FREE_GOLEMS
/obj/machinery/mineral/ore_redemption/golem/New()
..()
/obj/machinery/mineral/ore_redemption/golem/Initialize(mapload)
. = ..()
component_parts = list()
component_parts += new /obj/item/circuitboard/ore_redemption/golem(null)
component_parts += new /obj/item/stock_parts/matter_bin(null)
@@ -112,8 +114,8 @@
req_access = list()
anyone_claim = TRUE
/obj/machinery/mineral/ore_redemption/labor/New()
..()
/obj/machinery/mineral/ore_redemption/labor/Initialize(mapload)
. = ..()
component_parts = list()
component_parts += new /obj/item/circuitboard/ore_redemption/labor(null)
component_parts += new /obj/item/stock_parts/matter_bin(null)
+6 -6
View File
@@ -17,8 +17,8 @@
var/list/prize_list // Initialized just below! (if you're wondering why - check CONTRIBUTING.md, look for: "hidden" init proc)
var/dirty_items = FALSE // Used to refresh the static/redundant data in case the machine gets VV'd
/obj/machinery/mineral/equipment_vendor/New()
..()
/obj/machinery/mineral/equipment_vendor/Initialize(mapload)
. = ..()
component_parts = list()
component_parts += new /obj/item/circuitboard/mining_equipment_vendor(null)
component_parts += new /obj/item/stock_parts/matter_bin(null)
@@ -277,8 +277,8 @@
/obj/machinery/mineral/equipment_vendor/golem
name = "golem ship equipment vendor"
/obj/machinery/mineral/equipment_vendor/golem/New()
..()
/obj/machinery/mineral/equipment_vendor/golem/Initialize(mapload)
. = ..()
component_parts = list()
component_parts += new /obj/item/circuitboard/mining_equipment_vendor/golem(null)
component_parts += new /obj/item/stock_parts/matter_bin(null)
@@ -308,8 +308,8 @@
name = "labor camp equipment vendor"
desc = "An equipment vendor for scum, points collected at an ore redemption machine can be spent here."
/obj/machinery/mineral/equipment_vendor/labor/New()
..()
/obj/machinery/mineral/equipment_vendor/labor/Initialize(mapload)
. = ..()
component_parts = list()
component_parts += new /obj/item/circuitboard/mining_equipment_vendor/labor(null)
component_parts += new /obj/item/stock_parts/matter_bin(null)
+1 -1
View File
@@ -14,7 +14,7 @@
speed_process = TRUE
/obj/machinery/mineral/mint/New()
/obj/machinery/mineral/mint/ComponentInitialize()
..()
AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_PLASMA, MAT_SILVER, MAT_GOLD, MAT_URANIUM, MAT_DIAMOND, MAT_BANANIUM, MAT_TRANQUILLITE), MINERAL_MATERIAL_AMOUNT * 50, FALSE, /obj/item/stack)