migrate all /obj/item from /New() to /Initialize() (#31232)

* migrate all /obj/item from /New() to /Initialize()

* move GLOB.chemical_reagents_list creation to /world/New()

* review

* oops

* autodoc a smart var
This commit is contained in:
Toastical
2026-01-28 19:44:32 +00:00
committed by GitHub
parent a0ed4b0066
commit 4c74b78a18
89 changed files with 321 additions and 362 deletions
@@ -170,7 +170,8 @@
brainmob.emp_damage += rand(10, 20)
..()
/obj/item/mmi/robotic_brain/New()
/obj/item/mmi/robotic_brain/Initialize(mapload)
. = ..()
brainmob = new(src)
brainmob.name = "[pick("PBU", "HIU", "SINA", "ARMA", "OSI")]-[rand(100, 999)]"
brainmob.real_name = brainmob.name
@@ -183,7 +184,6 @@
brainmob.dna.ResetSE()
brainmob.dna.ResetUI()
GLOB.dead_mob_list -= brainmob
..()
/obj/item/mmi/robotic_brain/attack_ghost(mob/dead/observer/O)
if(brainmob && brainmob.key)
@@ -266,7 +266,7 @@
if(ITEM_SLOT_LEFT_EAR)
l_ear = I
// if(l_ear.slot_flags & ITEM_SLOT_LEFT_EAR) CHAP-TODO: ACTUALLY FIX OFFEARS OR REMOVE THEM COMPLETELY
// var/obj/item/clothing/ears/offear/O = new(I)
// var/obj/item/clothing/ears/offear/O = new(I, I)
// O.forceMove(src)
// r_ear = O
// O.layer = ABOVE_HUD_LAYER
@@ -275,7 +275,7 @@
if(ITEM_SLOT_RIGHT_EAR)
r_ear = I
// if(r_ear.slot_flags & ITEM_SLOT_RIGHT_EAR)
// var/obj/item/clothing/ears/offear/O = new(I)
// var/obj/item/clothing/ears/offear/O = new(I, I)
// O.forceMove(src)
// l_ear = O
// O.layer = ABOVE_HUD_LAYER
@@ -265,7 +265,7 @@
continue
var/list/organ_data = has_limbs[limb_name]
var/limb_path = organ_data["path"]
var/obj/item/organ/O = new limb_path(H)
var/obj/item/organ/O = new limb_path(H, H)
organ_data["descriptor"] = O.name
// Transfer things from the old organ to the new
if(istype(O, /obj/item/organ/external) && transfer_list[limb_name])
@@ -295,7 +295,7 @@
// not doing so (as of now) causes weird issues for some organs like posibrains, which need a mob on init or they'll qdel themselves.
// for the record: this caused every single IPC's brain to be deleted randomly throughout a round, killing them instantly.
new organ_path(H)
new organ_path(H, H)
create_mutant_organs(H)
@@ -318,7 +318,7 @@
qdel(ears)
if(mutantears && !isnull(H.bodyparts_by_name[initial(mutantears.parent_organ)]))
new mutantears(H)
new mutantears(H, H)
/datum/species/proc/breathe(mob/living/carbon/human/H)
var/datum/organ/lungs/lung = H.get_int_organ_datum(ORGAN_DATUM_LUNGS)
+1 -1
View File
@@ -316,7 +316,7 @@
add_attack_logs(user, src, "Grabbed passively", ATKLOG_ALL)
var/obj/item/grab/G = new /obj/item/grab(user, src)
var/obj/item/grab/G = new /obj/item/grab(user, user, src)
if(!G) //the grab will delete itself in New if src is anchored
return 0
user.put_in_active_hand(G)
@@ -39,8 +39,8 @@
var/module_type = "NoMod"
/obj/item/robot_module/New()
..()
/obj/item/robot_module/Initialize(mapload)
. = ..()
// Creates new objects from the type lists.
for(var/i in basic_modules)
@@ -79,6 +79,7 @@
if(I) // If it exists, add the object reference.
special_rechargables += I
special_rechargables -= path // No matter what, remove the path from the list.
module_armor = getArmor(arglist(module_armor))
// Add all the modules into the robot's inventory. Without this, their inventory will be blank.
rebuild_modules()
@@ -102,9 +103,6 @@
QDEL_LIST_CONTENTS(special_rechargables)
return ..()
/obj/item/robot_module/Initialize(mapload)
. = ..()
module_armor = getArmor(arglist(module_armor))
/**
* Searches through the various module lists for the given `item_type`, deletes and removes the item from all supplied lists, if the item is found.
*
@@ -1129,4 +1127,3 @@
statpanel_name = "Metal"
stack = /obj/item/stack/sheet/metal
add_to_storage = TRUE
@@ -358,8 +358,8 @@
var/treatment_virus = "spaceacillin"
var/robot_arm = /obj/item/robot_parts/l_arm
/obj/item/firstaid_arm_assembly/New(loc, new_skin)
..()
/obj/item/firstaid_arm_assembly/Initialize(mapload, new_skin)
. = ..()
if(new_skin)
skin = new_skin
update_icon(UPDATE_OVERLAYS)
+2 -2
View File
@@ -27,8 +27,8 @@
plane = HUD_PLANE
w_class = WEIGHT_CLASS_BULKY
/obj/item/grab/New(mob/user, mob/victim)
..()
/obj/item/grab/Initialize(mapload, mob/user, mob/victim)
. = ..()
//Okay, first off, some fucking sanity checking. No user, or no victim, or they are not mobs, no grab.
if(!istype(user) || !istype(victim))
+2 -2
View File
@@ -5,8 +5,8 @@
icon = 'icons/obj/objects.dmi'
slot_flags = ITEM_SLOT_HEAD|ITEM_SLOT_NECK
/obj/item/holder/New()
..()
/obj/item/holder/Initialize(mapload)
. = ..()
START_PROCESSING(SSobj, src)
/obj/item/holder/Destroy()