/atom New() => Initialize() [MDB IGNORE] (#8298)

* Find and replace argless atom New() to Initialize().

* Manual replacement of no-arg New() to Initialize().

* Manually replacing remaining New() overrides.

* Fixing linter issues with now-removed New() args.

* Tidying area init overrides.

* Porting Neb's atom subsystem.

* Trying to isolate init problems.

* Adjusting Init code post-test.

* Merging duplicate Initialize() procs.

* Merge resolution.
This commit is contained in:
MistakeNot4892
2021-11-14 19:09:14 +11:00
committed by GitHub
parent 0051b29ead
commit 2f0a618d45
589 changed files with 2903 additions and 3005 deletions

View File

@@ -17,8 +17,8 @@
var/obj/item/projectile/BB = null //The loaded bullet - make it so that the projectiles are created only when needed?
var/caseless = null //Caseless ammo deletes its self once the projectile is fired.
/obj/item/ammo_casing/New()
..()
/obj/item/ammo_casing/Initialize()
. = ..()
if(ispath(projectile_type))
BB = new projectile_type(src)
randpixel_xy()
@@ -125,8 +125,8 @@
var/list/icon_keys = list() //keys
var/list/ammo_states = list() //values
/obj/item/ammo_magazine/New()
..()
/obj/item/ammo_magazine/Initialize()
. = ..()
pixel_x = rand(-5, 5)
pixel_y = rand(-5, 5)
if(multiple_sprites)

View File

@@ -26,13 +26,13 @@
var/emagged = 0 // If you emag the smart mag, you can get the bullets out by clicking it
/obj/item/ammo_magazine/smart/New()
/obj/item/ammo_magazine/smart/Initialize()
START_PROCESSING(SSobj, src)
..()
. = ..()
/obj/item/ammo_magazine/smart/Destroy()
STOP_PROCESSING(SSobj, src)
..()
. = ..()
/obj/item/ammo_magazine/smart/process()
if(!holding_gun) // Yes, this is awful, sorry. Don't know a better way to figure out if we've been moved into or out of a gun.

View File

@@ -9,19 +9,18 @@
var/do_rotation = TRUE
/obj/item/weapon/broken_gun/New(var/newloc, var/path)
..()
/obj/item/weapon/broken_gun/Initialize(var/ml, var/path)
. = ..(ml)
if(path)
if(!setup_gun(path))
qdel(src)
return
setup_repair_needs()
addtimer(CALLBACK(src, .proc/validate_gun_type), 30 SECONDS)
/obj/item/weapon/broken_gun/Initialize()
. = ..()
spawn(30 SECONDS)
if(!my_guntype && !QDELETED(src))
qdel(src)
/obj/item/weapon/broken_gun/proc/validate_gun_type()
if(!my_guntype && !QDELETED(src))
qdel(src)
/obj/item/weapon/broken_gun/examine(mob/user)
. = ..()

View File

@@ -1,9 +1,9 @@
/obj/item/weapon/broken_gun/laserrifle/New(var/newloc)
..(newloc, /obj/item/weapon/gun/energy/laser/empty)
/obj/item/weapon/broken_gun/laserrifle/Initialize(var/ml)
. = ..(ml, /obj/item/weapon/gun/energy/laser/empty)
/obj/item/weapon/broken_gun/laser_retro/New(var/newloc)
..(newloc, /obj/item/weapon/gun/energy/retro/empty)
/obj/item/weapon/broken_gun/laser_retro/Initialize(var/ml)
. = ..(ml, /obj/item/weapon/gun/energy/retro/empty)
/obj/item/weapon/broken_gun/ionrifle/New(var/newloc)
..(newloc, /obj/item/weapon/gun/energy/ionrifle/empty)
/obj/item/weapon/broken_gun/ionrifle/Initialize(var/ml)
. = ..(ml, /obj/item/weapon/gun/energy/ionrifle/empty)

View File

@@ -1,3 +1,3 @@
/obj/item/weapon/broken_gun/grenadelauncher/New(var/newloc)
..(newloc, /obj/item/weapon/gun/launcher/grenade)
/obj/item/weapon/broken_gun/grenadelauncher/Initialize(var/ml)
. = ..(ml, /obj/item/weapon/gun/launcher/grenade)

View File

@@ -1,3 +1,3 @@
/obj/item/weapon/broken_gun/flechette/New(var/newloc)
..(newloc, /obj/item/weapon/gun/magnetic/railgun/flechette)
/obj/item/weapon/broken_gun/flechette/Initialize(var/ml)
. = ..(ml, /obj/item/weapon/gun/magnetic/railgun/flechette)

View File

@@ -1,18 +1,18 @@
/obj/item/weapon/broken_gun/c20r/New(var/newloc)
..(newloc, /obj/item/weapon/gun/projectile/automatic/c20r/empty)
/obj/item/weapon/broken_gun/c20r/Initialize(var/ml)
. = ..(ml, /obj/item/weapon/gun/projectile/automatic/c20r/empty)
/obj/item/weapon/broken_gun/silenced45/New(var/newloc)
..(newloc, /obj/item/weapon/gun/projectile/silenced/empty)
/obj/item/weapon/broken_gun/silenced45/Initialize(var/ml)
. = ..(ml, /obj/item/weapon/gun/projectile/silenced/empty)
/obj/item/weapon/broken_gun/pumpshotgun/New(var/newloc)
..(newloc, /obj/item/weapon/gun/projectile/shotgun/pump/empty)
/obj/item/weapon/broken_gun/pumpshotgun/Initialize(var/ml)
. = ..(ml, /obj/item/weapon/gun/projectile/shotgun/pump/empty)
/obj/item/weapon/broken_gun/pumpshotgun_combat/New(var/newloc)
..(newloc, /obj/item/weapon/gun/projectile/shotgun/pump/combat/empty)
/obj/item/weapon/broken_gun/pumpshotgun_combat/Initialize(var/ml)
. = ..(ml, /obj/item/weapon/gun/projectile/shotgun/pump/combat/empty)
/obj/item/weapon/broken_gun/z8/New(var/newloc)
..(newloc, /obj/item/weapon/gun/projectile/automatic/z8/empty)
/obj/item/weapon/broken_gun/z8/Initialize(var/ml)
. = ..(ml, /obj/item/weapon/gun/projectile/automatic/z8/empty)
/obj/item/weapon/broken_gun/dartgun/New(var/newloc)
..(newloc, /obj/item/weapon/gun/projectile/dartgun)
/obj/item/weapon/broken_gun/dartgun/Initialize(var/ml)
. = ..(ml, /obj/item/weapon/gun/projectile/dartgun)

View File

@@ -93,8 +93,8 @@
var/last_shot = 0 //records the last shot fired
/obj/item/weapon/gun/New()
..()
/obj/item/weapon/gun/Initialize()
. = ..()
for(var/i in 1 to firemodes.len)
firemodes[i] = new /datum/firemode(src, firemodes[i])
@@ -307,6 +307,7 @@
src.add_fingerprint(usr)
/obj/item/weapon/gun/proc/Fire(atom/target, mob/living/user, clickparams, pointblank=0, reflex=0)
set waitfor = FALSE
if(!user || !target) return
if(target.z != user.z) return

View File

@@ -14,14 +14,12 @@
var/active = 0//Just tells us that it was clicked on so we should start shooting
var/delay_del = 0//Delays the del if we retarget without shooting
/obj/screen/auto_target/New(loc, var/obj/item/weapon/gun/G)
..()
gun = G
var/image/I = image('icons/effects/Targeted.dmi', src, "locked")
I.override = 1
usr << I
//autodel() //Currently doesn't really work right.
return
/obj/screen/auto_target/Initialize(var/ml, var/obj/item/weapon/gun/G)
. = ..()
gun = G
var/image/I = image('icons/effects/Targeted.dmi', src, "locked")
I.override = 1
usr << I
/obj/screen/auto_target/CanPass()//Everything should ignore this guy and just pass by
return 1

View File

@@ -24,8 +24,8 @@
var/battery_lock = 0 //If set, weapon cannot switch batteries
/obj/item/weapon/gun/energy/New()
..()
/obj/item/weapon/gun/energy/Initialize()
. = ..()
if(self_recharge)
power_supply = new /obj/item/weapon/cell/device/weapon(src)
START_PROCESSING(SSobj, src)

View File

@@ -20,8 +20,8 @@
var/force_divisor = 400 // Force equates to speed. Speed/5 equates to a damage multiplier for whoever you hit.
// For reference, a fully pressurized oxy tank at 50% gas release firing a health
// analyzer with a force_divisor of 10 hit with a damage multiplier of 3000+.
/obj/item/weapon/gun/launcher/pneumatic/New()
..()
/obj/item/weapon/gun/launcher/pneumatic/Initialize()
. = ..()
item_storage = new(src)
item_storage.name = "hopper"
item_storage.max_w_class = max_w_class

View File

@@ -303,7 +303,7 @@
return new projectile_type(src)
/obj/item/weapon/gun/magnetic/fuelrod/New()
/obj/item/weapon/gun/magnetic/fuelrod/Initialize()
cell = new /obj/item/weapon/cell/high
capacitor = new /obj/item/weapon/stock_parts/capacitor
. = ..()

View File

@@ -28,8 +28,8 @@
//Excessively long because it won't accept subtypes for some reason!
/obj/item/weapon/gun/energy/modular/New() //Initialize our components.
..()
/obj/item/weapon/gun/energy/modular/Initialize()
. = ..()
guncomponents = list()
guncomponents += new /obj/item/weapon/stock_parts/capacitor
guncomponents += new /obj/item/weapon/stock_parts/micro_laser

View File

@@ -33,8 +33,8 @@
//var/list/icon_keys = list() //keys
//var/list/ammo_states = list() //values
/obj/item/weapon/gun/projectile/New(loc, var/starts_loaded = 1)
..()
/obj/item/weapon/gun/projectile/Initialize(var/ml, var/starts_loaded = 1)
. = ..()
if(starts_loaded)
if(ispath(ammo_type) && (load_method & (SINGLE_CASING|SPEEDLOADER)))
for(var/i in 1 to max_shells)

View File

@@ -163,8 +163,8 @@
var/use_launcher = 0
var/obj/item/weapon/gun/launcher/grenade/underslung/launcher
/obj/item/weapon/gun/projectile/automatic/z8/New()
..()
/obj/item/weapon/gun/projectile/automatic/z8/Initialize()
. = ..()
launcher = new(src)
/obj/item/weapon/gun/projectile/automatic/z8/attackby(obj/item/I, mob/user)

View File

@@ -7,9 +7,9 @@
muzzle_type = null
/obj/item/projectile/bullet/chemdart/New()
reagents = new/datum/reagents(reagent_amount)
reagents.my_atom = src
/obj/item/projectile/bullet/chemdart/Initialize()
create_reagents(reagent_amount)
. = ..()
/obj/item/projectile/bullet/chemdart/on_hit(var/atom/target, var/blocked = 0, var/def_zone = null)
if(blocked < 2 && isliving(target))
@@ -69,8 +69,8 @@
var/container_type = /obj/item/weapon/reagent_containers/glass/beaker
var/list/starting_chems = null
/obj/item/weapon/gun/projectile/dartgun/New()
..()
/obj/item/weapon/gun/projectile/dartgun/Initialize()
. = ..()
if(starting_chems)
for(var/chem in starting_chems)
var/obj/B = new container_type(src)

View File

@@ -269,13 +269,13 @@
/obj/item/ammo_casing/a545 = "5.45mm"
)
/obj/item/weapon/gun/projectile/pirate/New()
/obj/item/weapon/gun/projectile/pirate/Initialize()
ammo_type = pick(ammo_types)
desc += " Uses [ammo_types[ammo_type]] rounds."
var/obj/item/ammo_casing/ammo = ammo_type
caliber = initial(ammo.caliber)
..()
. = ..()
/obj/item/weapon/gun/projectile/derringer
name = "derringer"

