move airlock chamber setup out of lateinit (#29672)

* move airlock chamber setup out of lateinit

* clean up comment
This commit is contained in:
warriorstar-orion
2025-06-30 06:51:15 -04:00
committed by GitHub
parent 0e273a8c8c
commit eddaaca8d9
4 changed files with 24 additions and 22 deletions
@@ -9,13 +9,13 @@
// Setup vars
/// Airlock ID for all exterior doors to link to on LateInitialize()
/// Airlock ID for all exterior doors to link to.
var/ext_door_link_id
/// Airlock ID for all interior doors to link to on LateInitialize()
/// Airlock ID for all interior doors to link to.
var/int_door_link_id
/// Button ID for all exterior buttons to link to on LateInitialize()
/// Button ID for all exterior buttons to link to.
var/ext_button_link_id
/// Vutton ID for all exterior buttons to link to on LateInitialize()
/// Vutton ID for all exterior buttons to link to.
var/int_button_link_id
// Actual holding vars
@@ -29,7 +29,7 @@
/// Target state (MONE, INOPEN, OUTOPEN)
var/target_state = TARGET_NONE
/// Vent ID for all vents to link to on LateInitialize()
/// Vent ID for all vents to link to.
var/vent_link_id
/// All vents to control. Soft-refs only.
var/list/vents = list()
@@ -37,14 +37,7 @@
// Program vars
var/target_pressure
/obj/machinery/airlock_controller/Initialize(mapload)
..()
// We do all the work in there
return INITIALIZE_HINT_LATELOAD
// Do setup of stuff here
/obj/machinery/airlock_controller/LateInitialize()
/obj/machinery/airlock_controller/proc/link_all_items()
for(var/obj/machinery/door/airlock/A in GLOB.airlocks)
if(A.id_tag == int_door_link_id)
interior_doors |= A.UID()
@@ -377,8 +370,9 @@ send an additional command to open the door again.
cycleDoors(TARGET_OUTOPEN)
/* =============================== AIR CYCLER - Ensures internal pressure matches (just about) the void or the normal atmosphere */
/obj/machinery/airlock_controller/air_cycler/LateInitialize()
..()
/obj/machinery/airlock_controller/air_cycler/link_all_items()
. = ..()
for(var/obj/machinery/atmospherics/unary/vent_pump/V as anything in GLOB.all_vent_pumps)
if(V.autolink_id == vent_link_id)
vents += V.UID()
@@ -49,7 +49,9 @@ This spawner places pipe leading up to the interior door, you will need to finis
handle_door_creation(turf_interior, TRUE, one_door_interior)
handle_door_creation(turf_exterior, FALSE, one_door_exterior)
handle_pipes_creation(turf_interior)
handle_control_placement()
var/obj/machinery/airlock_controller/controller = make_controller()
controller.link_all_items()
for(var/obj/effect/mapping_helpers/airlock/access/access_helper in loc)
qdel(access_helper)
@@ -117,7 +119,8 @@ This spawner places pipe leading up to the interior door, you will need to finis
set_access_helper(the_button)
return the_button
/obj/effect/spawner/airlock/proc/handle_control_placement() //Stick the controller on the wall, this will ONLY be unsuitable if airlocks are on both the south and west turfs
/// Stick the controller on the wall, this will ONLY be unsuitable if airlocks are on both the south and west turfs.
/obj/effect/spawner/airlock/proc/make_controller()
var/turf/T = get_turf(src)
var/obj/machinery/airlock_controller/air_cycler/AC = new(T)
set_access_helper(AC)
@@ -138,6 +141,8 @@ This spawner places pipe leading up to the interior door, you will need to finis
AC.pixel_x += 25
AC.pixel_y += 9
return AC
/obj/effect/spawner/airlock/proc/handle_pipes_creation(turf/T) //This places all required piping down, then properly initializes it. T is the turf that the interior airlock occupies
var/turf/below_T = get_step(T, opposite_interior_direction)
@@ -100,13 +100,11 @@ RESTRICT_TYPE(/datum/dynamic_airlock_linker)
controller.req_access = req_access
controller.req_one_access = req_one_access
// despite airlock controllers looking this up in GLOB.airlocks in
// LateInitialize, we need to hold their hand here because *we're*
// (typically) in Initialize, so not all relevant airlocks may have been
// added to GLOB.airlocks yet.
controller.interior_doors = interior_airlocks.Copy()
controller.exterior_doors = exterior_airlocks.Copy()
controller.link_all_items()
QDEL_LIST_CONTENTS(interior_helpers)
QDEL_LIST_CONTENTS(exterior_helpers)
QDEL_LIST_CONTENTS(visited_helpers)
+6 -1
View File
@@ -23,8 +23,11 @@
/obj/effect/map_effect/dynamic_airlock/Initialize(mapload)
..()
return INITIALIZE_HINT_LATELOAD
/obj/effect/map_effect/dynamic_airlock/LateInitialize()
. = ..()
. = INITIALIZE_HINT_QDEL
// One helper out of all the connected ones will actually set everything up
// and qdel all the connected ones so the linker doesn't attempt to do its
// thing more than once per zone
@@ -34,6 +37,8 @@
var/datum/dynamic_airlock_linker/linker = new()
linker.build(src)
qdel(src)
/obj/effect/map_effect/dynamic_airlock/proc/collect_sibling_item(atom/A)
if(is_type_in_list(A, valid_siblings))
LAZYADD(sibling_items, A)