Converts gas, mat and reagent strings to defines

This commit is contained in:
Kashargul
2024-12-06 17:26:00 +01:00
parent 780c07439b
commit 80edcd2c3d
155 changed files with 1183 additions and 1054 deletions
@@ -30,8 +30,8 @@
var/ui_error = null // For error messages to show up in nano ui.
var/datum/gas_mixture/internal = new()
var/const/input_gas = "carbon_dioxide"
var/const/output_gas = "oxygen"
var/const/input_gas = GAS_CO2
var/const/output_gas = GAS_O2
/obj/machinery/atmospherics/binary/algae_farm/filled
stored_material = list(MAT_ALGAE = 10000, MAT_GRAPHITE = 0)
@@ -14,7 +14,7 @@
//--------------------------------------------
// Omni port datum
//
// Used by omni devices to manage connections
// Used by omni devices to manage connections
// to other atmospheric objects.
//--------------------------------------------
/datum/omni_port
@@ -70,10 +70,10 @@
string = "East"
if(WEST)
string = "West"
if(!capitalize && string)
string = lowertext(string)
return string
//returns a direction flag based on the string passed to it
@@ -94,16 +94,15 @@
/proc/mode_to_gasid(var/mode)
switch(mode)
if(ATM_O2)
return "oxygen"
if(ATM_N2)
return "nitrogen"
if(ATM_CO2)
return "carbon_dioxide"
if(ATM_P)
return "phoron"
if(ATM_N2O)
return "nitrous_oxide"
if(ATM_O2)
return GAS_O2
if(ATM_N2)
return GAS_N2
if(ATM_CO2)
return GAS_CO2
if(ATM_P)
return GAS_PHORON
if(ATM_N2O)
return GAS_N2O
else
return null
@@ -44,15 +44,15 @@
switch(filter_type)
if(0) //removing hydrocarbons
filtered_out = list("phoron")
filtered_out = list(GAS_PHORON)
if(1) //removing O2
filtered_out = list("oxygen")
filtered_out = list(GAS_O2)
if(2) //removing N2
filtered_out = list("nitrogen")
filtered_out = list(GAS_N2)
if(3) //removing CO2
filtered_out = list("carbon_dioxide")
filtered_out = list(GAS_CO2)
if(4)//removing N2O
filtered_out = list("nitrous_oxide")
filtered_out = list(GAS_N2O)
air1.volume = ATMOS_DEFAULT_VOLUME_FILTER
air2.volume = ATMOS_DEFAULT_VOLUME_FILTER
@@ -205,16 +205,16 @@
filtered_out.Cut() //no need to create new lists unnecessarily
switch(filter_type)
if(0) //removing hydrocarbons
filtered_out += "phoron"
filtered_out += GAS_PHORON
filtered_out += "oxygen_agent_b"
if(1) //removing O2
filtered_out += "oxygen"
filtered_out += GAS_O2
if(2) //removing N2
filtered_out += "nitrogen"
filtered_out += GAS_N2
if(3) //removing CO2
filtered_out += "carbon_dioxide"
filtered_out += GAS_CO2
if(4)//removing N2O
filtered_out += "nitrous_oxide"
filtered_out += GAS_N2O
add_fingerprint(ui.user)
update_icon()
@@ -20,7 +20,7 @@
var/hibernate = 0 //Do we even process?
var/scrubbing = 1 //0 = siphoning, 1 = scrubbing
var/list/scrubbing_gas = list("carbon_dioxide", "phoron")
var/list/scrubbing_gas = list(GAS_CO2, GAS_PHORON)
var/panic = 0 //is this scrubber panicked?
@@ -109,12 +109,12 @@
"power" = use_power,
"scrubbing" = scrubbing,
"panic" = panic,
"filter_o2" = ("oxygen" in scrubbing_gas),
"filter_n2" = ("nitrogen" in scrubbing_gas),
"filter_co2" = ("carbon_dioxide" in scrubbing_gas),
"filter_phoron" = ("phoron" in scrubbing_gas),
"filter_n2o" = ("nitrous_oxide" in scrubbing_gas),
"filter_fuel" = ("volatile_fuel" in scrubbing_gas),
"filter_o2" = (GAS_O2 in scrubbing_gas),
"filter_n2" = (GAS_N2 in scrubbing_gas),
"filter_co2" = (GAS_CO2 in scrubbing_gas),
"filter_phoron" = (GAS_PHORON in scrubbing_gas),
"filter_n2o" = (GAS_N2O in scrubbing_gas),
"filter_fuel" = (GAS_VOLATILE_FUEL in scrubbing_gas),
"sigtype" = "status"
)
if(!initial_loc.air_scrub_names[id_tag])
@@ -216,35 +216,35 @@
var/list/toggle = list()
if(!isnull(signal.data["o2_scrub"]) && text2num(signal.data["o2_scrub"]) != ("oxygen" in scrubbing_gas))
toggle += "oxygen"
if(!isnull(signal.data["o2_scrub"]) && text2num(signal.data["o2_scrub"]) != (GAS_O2 in scrubbing_gas))
toggle += GAS_O2
else if(signal.data["toggle_o2_scrub"])
toggle += "oxygen"
toggle += GAS_O2
if(!isnull(signal.data["n2_scrub"]) && text2num(signal.data["n2_scrub"]) != ("nitrogen" in scrubbing_gas))
toggle += "nitrogen"
if(!isnull(signal.data["n2_scrub"]) && text2num(signal.data["n2_scrub"]) != (GAS_N2 in scrubbing_gas))
toggle += GAS_N2
else if(signal.data["toggle_n2_scrub"])
toggle += "nitrogen"
toggle += GAS_N2
if(!isnull(signal.data["co2_scrub"]) && text2num(signal.data["co2_scrub"]) != ("carbon_dioxide" in scrubbing_gas))
toggle += "carbon_dioxide"
if(!isnull(signal.data["co2_scrub"]) && text2num(signal.data["co2_scrub"]) != (GAS_CO2 in scrubbing_gas))
toggle += GAS_CO2
else if(signal.data["toggle_co2_scrub"])
toggle += "carbon_dioxide"
toggle += GAS_CO2
if(!isnull(signal.data["tox_scrub"]) && text2num(signal.data["tox_scrub"]) != ("phoron" in scrubbing_gas))
toggle += "phoron"
if(!isnull(signal.data["tox_scrub"]) && text2num(signal.data["tox_scrub"]) != (GAS_PHORON in scrubbing_gas))
toggle += GAS_PHORON
else if(signal.data["toggle_tox_scrub"])
toggle += "phoron"
toggle += GAS_PHORON
if(!isnull(signal.data["n2o_scrub"]) && text2num(signal.data["n2o_scrub"]) != ("nitrous_oxide" in scrubbing_gas))
toggle += "nitrous_oxide"
if(!isnull(signal.data["n2o_scrub"]) && text2num(signal.data["n2o_scrub"]) != (GAS_N2O in scrubbing_gas))
toggle += GAS_N2O
else if(signal.data["toggle_n2o_scrub"])
toggle += "nitrous_oxide"
toggle += GAS_N2O
if(!isnull(signal.data["fuel_scrub"]) && text2num(signal.data["fuel_scrub"]) != ("volatile_fuel" in scrubbing_gas))
toggle += "volatile_fuel"
if(!isnull(signal.data["fuel_scrub"]) && text2num(signal.data["fuel_scrub"]) != (GAS_VOLATILE_FUEL in scrubbing_gas))
toggle += GAS_VOLATILE_FUEL
else if(signal.data["toggle_fuel_scrub"])
toggle += "volatile_fuel"
toggle += GAS_VOLATILE_FUEL
scrubbing_gas ^= toggle
@@ -1,2 +1,2 @@
/obj/machinery/atmospherics/unary/vent_scrubber
scrubbing_gas = list("carbon_dioxide", "phoron")
scrubbing_gas = list(GAS_CO2, GAS_PHORON)
+7 -7
View File
@@ -79,8 +79,8 @@
air_temporary.volume = volume
air_temporary.temperature = T20C
air_temporary.adjust_multi("oxygen", (start_pressure*O2STANDARD)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature), \
"nitrogen",(start_pressure*N2STANDARD)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature))
air_temporary.adjust_multi(GAS_O2, (start_pressure*O2STANDARD)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature), \
GAS_N2,(start_pressure*N2STANDARD)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature))
. = ..()
@@ -95,7 +95,7 @@
air_temporary.volume = volume
air_temporary.temperature = T20C
air_temporary.adjust_gas("oxygen", (start_pressure)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature))
air_temporary.adjust_gas(GAS_O2, (start_pressure)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature))
. = ..()
icon_state = "o2"
@@ -110,7 +110,7 @@
air_temporary.volume = volume
air_temporary.temperature = T20C
air_temporary.adjust_gas("nitrogen", (start_pressure)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature))
air_temporary.adjust_gas(GAS_N2, (start_pressure)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature))
. = ..()
icon_state = "n2"
@@ -124,7 +124,7 @@
air_temporary.volume = volume
air_temporary.temperature = T20C
air_temporary.adjust_gas("carbon_dioxide", (start_pressure)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature))
air_temporary.adjust_gas(GAS_CO2, (start_pressure)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature))
. = ..()
icon_state = "co2"
@@ -139,7 +139,7 @@
air_temporary.volume = volume
air_temporary.temperature = T20C
air_temporary.adjust_gas("phoron", (start_pressure)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature))
air_temporary.adjust_gas(GAS_PHORON, (start_pressure)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature))
. = ..()
icon_state = "phoron"
@@ -153,7 +153,7 @@
air_temporary.volume = volume
air_temporary.temperature = T0C
air_temporary.adjust_gas("nitrous_oxide", (start_pressure)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature))
air_temporary.adjust_gas(GAS_N2O, (start_pressure)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature))
. = ..()
icon_state = "n2o"