View File

@@ -198,10 +198,10 @@
var/list/tertiary_loaded = list()
/obj/item/weapon/gun/projectile/revolver/lemat/New()
/obj/item/weapon/gun/projectile/revolver/lemat/Initialize()
for(var/i in 1 to secondary_max_shells)
secondary_loaded += new secondary_ammo_type(src)
..()
. = ..()
/obj/item/weapon/gun/projectile/revolver/lemat/verb/swap_firingmode()
set name = "Swap Firing Mode"

View File

@@ -49,24 +49,24 @@
name = "AM rifle barrel"
icon_state = "heavysniper-barrel"
/obj/item/sniper_rifle_part/barrel/New()
..()
/obj/item/sniper_rifle_part/barrel/Initialize()
. = ..()
barrel = src
/obj/item/sniper_rifle_part/stock
name = "AM rifle stock"
icon_state = "heavysniper-stock"
/obj/item/sniper_rifle_part/stock/New()
..()
/obj/item/sniper_rifle_part/stock/Initialize()
. = ..()
stock = src
/obj/item/sniper_rifle_part/trigger_group
name = "AM rifle trigger assembly"
icon_state = "heavysniper-trig"
/obj/item/sniper_rifle_part/trigger_group/New()
..()
/obj/item/sniper_rifle_part/trigger_group/Initialize()
. = ..()
trigger_group = src
/obj/item/sniper_rifle_part/attack_self(mob/user as mob)

