Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

airlocks 2.0 #6593

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
24 changes: 23 additions & 1 deletion citadel.dme
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "code\__DEFINES\_planes+layers.dm"
#include "code\__DEFINES\_profile.dm"
#include "code\__DEFINES\_protect.dm"
#include "code\__DEFINES\_serialization.dm"
#include "code\__DEFINES\_tick.dm"
#include "code\__DEFINES\ability.dm"
#include "code\__DEFINES\access.dm"
Expand Down Expand Up @@ -245,6 +246,7 @@
#include "code\__DEFINES\languages\ids.dm"
#include "code\__DEFINES\languages\legacy.dm"
#include "code\__DEFINES\languages\translation.dm"
#include "code\__DEFINES\machines\airlock.dm"
#include "code\__DEFINES\machines\airlock_states.dm"
#include "code\__DEFINES\machines\door.dm"
#include "code\__DEFINES\machines\turrets.dm"
Expand Down Expand Up @@ -1293,6 +1295,22 @@
#include "code\game\landmarks\spawnpoint\station\misc.dm"
#include "code\game\legacy_html_uis\byjax.dm"
#include "code\game\legacy_html_uis\menus.dm"
#include "code\game\machinery\airlocks\airlock_component.dm"
#include "code\game\machinery\airlocks\airlock_cycle.dm"
#include "code\game\machinery\airlocks\airlock_environment.dm"
#include "code\game\machinery\airlocks\airlock_gasnet.dm"
#include "code\game\machinery\airlocks\airlock_helpers.dm"
#include "code\game\machinery\airlocks\airlock_interconnect.dm"
#include "code\game\machinery\airlocks\airlock_peripheral.dm"
#include "code\game\machinery\airlocks\airlock_program.dm"
#include "code\game\machinery\airlocks\airlock_component\controller.dm"
#include "code\game\machinery\airlocks\airlock_component\cycler.dm"
#include "code\game\machinery\airlocks\airlock_component\door_link.dm"
#include "code\game\machinery\airlocks\airlock_component\handler.dm"
#include "code\game\machinery\airlocks\airlock_component\vent.dm"
#include "code\game\machinery\airlocks\airlock_cycle\vacuum_cycle.dm"
#include "code\game\machinery\airlocks\airlock_peripheral\panel.dm"
#include "code\game\machinery\airlocks\airlock_peripheral\sensor.dm"
#include "code\game\machinery\_frame.dm"
#include "code\game\machinery\_machinery.dm"
#include "code\game\machinery\_machinery_construction.dm"
Expand Down Expand Up @@ -1359,6 +1377,8 @@
#include "code\game\machinery\wall_frames.dm"
#include "code\game\machinery\washing_machine.dm"
#include "code\game\machinery\wishgranter.dm"
#include "code\game\machinery\airlocks\airlock_program\vacuum_cycle.dm"
#include "code\game\machinery\airlocks\map_helpers\airlock_peripheral_linker.dm"
#include "code\game\machinery\camera\camera.dm"
#include "code\game\machinery\camera\camera_assembly.dm"
#include "code\game\machinery\camera\motion.dm"
Expand Down Expand Up @@ -3297,12 +3317,12 @@
#include "code\modules\mapping\dmm_suite\dmm_report.dm"
#include "code\modules\mapping\dmm_suite\utility_types.dm"
#include "code\modules\mapping\dmm_suite\wrappers.dm"
#include "code\modules\mapping\map_helpers\_map_helpers.dm"
#include "code\modules\mapping\map_helpers\baseturf.dm"
#include "code\modules\mapping\map_helpers\component_injector.dm"
#include "code\modules\mapping\map_helpers\electrochromatic_linker.dm"
#include "code\modules\mapping\map_helpers\engine_loader.dm"
#include "code\modules\mapping\map_helpers\gear_marker.dm"
#include "code\modules\mapping\map_helpers\map_helper.dm"
#include "code\modules\mapping\map_helpers\paint.dm"
#include "code\modules\mapping\map_helpers\role_marker.dm"
#include "code\modules\mapping\map_helpers\access_helper\access_helper.dm"
Expand All @@ -3311,6 +3331,8 @@
#include "code\modules\mapping\map_helpers\network_builder\power_cable.dm"
#include "code\modules\mapping\map_injection\map_injection.dm"
#include "code\modules\mapping\map_injection\starting_gear.dm"
#include "code\modules\mapping\map_tests\map_test.dm"
#include "code\modules\mapping\map_tests\tests\airlock_linkage_test.dm"
#include "code\modules\mapping\spawner\_spawner.dm"
#include "code\modules\mapping\spawner\tcomms_relay.dm"
#include "code\modules\mapping\spawner\window.dm"
Expand Down
51 changes: 51 additions & 0 deletions code/__DEFINES/_serialization.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 silicons *//

