Merged New() & Initialize() for atmos machines (#91512)

## About The Pull Request
Unless your using named vars during init, these 2 procs should not exist
in the same place

## Changelog
🆑
code: merged New() & Initialize() for atmos machines
/🆑
This commit is contained in:
SyncIt21
2025-07-06 14:25:12 +05:30
committed by GitHub
parent 9c8919d5fd
commit 415a98fa64
10 changed files with 30 additions and 43 deletions
@@ -26,7 +26,7 @@
///Check if the object can be unwrenched
var/can_unwrench = FALSE
///Bitflag of the initialized directions (NORTH | SOUTH | EAST | WEST)
var/initialize_directions = NONE
var/initialize_directions = ALL_CARDINALS
///The color of the pipe
var/pipe_color = ATMOS_COLOR_OMNI
///What layer the pipe is in (from 1 to 5, default 3)
@@ -81,29 +81,15 @@
fire = 100
acid = 70
/obj/machinery/atmospherics/post_machine_initialize()
. = ..()
update_name()
/obj/machinery/atmospherics/examine(mob/user)
. = ..()
. += span_notice("[src] is on layer [piping_layer].")
if((vent_movement & VENTCRAWL_ENTRANCE_ALLOWED) && isliving(user))
var/mob/living/L = user
if(HAS_TRAIT(L, TRAIT_VENTCRAWLER_NUDE) || HAS_TRAIT(L, TRAIT_VENTCRAWLER_ALWAYS))
. += span_notice("Alt-click to crawl through it.")
/obj/machinery/atmospherics/New(loc, process = TRUE, setdir, init_dir = ALL_CARDINALS)
/obj/machinery/atmospherics/Initialize(mapload, process = TRUE, setdir, init_dir = initialize_directions)
if(!isnull(setdir))
setDir(setdir)
if(pipe_flags & PIPING_CARDINAL_AUTONORMALIZE)
normalize_cardinal_directions()
nodes = new(device_type)
init_processing = process
..()
set_init_directions(init_dir)
/obj/machinery/atmospherics/Initialize(mapload)
if(mapload && name != initial(name))
override_naming = TRUE
var/turf/turf_loc = null
@@ -120,6 +106,10 @@
SSair.start_processing_machine(src)
return ..()
/obj/machinery/atmospherics/post_machine_initialize()
. = ..()
update_name()
/obj/machinery/atmospherics/Destroy()
for(var/i in 1 to device_type)
nullify_node(i)
@@ -132,6 +122,14 @@
return ..()
/obj/machinery/atmospherics/examine(mob/user)
. = ..()
. += span_notice("[src] is on layer [piping_layer].")
if((vent_movement & VENTCRAWL_ENTRANCE_ALLOWED) && isliving(user))
var/mob/living/L = user
if(HAS_TRAIT(L, TRAIT_VENTCRAWLER_NUDE) || HAS_TRAIT(L, TRAIT_VENTCRAWLER_ALWAYS))
. += span_notice("Alt-click to crawl through it.")
/**
* Sets up our pipe hiding logic, consolidated in one place so subtypes may override it.
* This lets subtypes implement their own hiding logic without needing to worry about conflicts with the parent hiding logic.
@@ -62,7 +62,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/bluespace_vendor, 30)
fire = 80
acid = 30
/obj/machinery/bluespace_vendor/New(loc, ndir, nbuild)
/obj/machinery/bluespace_vendor/Initialize(mapload, ndir, nbuild)
. = ..()
if(nbuild)
@@ -70,8 +70,6 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/bluespace_vendor, 30)
update_appearance()
/obj/machinery/bluespace_vendor/Initialize(mapload)
. = ..()
purchased_gas_mix = new(100)
AddComponent(/datum/component/payment, 0, SSeconomy.get_dep_account(ACCOUNT_ENG), PAYMENT_ANGRY)
find_and_hang_on_wall( FALSE)
@@ -102,8 +102,8 @@
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume
name = "large dual-port air vent"
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/New()
..()
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/Initialize(mapload)
. = ..()
var/datum/gas_mixture/air1 = airs[1]
var/datum/gas_mixture/air2 = airs[2]
air1.volume = 1000
@@ -28,14 +28,10 @@
return .
/obj/machinery/atmospherics/components/Initialize(mapload)
. = ..()
update_appearance()
/obj/machinery/atmospherics/components/New()
parents = new(device_type)
airs = new(device_type)
..()
. = ..()
for(var/i in 1 to device_type)
if(airs[i])
@@ -44,6 +40,8 @@
component_mixture.volume = 200
airs[i] = component_mixture
update_appearance()
// Iconnery
/**
@@ -19,6 +19,9 @@
/obj/machinery/atmospherics/components/trinary/mixer/Initialize(mapload)
. = ..()
var/datum/gas_mixture/air3 = airs[3]
air3.volume = 300
airs[3] = air3
register_context()
/obj/machinery/atmospherics/components/trinary/mixer/add_context(atom/source, list/context, obj/item/held_item, mob/user)
@@ -58,12 +61,6 @@
var/on_state = on && nodes[1] && nodes[2] && nodes[3] && is_operational
icon_state = "mixer_[on_state ? "on" : "off"]-[set_overlay_offset(piping_layer)][flipped ? "_f" : ""]"
/obj/machinery/atmospherics/components/trinary/mixer/New()
..()
var/datum/gas_mixture/air3 = airs[3]
air3.volume = 300
airs[3] = air3
/obj/machinery/atmospherics/components/trinary/mixer/process_atmos()
..()
if(!on || !(nodes[1] && nodes[2] && nodes[3]) && !is_operational)
@@ -153,7 +153,7 @@
tile_air_pressure = max(0, local_turf.return_air().return_pressure())
on_dock_request(tile_air_pressure)
/obj/machinery/atmospherics/components/unary/airlock_pump/New()
/obj/machinery/atmospherics/components/unary/airlock_pump/Initialize(mapload)
. = ..()
var/datum/gas_mixture/distro_air = airs[1]
var/datum/gas_mixture/waste_air = airs[2]
@@ -20,7 +20,7 @@
///Reference to the connected device
var/obj/machinery/portable_atmospherics/connected_device
/obj/machinery/atmospherics/components/unary/portables_connector/New()
/obj/machinery/atmospherics/components/unary/portables_connector/Initialize(mapload)
. = ..()
var/datum/gas_mixture/air_contents = airs[1]
air_contents.volume = 0
@@ -366,8 +366,8 @@
name = "large air vent"
power_channel = AREA_USAGE_EQUIP
/obj/machinery/atmospherics/components/unary/vent_pump/high_volume/New()
..()
/obj/machinery/atmospherics/components/unary/vent_pump/high_volume/Initialize(mapload)
. = ..()
var/datum/gas_mixture/air_contents = airs[1]
air_contents.volume = 1000
@@ -24,11 +24,7 @@
///Reference to the node
var/obj/machinery/atmospherics/front_node = null
/* We use New() instead of Initialize() because these values are used in update_icon()
* in the mapping subsystem init before Initialize() is called in the atoms subsystem init.
* This is true for the other manifolds (the 4 ways and the heat exchanges) too.
*/
/obj/machinery/atmospherics/pipe/multiz/New()
/obj/machinery/atmospherics/pipe/multiz/Initialize(mapload, process, setdir, init_dir)
icon_state = ""
center = mutable_appearance(icon, "adapter_center", layer = HIGH_OBJ_LAYER)
pipe = mutable_appearance(icon, "pipe-[piping_layer]")
@@ -22,11 +22,11 @@
buckle_requires_restraints = TRUE
buckle_lying = NO_BUCKLE_LYING
/obj/machinery/atmospherics/pipe/New()
/obj/machinery/atmospherics/pipe/Initialize(mapload, process, setdir, init_dir)
add_atom_colour(pipe_color, FIXED_COLOUR_PRIORITY)
if (!volume) // Pipes can have specific volumes or have it determined by their device_type.
volume = UNARY_PIPE_VOLUME * device_type
. = ..()
return ..()
/obj/machinery/atmospherics/pipe/proc/set_volume(new_volume)
if(volume == new_volume)