View File

@@ -18,8 +18,8 @@
fire_sound = 'sound/weapons/bladeslice.ogg'
fire_sound_text = "a strange noise"
/obj/item/weapon/gun/launcher/spikethrower/New()
..()
/obj/item/weapon/gun/launcher/spikethrower/Initialize()
. = ..()
START_PROCESSING(SSobj, src)
last_regen = world.time

View File

@@ -14,16 +14,16 @@
/obj/item/projectile/energy/blob/splattering
splatter = TRUE
/obj/item/projectile/energy/blob/New()
/obj/item/projectile/energy/blob/Initialize()
if(splatter)
create_reagents(splatter_volume)
ready_chemicals()
..()
. = ..()
/obj/item/projectile/energy/blob/Destroy()
qdel(reagents)
reagents = null
..()
. = ..()
/obj/item/projectile/energy/blob/on_impact(var/atom/A)
if(splatter)

View File

@@ -66,7 +66,7 @@
..() //initial flash
//residual illumination
new /obj/effect/effect/smoke/illumination(src.loc, rand(190,240) SECONDS, range=8, power=3, color=light_colour) //same lighting power as flare
new /obj/effect/effect/smoke/illumination(src.loc, rand(190,240) SECONDS, 8, 3, light_colour) //same lighting power as flare
/obj/item/projectile/energy/electrode
name = "electrode"

View File

@@ -18,10 +18,12 @@
var/active = 0 // Is our owner intending to take hostages?
var/target_permissions = 0 // Permission bitflags.
/obj/aiming_overlay/New(var/newowner)
..()
owner = newowner
loc = null
/obj/aiming_overlay/Initialize()
. = ..()
owner = loc
if(!istype(owner))
return INITIALIZE_HINT_QDEL
moveToNullspace()
verbs.Cut()
/obj/aiming_overlay/proc/toggle_permission(var/perm)