Skip to content

Commit

Permalink
Replaces ComponentInitialize with Initialize (yogstation13#19164)
Browse files Browse the repository at this point in the history
* Removes ComponentInitialize

Removes ComponentInitialize in favor of using Initialize instead, removing the 4 instances that call ComponentInitialize on everything.
Also makes the EMP-proof cell EMP-proof, with some minor code adjustments to stasis component (no in-game changes).

* Adds parent calls to structures

* Update tables_racks.dm
  • Loading branch information
JohnFulpWillard authored Jun 10, 2023
1 parent 69a99d3 commit 323ca60
Show file tree
Hide file tree
Showing 101 changed files with 259 additions and 403 deletions.
2 changes: 1 addition & 1 deletion code/datums/components/rotation.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
var/rotation_flags = NONE
var/default_rotation_direction = ROTATION_CLOCKWISE

/datum/component/simple_rotation/Initialize(rotation_flags = NONE ,can_user_rotate,can_be_rotated,after_rotation)
/datum/component/simple_rotation/Initialize(rotation_flags = NONE, can_user_rotate, can_be_rotated, after_rotation)
if(!ismovable(parent))
return COMPONENT_INCOMPATIBLE

Expand Down
8 changes: 4 additions & 4 deletions code/datums/components/surgery_bed.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
/// Linked computer for getting surgeries
var/obj/machinery/computer/operating/computer

/datum/component/surgery_bed/Initialize(_success_chance = 1, _op_computer_linkable = FALSE, _extra_surgeries)
success_chance = _success_chance
op_computer_linkable = _op_computer_linkable
extra_surgeries = _extra_surgeries
/datum/component/surgery_bed/Initialize(success_chance = 1, op_computer_linkable = FALSE, extra_surgeries = FALSE)
src.success_chance = success_chance
src.op_computer_linkable = op_computer_linkable
src.extra_surgeries = extra_surgeries
get_computer()

/datum/component/surgery_bed/Destroy()
Expand Down
6 changes: 0 additions & 6 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@
custom_materials = null //Null the list to prepare for applying the materials properly
set_custom_materials(temp_list)

ComponentInitialize()

return INITIALIZE_HINT_NORMAL

/**
Expand All @@ -198,10 +196,6 @@
/atom/proc/LateInitialize()
return

/// Put your AddComponent() calls here
/atom/proc/ComponentInitialize()
return

/**
* Top level of the destroy chain for most atoms
*
Expand Down
5 changes: 1 addition & 4 deletions code/game/gamemodes/clown_ops/clown_weapons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@

/obj/item/grown/bananapeel/bombanana/Initialize()
. = ..()
AddComponent(/datum/component/slippery, det_time)
bomb = new /obj/item/grenade/syndieminibomb/concussion(src)
bomb.det_time = det_time
if(iscarbon(loc))
Expand All @@ -202,10 +203,6 @@
C.throw_mode_on()
bomb.preprime(loc, null, FALSE)

/obj/item/grown/bananapeel/bombanana/ComponentInitialize()
. = ..()
AddComponent(/datum/component/slippery, det_time)

/obj/item/grown/bananapeel/bombanana/Destroy()
. = ..()
QDEL_NULL(bomb)
Expand Down
1 change: 1 addition & 0 deletions code/game/machinery/_machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ Class Procs:
SEND_SIGNAL(src, COMSIG_MACHINERY_BROKEN, damage_flag)
update_icon()
return TRUE
return FALSE

/obj/machinery/contents_explosion(severity, target)
if(occupant)
Expand Down
24 changes: 13 additions & 11 deletions code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@
/// Log of who is shocking this door
var/list/shocking_log

///Whether wires should all cut themselves when this door is broken.
var/cut_wires_on_break = TRUE

flags_1 = RAD_PROTECT_CONTENTS_1 | RAD_NO_CONTAMINATE_1
rad_insulation = RAD_MEDIUM_INSULATION

Expand Down Expand Up @@ -168,10 +171,19 @@
diag_hud_set_electrified()

rebuild_parts()
RegisterSignal(src, COMSIG_MACHINERY_BROKEN, PROC_REF(on_break))
AddComponent(/datum/component/ntnet_interface)

return INITIALIZE_HINT_LATELOAD

/obj/machinery/door/airlock/obj_break(damage_flag)
. = ..()
if(!.)
return FALSE
if(!panel_open)
panel_open = TRUE
if(cut_wires_on_break)
wires.cut_all()

/obj/machinery/door/airlock/LateInitialize()
. = ..()
if(cyclelinkedx || cyclelinkedy) //yogs start
Expand Down Expand Up @@ -204,10 +216,6 @@
panel_open = TRUE
update_icon()

/obj/machinery/door/airlock/ComponentInitialize()
. = ..()
AddComponent(/datum/component/ntnet_interface)

/obj/machinery/door/airlock/proc/rebuild_parts()
if(part_overlays)
vis_contents -= part_overlays
Expand Down Expand Up @@ -1551,12 +1559,6 @@
open()
safe = TRUE


/obj/machinery/door/airlock/proc/on_break()
if(!panel_open)
panel_open = TRUE
wires.cut_all()

/obj/machinery/door/airlock/proc/set_electrified(seconds, mob/user)
secondsElectrified = seconds
diag_hud_set_electrified()
Expand Down
5 changes: 1 addition & 4 deletions code/game/machinery/doors/airlock_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@
aiControlDisabled = AI_WIRE_DISABLED
req_access = list(ACCESS_BLOODCULT)
damage_deflection = 10
cut_wires_on_break = FALSE
var/openingoverlaytype = /obj/effect/temp_visual/cult/door
var/friendly = FALSE
var/stealthy = FALSE
Expand All @@ -470,10 +471,6 @@
/obj/machinery/door/airlock/cult/canAIControl(mob/user)
return (iscultist(user) && !isAllPowerCut())

/obj/machinery/door/airlock/cult/on_break()
if(!panel_open)
panel_open = TRUE

/obj/machinery/door/airlock/cult/isElectrified()
return FALSE

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/doors/firedoor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@
icon = 'icons/obj/doors/edge_Doorfire.dmi'
border = TRUE

/obj/structure/firelock_frame/border/ComponentInitialize()
/obj/structure/firelock_frame/border/Initialize()
. = ..()
var/static/rotation_flags = ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS
AddComponent(/datum/component/simple_rotation, rotation_flags)
Expand Down
5 changes: 1 addition & 4 deletions code/game/machinery/doors/windowdoor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

/obj/machinery/door/window/Initialize(mapload, set_dir)
. = ..()
AddComponent(/datum/component/ntnet_interface)
if(set_dir)
setDir(set_dir)
if(req_access && req_access.len)
Expand All @@ -36,10 +37,6 @@
if(cable)
debris += new /obj/item/stack/cable_coil(src, cable)

/obj/machinery/door/window/ComponentInitialize()
. = ..()
AddComponent(/datum/component/ntnet_interface)

/obj/machinery/door/window/Destroy()
density = FALSE
QDEL_LIST(debris)
Expand Down
4 changes: 1 addition & 3 deletions code/game/machinery/doppler_array.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ GLOBAL_LIST_EMPTY(doppler_arrays)
/obj/machinery/doppler_array/Initialize()
. = ..()
RegisterSignal(SSdcs, COMSIG_GLOB_EXPLOSION, PROC_REF(sense_explosion))

/obj/machinery/doppler_array/ComponentInitialize()
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE,null,null,CALLBACK(src, PROC_REF(rot_message)))
AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE, null, null, CALLBACK(src, PROC_REF(rot_message)))

/obj/machinery/doppler_array/examine(mob/user)
..()
Expand Down
6 changes: 2 additions & 4 deletions code/game/machinery/pipe/construction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ Buildable meters
/obj/item/pipe/quaternary
RPD_type = PIPE_ONEDIR

/obj/item/pipe/ComponentInitialize()
//Flipping handled manually due to custom handling for trinary pipes
AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE)

/obj/item/pipe/Initialize(mapload, _pipe_type, _dir, obj/machinery/atmospherics/make_from)
if(make_from)
make_from_existing(make_from)
Expand All @@ -51,6 +47,8 @@ Buildable meters
update()
pixel_x += rand(-5, 5)
pixel_y += rand(-5, 5)
//Flipping handled manually due to custom handling for trinary pipes
AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE)
return ..()

/obj/item/pipe/proc/make_from_existing(obj/machinery/atmospherics/make_from)
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/porta_turret/portable_turret.dm
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@
faction = list(ROLE_SYNDICATE)
desc = "A ballistic machine gun auto-turret."

/obj/machinery/porta_turret/syndicate/ComponentInitialize()
/obj/machinery/porta_turret/syndicate/Initialize()
. = ..()
AddComponent(/datum/component/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES)

Expand Down Expand Up @@ -761,7 +761,7 @@
faction = list("neutral","silicon","turret")
mode = TURRET_LETHAL

/obj/machinery/porta_turret/centcom_shuttle/ComponentInitialize()
/obj/machinery/porta_turret/centcom_shuttle/Initialize()
. = ..()
AddComponent(/datum/component/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES)

Expand Down
11 changes: 7 additions & 4 deletions code/game/machinery/stasis.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@
var/mattress_state = "stasis_on"
var/obj/effect/overlay/vis/mattress_on

/obj/machinery/stasis/Initialize()
. = ..()
AddComponent(/datum/component/surgery_bed, \
success_chance = 1, \
op_computer_linkable = TRUE, \
)

/obj/machinery/stasis/RefreshParts()
stasis_amount = initial(stasis_amount)
stasis_cooldown = initial(stasis_cooldown)
Expand All @@ -58,10 +65,6 @@
if(occupant)
thaw_them(occupant)
chill_out(occupant)


/obj/machinery/stasis/ComponentInitialize()
AddComponent(/datum/component/surgery_bed, 1, TRUE)

/obj/machinery/stasis/examine(mob/user)
. = ..()
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/effects/decals/cleanable/robots.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@
icon_state = "streak1"
random_icon_states = list("streak1", "streak2", "streak3", "streak4", "streak5")

/obj/effect/decal/cleanable/oil/slippery/ComponentInitialize()
/obj/effect/decal/cleanable/oil/slippery/Initialize()
. = ..()
AddComponent(/datum/component/slippery, 80, (NO_SLIP_WHEN_WALKING | SLIDE))
5 changes: 1 addition & 4 deletions code/game/objects/effects/decals/decal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,9 @@
layer = TURF_DECAL_LAYER

/obj/effect/turf_decal/Initialize()
..()
return INITIALIZE_HINT_QDEL

/obj/effect/turf_decal/ComponentInitialize()
. = ..()
var/turf/T = loc
if(!istype(T)) //you know this will happen somehow
CRASH("Turf decal initialized in an object/nullspace")
T.AddComponent(/datum/component/decal, icon, icon_state, dir, FALSE, color, null, null, alpha)
return INITIALIZE_HINT_QDEL
2 changes: 1 addition & 1 deletion code/game/objects/items/clown_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
force_string = "robust... against germs"
var/uses = 100

/obj/item/soap/ComponentInitialize()
/obj/item/soap/Initialize()
. = ..()
AddComponent(/datum/component/slippery, 80)

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/PDA/PDA_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
desc = "A portable microcomputer by Thinktronic Systems, LTD. The surface is coated with polytetrafluoroethylene and banana drippings."
ttone = "honk"

/obj/item/pda/clown/ComponentInitialize()
/obj/item/pda/clown/Initialize()
. = ..()
AddComponent(/datum/component/slippery, 120, NO_SLIP_WHEN_WALKING, CALLBACK(src, PROC_REF(AfterSlip)))

Expand Down
12 changes: 6 additions & 6 deletions code/game/objects/items/devices/radio/headset.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
icon_state = "syndie_headset"
item_state = "syndie_headset"

/obj/item/radio/headset/syndicate/alt/ComponentInitialize()
/obj/item/radio/headset/syndicate/alt/Initialize()
. = ..()
AddComponent(/datum/component/wearertargeting/earprotection, list(SLOT_EARS))

Expand Down Expand Up @@ -75,7 +75,7 @@
icon_state = "sec_headset_alt"
item_state = "sec_headset_alt"

/obj/item/radio/headset/headset_sec/alt/ComponentInitialize()
/obj/item/radio/headset/headset_sec/alt/Initialize()
. = ..()
AddComponent(/datum/component/wearertargeting/earprotection, list(SLOT_EARS))

Expand Down Expand Up @@ -142,7 +142,7 @@
icon_state = "com_headset_alt"
item_state = "com_headset_alt"

/obj/item/radio/headset/heads/captain/alt/ComponentInitialize()
/obj/item/radio/headset/heads/captain/alt/Initialize()
. = ..()
AddComponent(/datum/component/wearertargeting/earprotection, list(SLOT_EARS))

Expand All @@ -164,7 +164,7 @@
icon_state = "com_headset_alt"
item_state = "com_headset_alt"

/obj/item/radio/headset/heads/hos/ComponentInitialize()
/obj/item/radio/headset/heads/hos/Initialize()
. = ..()
AddComponent(/datum/component/wearertargeting/earprotection, list(SLOT_EARS))

Expand Down Expand Up @@ -224,7 +224,7 @@
icon_state = "cent_headset_alt"
item_state = "cent_headset_alt"

/obj/item/radio/headset/headset_cent/bowman/ComponentInitialize()
/obj/item/radio/headset/headset_cent/bowman/Initialize()
. = ..()
AddComponent(/datum/component/wearertargeting/earprotection, list(SLOT_EARS))

Expand All @@ -235,7 +235,7 @@
item_state = "cent_headset_alt"
keyslot = new /obj/item/encryptionkey/heads/captain

/obj/item/radio/headset/headset_cent/alt/ComponentInitialize()
/obj/item/radio/headset/headset_cent/alt/Initialize()
. = ..()
AddComponent(/datum/component/wearertargeting/earprotection, list(SLOT_EARS))

Expand Down
5 changes: 1 addition & 4 deletions code/game/objects/items/devices/radio/radio.dm
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,13 @@ GLOBAL_LIST_INIT(channel_tokens, list(
wires.cut(WIRE_TX) // OH GOD WHY
secure_radio_connections = new
. = ..()
AddComponent(/datum/component/empprotection, EMP_PROTECT_WIRES)
frequency = sanitize_frequency(frequency, freerange)
set_frequency(frequency)

for(var/ch_name in channels)
secure_radio_connections[ch_name] = add_radio(src, GLOB.radiochannels[ch_name])

/obj/item/radio/ComponentInitialize()
. = ..()
AddComponent(/datum/component/empprotection, EMP_PROTECT_WIRES)

/obj/item/radio/interact(mob/user)
if(unscrewed && !isAI(user))
wires.interact(user)
Expand Down
3 changes: 0 additions & 3 deletions code/game/objects/items/devices/transfer_valve.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
attached_device = null
return ..()

/obj/item/transfer_valve/IsAssemblyHolder()
return TRUE

/obj/item/transfer_valve/attackby(obj/item/item, mob/user, params)
if(istype(item, /obj/item/tank))
if(tank_one && tank_two)
Expand Down
5 changes: 1 addition & 4 deletions code/game/objects/items/grenades/chem_grenade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@
var/casedesc = "This basic model accepts both beakers and bottles. It heats contents by 10°K upon ignition." // Appears when examining empty casings.
var/obj/item/assembly/prox_sensor/landminemode = null

/obj/item/grenade/chem_grenade/ComponentInitialize()
. = ..()
AddComponent(/datum/component/empprotection, EMP_PROTECT_WIRES)

/obj/item/grenade/chem_grenade/Initialize()
. = ..()
create_reagents(1000)
stage_change() // If no argument is set, it will change the stage to the current stage, useful for stock grenades that start READY.
wires = new /datum/wires/explosive/chem_grenade(src)
AddComponent(/datum/component/empprotection, EMP_PROTECT_WIRES)

/obj/item/grenade/chem_grenade/examine(mob/user)
display_timer = (stage == GRENADE_READY) //show/hide the timer based on assembly state
Expand Down
3 changes: 0 additions & 3 deletions code/game/objects/items/grenades/plastic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
/obj/item/grenade/plastic/Initialize()
. = ..()
plastic_overlay = mutable_appearance(icon, "[item_state]2", HIGH_OBJ_LAYER)

/obj/item/grenade/plastic/ComponentInitialize()
. = ..()
AddComponent(/datum/component/empprotection, EMP_PROTECT_WIRES)

/obj/item/grenade/plastic/Destroy()
Expand Down
Loading

0 comments on commit 323ca60

Please sign in to comment.