// just a bunch of de/serialization helpers to reduce copypaste
// these are meant to add durability to known-migrated systems,
// as errors in expected vs actual value in those systems can
// generally be treated as a mistake somewhere on the part
// of whoever is updating them.

//* Number *//

#define OPTIONALLY_DESERIALIZE_NUMBER(FROM, INTO) \
if(!isnull(FROM)) { \
if(isnum(FROM)) { \
INTO = FROM; \
} \
else { \
stack_trace(#INTO + ": expected number or undefined, got " + text(FROM)); \
} \
}

#define REQUIRED_DESERIALIZE_NUMBER(FROM, INTO) \
if(isnum(FROM)) { \
INTO = FROM; \
} \
else { \
stack_trace(#INTO + ": expected number, got " + text(FROM)); \
} \

//* List - Naive *//

#define OPTIONALLY_DESERIALIZE_LIST(FROM, INTO, OTHERWISE) \
if(!isnull(FROM)) { \
if(islist(FROM)) { \
INTO = FROM; \
} \
else { \
stack_trace(#INTO + ": expected number or undefined, got " + text(FROM)); \
} \
} \
else { \
INTO = OTHERWISE; \
}

#define REQUIRED_DESERIALIZE_LIST(FROM, INTO) \
if(islist(FROM)) { \
INTO = FROM; \
} \
else { \
stack_trace(#INTO + ": expected list, got " + text(FROM)); \
} \
2 changes: 1 addition & 1 deletion code/__DEFINES/coloration.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 Citadel Station developers. *//
//* Copyright (c) 2024 Citadel Station Developers *//

//* coloration_mode; only bitfields for quick checks. only one can be applied at a time!

Expand Down
79 changes: 79 additions & 0 deletions code/__DEFINES/machines/airlock.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 Citadel Station Developers *//

//* Airlock Sides *//

#define AIRLOCK_SIDE_INTERIOR "interior"
#define AIRLOCK_SIDE_EXTERIOR "exterior"
#define AIRLOCK_SIDE_NEUTRAL "neutral"

#warn DEFINE_ENUM for sensor and controller

Check warning on line 10 in code/__DEFINES/machines/airlock.dm

View workflow job for this annotation

GitHub Actions / Run Linters

#warn DEFINE_ENUM for sensor and controller

//* /obj/machinery/airlock_component/controller/(interior|exterior)_environment_mode

/// detect atmos on tile; autodetects and sets to manual after
#define AIRLOCK_ENVIRONMENT_AUTODETECT "detect"
/// manually specify environment
#define AIRLOCK_ENVIRONMENT_MANUAL "manual"
/// adaptive; continually matches the environment when possible.
#define AIRLOCK_ENVIRONMENT_ADAPTIVE "adaptive"
/// ignore the atmos entirely
#define AIRLOCK_ENVIRONMENT_IGNORE "ignore"

#warn DEFINE_ENUM

Check warning on line 23 in code/__DEFINES/machines/airlock.dm

View workflow job for this annotation

GitHub Actions / Run Linters

#warn DEFINE_ENUM

//* /obj/machinery/airlock_component/controller/(interior|exterior)_state

/// locked open
#define AIRLOCK_STATE_LOCKED_OPEN 1
/// locked closed
#define AIRLOCK_STATE_LOCKED_CLOSED 2
/// unlocked
#define AIRLOCK_STATE_UNLOCKED 3

#warn DEFINE_ENUM

Check warning on line 34 in code/__DEFINES/machines/airlock.dm

View workflow job for this annotation

GitHub Actions / Run Linters

#warn DEFINE_ENUM

//* used internally as returns from airlock programs *//
//* also used as callback inputs for /obj/machinery/airlock_component/controller/var/datum/callback/on_finish *//

/// still cycling
#define AIRLOCK_CYCLE_STATUS_CONTINUE 0
/// finished cycling
#define AIRLOCK_CYCLE_STATUS_FINISHED 1
/// user aborted cycling
#define AIRLOCK_CYCLE_STATUS_ABORTED 2
/// cycling failed
#define AIRLOCK_CYCLE_STATUS_FAILED 3

//* /obj/machinery/airlock_component/cycler op return codes *//

/// keep cycling
#define AIRLOCK_CYCLER_OP_CONTINUE 1
/// finished
#define AIRLOCK_CYCLER_OP_FINISHED 2
/// unpowered
#define AIRLOCK_CYCLER_OP_NO_POWER 3
/// insufficient air
#define AIRLOCK_CYCLER_OP_NO_GAS 4
/// pumping against too much of a gradient
#define AIRLOCK_CYCLER_OP_HIGH_RESISTANCE 5
/// fatal error
#define AIRLOCK_CYCLER_OP_FATAL 6

// todo: /datum/airlock_program/dynamic_reconcile //
//* below defines are for that. *//
// todo: DEFINE_BITFIELD and DEFINE_ENUM as needed //

/// cycle gas ratios; implies EXPEL_UNWANTED_GAS
#define AIRLOCK_DYNAMIC_RECONCILE_MATCH_GAS_RATIOS (1<<0)
/// expel bad gases
#define AIRLOCK_DYNAMIC_RECONCILE_EXPEL_UNWANTED_GAS (1<<1)
/// match pressure; implies REGULATE_PRESSURE
#define AIRLOCK_DYNAMIC_RECONCILE_MATCH_PRESSURE (1<<2)
/// prevent pressure mismatches that result in people dying/flying around
#define AIRLOCK_DYNAMIC_RECONCILE_REGULATE_PRESSURE (1<<3)
/// match temperature; implies REGULATE_TEMPERATURE
#define AIRLOCK_DYNAMIC_RECONCILE_MATCH_TEMPERATURE (1<<4)
/// prevent temperature mismatches that result in people dying/severe area temperature changes
#define AIRLOCK_DYNAMIC_RECONCILE_REGULATE_TEMPERATURE (1<<5)

12 changes: 12 additions & 0 deletions code/__DEFINES/power/balancing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,15 @@ GLOBAL_VAR_INIT(cellefficiency, 1)
#define CYBORG_POWER_USAGE_MULTIPLIER 2
#define SPACE_HEATER_CHEAT_FACTOR 1.5
#define THERMOREGULATOR_CHEAT_FACTOR 5

// todo: move to own file
//* Thermodynamic Efficiencies *//
/// tl;dr enforcement to ensure you can't make infinite power machines
/// or at the very least have a harder time

/// towards / with gradient
#define THERMODYNAMICS_AIRLOCK_HEAT_PUMP_EFFICIENCY_FAVORABLE 20
/// against gradient
#define THERMODYNAMICS_AIRLOCK_HEAT_PUMP_EFFICIENCY_UNFAVORABLE 10
/// electrical heating
#define THERMODYNAMICS_AIRLOCK_ELECTRIC_HEATING_EFFICIENCY 5
3 changes: 3 additions & 0 deletions code/game/machinery/airlocks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Airlock System

Variable-Parameter airlock system made to replace embedded controllers.
19 changes: 19 additions & 0 deletions code/game/machinery/airlocks/airlock_component.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 Citadel Station Developers *//

/**
* gasnet connected machinery
*/
/obj/machinery/airlock_comopnent
/// conencted gasnet
var/datum/airlock_gasnet/network
/// connected interconnect: something to note here is that
/// unlike pipenets, airlock machinery are **not** able to
/// connect to each other directly.
var/obj/structure/airlock_interconnect/interconnect

/obj/machinery/airlock_comopnent/proc/on_connect(datum/airlock_gasnet/network)
return

/obj/machinery/airlock_comopnent/proc/on_disconnect(datum/airlock_gasnet/network)
return
Loading
Loading