-
-
Notifications
You must be signed in to change notification settings - Fork 452
/
breathing_classes.dm
82 lines (75 loc) · 2.51 KB
/
breathing_classes.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Breathing classes are, yes, just a list of gases, associated with numbers.
// But they're very simple: pluoxium's status as O2 * 8 is represented here,
// with a single line of code, no hardcoding and special-casing across the codebase.
// Not only that, but they're very general: you could have a negative value
// to simulate asphyxiants, e.g. if I add krypton it could go into the oxygen
// breathing class at -7, simulating krypton narcosis.
/datum/breathing_class
///Gases that we consume and count as respirable
var/list/gases
///Gases that we breathe out
var/list/products
///Reagent generated if we breathe in too much of the gases in the gas_max value of gases defined in lungs
var/danger_reagent
///Catergory of the alert generated if we do not have enough required gases
var/low_alert_category = "not_enough_oxy"
///Type of the alert generated if we do not have enough required gases
var/low_alert_datum = /atom/movable/screen/alert/not_enough_oxy
///Catergory of the alert generated if we breathe in too much of the gases in the gas_max value of gases defined in lungs
var/high_alert_category = "too_much_oxy"
///Type of the alert generated if we breathe in too much of the gases in the gas_max value of gases defined in lungs
var/high_alert_datum = /atom/movable/screen/alert/too_much_oxy
/datum/breathing_class/proc/get_effective_pp(datum/gas_mixture/breath)
var/mol = 0
for(var/gas in gases)
mol += breath.get_moles(gas) * gases[gas]
return (mol/breath.total_moles()) * breath.return_pressure()
/datum/breathing_class/oxygen
gases = list(
GAS_O2 = 1,
GAS_PLUOXIUM = 8,
GAS_CO2 = -0.7, // CO2 isn't actually toxic, just an asphyxiant
)
products = list(
GAS_CO2 = 1,
)
/datum/breathing_class/oxygen_plas
gases = list(
GAS_O2 = 1,
GAS_PLUOXIUM = 8,
GAS_CO2 = -0.7, // CO2 isn't actually toxic, just an asphyxiant
GAS_PLASMA = 1
)
products = list(
GAS_CO2 = 1,
)
/datum/breathing_class/oxygen_co2
gases = list(
GAS_O2 = 1,
GAS_PLUOXIUM = 8,
GAS_CO2 = 1,
)
products = list(
GAS_CO2 = 1,
)
/datum/breathing_class/plasma
gases = list(
GAS_PLASMA = 1
)
products = list(
GAS_CO2 = 1
)
low_alert_category = "not_enough_tox"
low_alert_datum = /atom/movable/screen/alert/not_enough_tox
high_alert_category = "too_much_tox"
high_alert_datum = /atom/movable/screen/alert/too_much_tox
/datum/breathing_class/oxygen_vapor
gases = list(
GAS_O2 = 1,
GAS_PLUOXIUM = 8,
GAS_CO2 = -0.7, // CO2 isn't actually toxic, just an asphyxiant
GAS_H2O = 1,
)
products = list(
GAS_CO2 = 1,
)