mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 02:16:05 +00:00
@@ -61,6 +61,12 @@
|
||||
#define PLASMA_MINIMUM_OXYGEN_PLASMA_RATIO 20
|
||||
#define PLASMA_OXYGEN_FULLBURN 10
|
||||
|
||||
// XGM gas flags.
|
||||
#define XGM_GAS_FUEL 1
|
||||
#define XGM_GAS_OXIDIZER 2
|
||||
#define XGM_GAS_CONTAMINANT 4
|
||||
#define XGM_GAS_LOGGED 8
|
||||
|
||||
#define TANK_LEAK_PRESSURE (30.*ONE_ATMOSPHERE) // Tank starts leaking
|
||||
#define TANK_RUPTURE_PRESSURE (40.*ONE_ATMOSPHERE) // Tank spills all contents into atmosphere
|
||||
#define TANK_FRAGMENT_PRESSURE (50.*ONE_ATMOSPHERE) // Boom 3x3 base explosion
|
||||
|
||||
114
__DEFINES/gases.dm
Normal file
114
__DEFINES/gases.dm
Normal file
@@ -0,0 +1,114 @@
|
||||
#define GAS_OXYGEN "oxygen"
|
||||
#define GAS_NITROGEN "nitrogen"
|
||||
#define GAS_CARBON "carbon_dioxide"
|
||||
#define GAS_PLASMA "plasma"
|
||||
#define GAS_SLEEPING "sleeping_agent"
|
||||
#define GAS_VOLATILE "volatile_fuel"
|
||||
#define GAS_OXAGENT "oxygen_agent_b"
|
||||
|
||||
/datum/gas
|
||||
var/id = ""
|
||||
var/name = "Unnamed Gas"
|
||||
var/short_name // HTML-formatted short name.
|
||||
var/specific_heat = 20 // J/(mol*K)
|
||||
var/molar_mass = 0.032 // kg/mol
|
||||
|
||||
var/tile_overlay = null
|
||||
var/overlay_limit = null
|
||||
|
||||
var/flags = 0
|
||||
|
||||
/datum/gas/proc/is_human_safe(var/moles, var/datum/gas_mixture/mixture)
|
||||
return TRUE
|
||||
|
||||
/datum/gas/oxygen
|
||||
id = GAS_OXYGEN
|
||||
name = "Oxygen"
|
||||
short_name = "O<sub>2</sub>"
|
||||
specific_heat = 20 // J/(mol*K)
|
||||
molar_mass = 0.032 // kg/mol
|
||||
|
||||
flags = XGM_GAS_OXIDIZER
|
||||
|
||||
/datum/gas/oxygen/is_human_safe(var/moles, var/datum/gas_mixture/mixture)
|
||||
return abs(moles/mixture.total_moles() - O2STANDARD) < 0.02
|
||||
|
||||
/datum/gas/nitrogen
|
||||
id = GAS_NITROGEN
|
||||
name = "Nitrogen"
|
||||
short_name = "N<sub>2</sub>"
|
||||
specific_heat = 20 // J/(mol*K)
|
||||
molar_mass = 0.028 // kg/mol
|
||||
|
||||
/datum/gas/nitrogen/is_human_safe(var/moles, var/datum/gas_mixture/mixture)
|
||||
return abs(moles/mixture.total_moles() - N2STANDARD) < 0.2
|
||||
|
||||
/datum/gas/carbon_dioxide
|
||||
id = GAS_CARBON
|
||||
name = "Carbon Dioxide"
|
||||
short_name = "CO<sub>2</sub>"
|
||||
specific_heat = 30 // J/(mol*K)
|
||||
molar_mass = 0.044 // kg/mol
|
||||
|
||||
flags = XGM_GAS_LOGGED
|
||||
|
||||
/datum/gas/carbon_dioxide/is_human_safe(var/moles, var/datum/gas_mixture/mixture)
|
||||
return moles/mixture.total_moles() < 0.01
|
||||
|
||||
/datum/gas/plasma
|
||||
id = GAS_PLASMA
|
||||
name = "Plasma"
|
||||
|
||||
//Note that this has a significant impact on TTV yield.
|
||||
//Because it is so high, any leftover plasma soaks up a lot of heat and drops the yield pressure.
|
||||
specific_heat = 200 // J/(mol*K)
|
||||
|
||||
//Hypothetical group 14 (same as carbon), period 8 element.
|
||||
//Using multiplicity rule, it's atomic number is 162
|
||||
//and following a N/Z ratio of 1.5, the molar mass of a monatomic gas is:
|
||||
molar_mass = 0.405 // kg/mol
|
||||
|
||||
tile_overlay = "plasma"
|
||||
overlay_limit = MOLES_PLASMA_VISIBLE / CELL_VOLUME
|
||||
flags = XGM_GAS_FUEL | XGM_GAS_CONTAMINANT | XGM_GAS_LOGGED
|
||||
|
||||
/datum/gas/plasma/is_human_safe(var/moles, var/datum/gas_mixture/mixture)
|
||||
return moles/mixture.total_moles() < 0.01
|
||||
|
||||
/datum/gas/sleeping_agent
|
||||
id = GAS_SLEEPING
|
||||
name = "Sleeping Agent"
|
||||
short_name = "N<sub>2</sub>O"
|
||||
specific_heat = 40 // J/(mol*K)
|
||||
molar_mass = 0.044 // kg/mol. N₂O
|
||||
|
||||
tile_overlay = "sleeping_agent"
|
||||
overlay_limit = 1 / CELL_VOLUME
|
||||
flags = XGM_GAS_OXIDIZER | XGM_GAS_LOGGED // N₂O is a powerful oxidizer
|
||||
|
||||
/datum/gas/sleeping_agent/is_human_safe(var/moles, var/datum/gas_mixture/mixture)
|
||||
return moles/mixture.total_moles() < 0.01
|
||||
|
||||
/datum/gas/volatile_fuel
|
||||
id = GAS_VOLATILE
|
||||
name = "Volatile Fuel"
|
||||
|
||||
specific_heat = 30
|
||||
molar_mass = 0.163 // @MoMMI#9954 roll 32 405
|
||||
|
||||
flags = XGM_GAS_FUEL | XGM_GAS_LOGGED
|
||||
|
||||
/datum/gas/volatile_fuel/is_human_safe(var/moles, var/datum/gas_mixture/mixture)
|
||||
return moles/mixture.total_moles() < 0.01
|
||||
|
||||
/datum/gas/oxygen_agent_b
|
||||
id = GAS_OXAGENT
|
||||
name = "Oxygen Agent B"
|
||||
|
||||
specific_heat = 300
|
||||
molar_mass = 0.300
|
||||
|
||||
flags = XGM_GAS_FUEL | XGM_GAS_OXIDIZER | XGM_GAS_CONTAMINANT | XGM_GAS_LOGGED
|
||||
|
||||
/datum/gas/oxygen_agent_b/is_human_safe(var/moles, var/datum/gas_mixture/mixture)
|
||||
return moles/mixture.total_moles() < 0.01
|
||||
@@ -144,20 +144,13 @@
|
||||
interface.updateContent("pressurereadout", round(air.return_pressure(), 0.01))
|
||||
interface.updateContent("tempreadout", air.return_temperature())
|
||||
|
||||
var/total_moles = air.total_moles()
|
||||
var/total_moles = air.total_moles
|
||||
if(round(total_moles, 0.01)) //Check if there's total moles to avoid divisions by zero.
|
||||
interface.updateContent("oxypercent", Clamp(round(100 * air.oxygen / total_moles, 0.1), 0, 100))
|
||||
interface.updateContent("nitpercent", Clamp(round(100 * air.nitrogen / total_moles, 0.1), 0, 100))
|
||||
interface.updateContent("co2percent", Clamp(round(100 * air.carbon_dioxide / total_moles, 0.1), 0, 100))
|
||||
interface.updateContent("plapercent", Clamp(round(100 * air.toxins / total_moles, 0.1), 0, 100))
|
||||
|
||||
//Begin stupid shit to get the N2O amount.
|
||||
var/datum/gas/sleeping_agent/G = locate(/datum/gas/sleeping_agent) in air.trace_gases
|
||||
var/n2o_moles = 0
|
||||
if(G)
|
||||
n2o_moles = G.moles
|
||||
|
||||
interface.updateContent("n2opercent", Clamp(round(100 * n2o_moles / total_moles, 0.1), 0, 100))
|
||||
interface.updateContent("oxypercent", Clamp(round(100 * air[GAS_OXYGEN] / total_moles, 0.1), 0, 100))
|
||||
interface.updateContent("nitpercent", Clamp(round(100 * air[GAS_NITROGEN] / total_moles, 0.1), 0, 100))
|
||||
interface.updateContent("co2percent", Clamp(round(100 * air[GAS_CARBON] / total_moles, 0.1), 0, 100))
|
||||
interface.updateContent("plapercent", Clamp(round(100 * air[GAS_PLASMA] / total_moles, 0.1), 0, 100))
|
||||
interface.updateContent("n2opercent", Clamp(round(100 * air[GAS_SLEEPING] / total_moles, 0.1), 0, 100))
|
||||
|
||||
else
|
||||
interface.updateContent("oxypercent", 0)
|
||||
|
||||
@@ -83,39 +83,26 @@ obj/machinery/atmospherics/trinary/filter/process()
|
||||
var/datum/gas_mixture/filtered_out = new
|
||||
filtered_out.temperature = removed.temperature
|
||||
|
||||
#define FILTER(g) filtered_out.adjust_gas((g), removed[g])
|
||||
switch(filter_type)
|
||||
if(0) //removing hydrocarbons
|
||||
filtered_out.toxins = removed.toxins
|
||||
removed.toxins = 0
|
||||
|
||||
if(removed.trace_gases.len>0)
|
||||
for(var/datum/gas/trace_gas in removed.trace_gases)
|
||||
if(istype(trace_gas, /datum/gas/oxygen_agent_b))
|
||||
removed.trace_gases -= trace_gas
|
||||
filtered_out.trace_gases += trace_gas
|
||||
FILTER(GAS_PLASMA)
|
||||
FILTER(GAS_OXAGENT)
|
||||
|
||||
if(1) //removing O2
|
||||
filtered_out.oxygen = removed.oxygen
|
||||
removed.oxygen = 0
|
||||
FILTER(GAS_OXYGEN)
|
||||
|
||||
if(2) //removing N2
|
||||
filtered_out.nitrogen = removed.nitrogen
|
||||
removed.nitrogen = 0
|
||||
FILTER(GAS_NITROGEN)
|
||||
|
||||
if(3) //removing CO2
|
||||
filtered_out.carbon_dioxide = removed.carbon_dioxide
|
||||
removed.carbon_dioxide = 0
|
||||
FILTER(GAS_CARBON)
|
||||
|
||||
if(4)//removing N2O
|
||||
if(removed.trace_gases.len>0)
|
||||
for(var/datum/gas/trace_gas in removed.trace_gases)
|
||||
if(istype(trace_gas, /datum/gas/sleeping_agent))
|
||||
removed.trace_gases -= trace_gas
|
||||
filtered_out.trace_gases += trace_gas
|
||||
|
||||
else
|
||||
filtered_out = null
|
||||
FILTER(GAS_SLEEPING)
|
||||
|
||||
removed.subtract(filtered_out)
|
||||
#undef FILTER
|
||||
|
||||
air2.merge(filtered_out)
|
||||
air3.merge(removed)
|
||||
|
||||
@@ -41,9 +41,9 @@ obj/machinery/atmospherics/unary/oxygen_generator/process()
|
||||
var/added_oxygen = oxygen_content - total_moles
|
||||
|
||||
air_contents.temperature = (current_heat_capacity*air_contents.temperature + 20*added_oxygen*T0C)/(current_heat_capacity+20*added_oxygen)
|
||||
air_contents.oxygen += added_oxygen
|
||||
air_contents.adjust_gas(GAS_OXYGEN, added_oxygen)
|
||||
|
||||
if(network)
|
||||
network.update = 1
|
||||
|
||||
return 1
|
||||
return 1
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
/obj/machinery/atmospherics/unary/tank/carbon_dioxide/New()
|
||||
..()
|
||||
|
||||
air_contents.carbon_dioxide = (25*ONE_ATMOSPHERE)*(starting_volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
air_contents.adjust_gas(GAS_CARBON, (25*ONE_ATMOSPHERE)*(starting_volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature))
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/tank/toxins
|
||||
@@ -38,7 +38,7 @@
|
||||
/obj/machinery/atmospherics/unary/tank/toxins/New()
|
||||
..()
|
||||
|
||||
air_contents.toxins = (25*ONE_ATMOSPHERE)*(starting_volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
air_contents.adjust_gas(GAS_PLASMA, (25*ONE_ATMOSPHERE)*(starting_volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature))
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/tank/oxygen_agent_b
|
||||
@@ -48,10 +48,7 @@
|
||||
/obj/machinery/atmospherics/unary/tank/oxygen_agent_b/New()
|
||||
..()
|
||||
|
||||
var/datum/gas/oxygen_agent_b/trace_gas = new
|
||||
trace_gas.moles = (25*ONE_ATMOSPHERE)*(starting_volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
|
||||
air_contents.trace_gases += trace_gas
|
||||
air_contents.adjust_gas(GAS_OXAGENT, (25*ONE_ATMOSPHERE)*(starting_volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature))
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/tank/oxygen
|
||||
@@ -62,7 +59,7 @@
|
||||
/obj/machinery/atmospherics/unary/tank/oxygen/New()
|
||||
..()
|
||||
|
||||
air_contents.oxygen = (25*ONE_ATMOSPHERE)*(starting_volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
air_contents.adjust_gas(GAS_OXYGEN, (25*ONE_ATMOSPHERE)*(starting_volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature))
|
||||
|
||||
/obj/machinery/atmospherics/unary/tank/nitrogen
|
||||
icon_state = "n2"
|
||||
@@ -72,7 +69,7 @@
|
||||
/obj/machinery/atmospherics/unary/tank/nitrogen/New()
|
||||
..()
|
||||
|
||||
air_contents.nitrogen = (25*ONE_ATMOSPHERE)*(starting_volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
air_contents.adjust_gas(GAS_NITROGEN, (25*ONE_ATMOSPHERE)*(starting_volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature))
|
||||
|
||||
/obj/machinery/atmospherics/unary/tank/air
|
||||
icon_state = "air"
|
||||
@@ -82,8 +79,9 @@
|
||||
/obj/machinery/atmospherics/unary/tank/air/New()
|
||||
..()
|
||||
|
||||
air_contents.oxygen = (25*ONE_ATMOSPHERE*O2STANDARD)*(starting_volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
air_contents.nitrogen = (25*ONE_ATMOSPHERE*N2STANDARD)*(starting_volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
air_contents.adjust_multi(
|
||||
GAS_OXYGEN, (25*ONE_ATMOSPHERE*O2STANDARD)*(starting_volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature),
|
||||
GAS_NITROGEN, (25*ONE_ATMOSPHERE*N2STANDARD)*(starting_volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature))
|
||||
|
||||
/obj/machinery/atmospherics/unary/tank/update_icon()
|
||||
..()
|
||||
|
||||
@@ -157,12 +157,12 @@
|
||||
if(scrubbing)
|
||||
// Are we scrubbing gasses that are present?
|
||||
if(\
|
||||
(scrub_Toxins && environment.toxins > 0) ||\
|
||||
(scrub_CO2 && environment.carbon_dioxide > 0) ||\
|
||||
(scrub_N2O && environment.trace_gases.len > 0) ||\
|
||||
(scrub_O2 && environment.oxygen > 0) ||\
|
||||
(scrub_N2 && environment.nitrogen > 0))
|
||||
var/transfer_moles = min(1, volume_rate / environment.volume) * environment.total_moles()
|
||||
(scrub_Toxins && environment[GAS_PLASMA] > 0) ||\
|
||||
(scrub_CO2 && environment[GAS_CARBON] > 0) ||\
|
||||
(scrub_N2O && environment[GAS_SLEEPING] > 0) ||\
|
||||
(scrub_O2 && environment[GAS_OXYGEN] > 0) ||\
|
||||
(scrub_N2 && environment[GAS_NITROGEN] > 0))
|
||||
var/transfer_moles = min(1, volume_rate / environment.volume) * environment.total_moles
|
||||
|
||||
//Take a gas sample
|
||||
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
|
||||
@@ -173,31 +173,27 @@
|
||||
var/datum/gas_mixture/filtered_out = new
|
||||
filtered_out.temperature = removed.temperature
|
||||
|
||||
#define FILTER(g) filtered_out.adjust_gas((g), removed[g], FALSE)
|
||||
if(scrub_Toxins)
|
||||
filtered_out.toxins = removed.toxins
|
||||
removed.toxins = 0
|
||||
FILTER(GAS_PLASMA)
|
||||
|
||||
if(scrub_CO2)
|
||||
filtered_out.carbon_dioxide = removed.carbon_dioxide
|
||||
removed.carbon_dioxide = 0
|
||||
FILTER(GAS_CARBON)
|
||||
|
||||
if(scrub_O2)
|
||||
filtered_out.oxygen = removed.oxygen
|
||||
removed.oxygen = 0
|
||||
FILTER(GAS_OXYGEN)
|
||||
|
||||
if(scrub_N2)
|
||||
filtered_out.nitrogen = removed.nitrogen
|
||||
removed.nitrogen = 0
|
||||
FILTER(GAS_NITROGEN)
|
||||
|
||||
if(removed.trace_gases.len>0)
|
||||
for(var/datum/gas/trace_gas in removed.trace_gases)
|
||||
if(istype(trace_gas, /datum/gas/oxygen_agent_b))
|
||||
removed.trace_gases -= trace_gas
|
||||
filtered_out.trace_gases += trace_gas
|
||||
else if(istype(trace_gas, /datum/gas/sleeping_agent) && scrub_N2O)
|
||||
removed.trace_gases -= trace_gas
|
||||
filtered_out.trace_gases += trace_gas
|
||||
if(scrub_N2O)
|
||||
FILTER(GAS_SLEEPING)
|
||||
|
||||
FILTER(GAS_OXAGENT) //Apparently this is always scrubbed, even though it doesn't seem to appear in-game anywhere
|
||||
|
||||
filtered_out.update_values()
|
||||
removed.subtract(filtered_out)
|
||||
#undef FILTER
|
||||
|
||||
//Remix the resulting gases
|
||||
air_contents.merge(filtered_out)
|
||||
|
||||
@@ -98,141 +98,36 @@
|
||||
/datum/pipe_network/proc/reconcile_air()
|
||||
//Perfectly equalize all gases members instantly
|
||||
|
||||
//Calculate totals from individual components
|
||||
var/total_thermal_energy = 0
|
||||
var/total_heat_capacity = 0
|
||||
air_transient.multiply(0)
|
||||
|
||||
//air_transient.volume = 0
|
||||
var/air_transient_volume = 0
|
||||
|
||||
air_transient.oxygen = 0
|
||||
air_transient.nitrogen = 0
|
||||
air_transient.toxins = 0
|
||||
air_transient.carbon_dioxide = 0
|
||||
|
||||
|
||||
air_transient.trace_gases = list()
|
||||
air_transient.volume = 0
|
||||
|
||||
for(var/datum/gas_mixture/gas in gases)
|
||||
air_transient_volume += gas.volume
|
||||
var/temp_heatcap = gas.heat_capacity()
|
||||
total_thermal_energy += gas.temperature*temp_heatcap
|
||||
total_heat_capacity += temp_heatcap
|
||||
air_transient.volume += gas.volume
|
||||
air_transient.merge(gas, FALSE)
|
||||
|
||||
air_transient.oxygen += gas.oxygen
|
||||
air_transient.nitrogen += gas.nitrogen
|
||||
air_transient.toxins += gas.toxins
|
||||
air_transient.carbon_dioxide += gas.carbon_dioxide
|
||||
if(air_transient.volume > 0)
|
||||
//Allow air mixture to react
|
||||
if(air_transient.react())
|
||||
update = 1
|
||||
|
||||
if(gas.trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in gas.trace_gases)
|
||||
var/datum/gas/corresponding = locate(trace_gas.type) in air_transient.trace_gases
|
||||
if(!corresponding)
|
||||
corresponding = new trace_gas.type()
|
||||
air_transient.trace_gases += corresponding
|
||||
|
||||
corresponding.moles += trace_gas.moles
|
||||
|
||||
air_transient.volume = air_transient_volume
|
||||
|
||||
if(air_transient_volume > 0)
|
||||
|
||||
if(total_heat_capacity > 0)
|
||||
air_transient.temperature = total_thermal_energy/total_heat_capacity
|
||||
|
||||
//Allow air mixture to react
|
||||
if(air_transient.react())
|
||||
update = 1
|
||||
|
||||
else
|
||||
air_transient.temperature = 0
|
||||
|
||||
//Update individual gas_mixtures by volume ratio
|
||||
air_transient.update_values()
|
||||
for(var/datum/gas_mixture/gas in gases)
|
||||
var/volume_ratio = gas.volume / air_transient.volume
|
||||
gas.copy_from(air_transient)
|
||||
|
||||
gas.oxygen = air_transient.oxygen * volume_ratio
|
||||
gas.nitrogen = air_transient.nitrogen * volume_ratio
|
||||
gas.toxins = air_transient.toxins * volume_ratio
|
||||
gas.carbon_dioxide = air_transient.carbon_dioxide * volume_ratio
|
||||
|
||||
gas.temperature = air_transient.temperature
|
||||
|
||||
if(air_transient.trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in air_transient.trace_gases)
|
||||
var/datum/gas/corresponding = locate(trace_gas.type) in gas.trace_gases
|
||||
|
||||
if(!corresponding)
|
||||
corresponding = new trace_gas.type()
|
||||
gas.trace_gases += corresponding
|
||||
|
||||
corresponding.moles = trace_gas.moles * volume_ratio
|
||||
|
||||
gas.update_values()
|
||||
|
||||
air_transient.update_values()
|
||||
return 1
|
||||
|
||||
proc/equalize_gases(datum/gas_mixture/list/gases)
|
||||
/proc/equalize_gases(datum/gas_mixture/list/gases)
|
||||
//Perfectly equalize all gases members instantly
|
||||
|
||||
//Calculate totals from individual components
|
||||
var/total_volume = 0
|
||||
var/total_thermal_energy = 0
|
||||
var/total_heat_capacity = 0
|
||||
|
||||
var/total_oxygen = 0
|
||||
var/total_nitrogen = 0
|
||||
var/total_toxins = 0
|
||||
var/total_carbon_dioxide = 0
|
||||
|
||||
var/list/total_trace_gases = list()
|
||||
var/datum/gas_mixture/temp = new()
|
||||
temp.volume = 0
|
||||
|
||||
for(var/datum/gas_mixture/gas in gases)
|
||||
total_volume += gas.volume
|
||||
var/temp_heatcap = gas.heat_capacity()
|
||||
total_thermal_energy += gas.temperature*temp_heatcap
|
||||
total_heat_capacity += temp_heatcap
|
||||
temp.volume += gas.volume
|
||||
temp.merge(gas)
|
||||
|
||||
total_oxygen += gas.oxygen
|
||||
total_nitrogen += gas.nitrogen
|
||||
total_toxins += gas.toxins
|
||||
total_carbon_dioxide += gas.carbon_dioxide
|
||||
|
||||
if(gas.trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in gas.trace_gases)
|
||||
var/datum/gas/corresponding = locate(trace_gas.type) in total_trace_gases
|
||||
if(!corresponding)
|
||||
corresponding = new trace_gas.type()
|
||||
total_trace_gases += corresponding
|
||||
|
||||
corresponding.moles += trace_gas.moles
|
||||
|
||||
if(total_volume > 0)
|
||||
|
||||
//Calculate temperature
|
||||
var/temperature = 0
|
||||
|
||||
if(total_heat_capacity > 0)
|
||||
temperature = total_thermal_energy/total_heat_capacity
|
||||
|
||||
//Update individual gas_mixtures by volume ratio
|
||||
for(var/datum/gas_mixture/gas in gases)
|
||||
gas.oxygen = total_oxygen*gas.volume/total_volume
|
||||
gas.nitrogen = total_nitrogen*gas.volume/total_volume
|
||||
gas.toxins = total_toxins*gas.volume/total_volume
|
||||
gas.carbon_dioxide = total_carbon_dioxide*gas.volume/total_volume
|
||||
|
||||
gas.temperature = temperature
|
||||
|
||||
if(total_trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in total_trace_gases)
|
||||
var/datum/gas/corresponding = locate(trace_gas.type) in gas.trace_gases
|
||||
if(!corresponding)
|
||||
corresponding = new trace_gas.type()
|
||||
gas.trace_gases += corresponding
|
||||
|
||||
corresponding.moles = trace_gas.moles*gas.volume/total_volume
|
||||
gas.update_values()
|
||||
for(var/datum/gas_mixture/gas in gases)
|
||||
gas.copy_from(temp)
|
||||
|
||||
return 1
|
||||
|
||||
@@ -46,23 +46,9 @@
|
||||
//Update individual gas_mixtures by volume ratio
|
||||
|
||||
for(var/obj/machinery/atmospherics/pipe/member in members)
|
||||
member.air_temporary = new
|
||||
member.air_temporary = new()
|
||||
member.air_temporary.volume = member.volume
|
||||
|
||||
member.air_temporary.oxygen = air.oxygen*member.volume/air.volume
|
||||
member.air_temporary.nitrogen = air.nitrogen*member.volume/air.volume
|
||||
member.air_temporary.toxins = air.toxins*member.volume/air.volume
|
||||
member.air_temporary.carbon_dioxide = air.carbon_dioxide*member.volume/air.volume
|
||||
|
||||
member.air_temporary.temperature = air.temperature
|
||||
|
||||
if(air.trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in air.trace_gases)
|
||||
var/datum/gas/corresponding = new trace_gas.type()
|
||||
member.air_temporary.trace_gases += corresponding
|
||||
|
||||
corresponding.moles = trace_gas.moles*member.volume/air.volume
|
||||
member.air_temporary.update_values()
|
||||
member.air_temporary.copy_from(air)
|
||||
|
||||
/datum/pipeline/proc/build_pipeline(obj/machinery/atmospherics/pipe/base)
|
||||
var/list/possible_expansions = list(base)
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
..()
|
||||
var/turf/T = get_turf(src)
|
||||
var/datum/gas_mixture/env = T.return_air()
|
||||
if(env.molar_density("oxygen") < 5 / CELL_VOLUME)
|
||||
if(env.molar_density(GAS_OXYGEN) < 5 / CELL_VOLUME)
|
||||
to_chat(user, "<span class='notice'>You try to light \the [name], but it won't catch on fire!")
|
||||
return
|
||||
if(!on && cell.charge > 0)
|
||||
@@ -320,7 +320,7 @@
|
||||
var/list/comfyfire = list('sound/misc/comfyfire1.ogg','sound/misc/comfyfire2.ogg','sound/misc/comfyfire3.ogg',)
|
||||
if(Floor(cell.charge/10) != lastcharge)
|
||||
update_icon()
|
||||
if(!(cell && cell.charge > 0) && nocell != 2 | env.oxygen < 5)
|
||||
if(!(cell && cell.charge > 0) && nocell != 2 | env.molar_density(GAS_OXYGEN) < 5 / CELL_VOLUME)
|
||||
new /obj/effect/decal/cleanable/campfire(get_turf(src))
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
@@ -4,7 +4,7 @@ Deuterium-deuterium fusion : 40 x 10^7 K
|
||||
Deuterium-tritium fusion: 4.5 x 10^7 K
|
||||
*/
|
||||
|
||||
//#DEFINE MAX_STORED_ENERGY (held_plasma.toxins * held_plasma.toxins * SPECIFIC_HEAT_TOXIN)
|
||||
//#DEFINE MAX_STORED_ENERGY (held_plasma[GAS_PLASMA] * held_plasma[GAS_PLASMA] * SPECIFIC_HEAT_TOXIN)
|
||||
|
||||
/obj/effect/rust_em_field
|
||||
name = "EM Field"
|
||||
@@ -139,7 +139,7 @@ Deuterium-tritium fusion: 4.5 x 10^7 K
|
||||
//the amount of plasma pulled in each update is relative to the field strength, with 50T (max field strength) = 100% of area covered by the field
|
||||
//at minimum strength, 0.25% of the field volume is pulled in per update (?)
|
||||
//have a max of 1000 moles suspended
|
||||
if(held_plasma.toxins < transfer_ratio * 1000)
|
||||
if(held_plasma[GAS_PLASMA] < transfer_ratio * 1000)
|
||||
var/moles_covered = environment.return_pressure()*volume_covered/(environment.temperature * R_IDEAL_GAS_EQUATION)
|
||||
// to_chat(world, "<span class='notice'>moles_covered: [moles_covered]</span>")
|
||||
//
|
||||
@@ -149,15 +149,12 @@ Deuterium-tritium fusion: 4.5 x 10^7 K
|
||||
//The min() in the following line of code simulates that bug, because god is dead.
|
||||
//Obviously the correct solution would be to fix all the errors in here, but that would involve rebalancing every magic number in this file.
|
||||
var/datum/gas_mixture/gas_covered = environment.remove(min(moles_covered, environment.molar_density() * CELL_VOLUME))
|
||||
var/datum/gas_mixture/plasma_captured = new /datum/gas_mixture()
|
||||
var/datum/gas_mixture/plasma_captured = new()
|
||||
//
|
||||
plasma_captured.toxins = round(gas_covered.toxins * transfer_ratio)
|
||||
// to_chat(world, "<span class='warning'>[plasma_captured.toxins] moles of plasma captured</span>")
|
||||
plasma_captured.temperature = gas_covered.temperature
|
||||
plasma_captured.update_values()
|
||||
plasma_captured.adjust_gas(GAS_PLASMA, round(gas_covered[GAS_PLASMA] * transfer_ratio))
|
||||
//
|
||||
gas_covered.toxins -= plasma_captured.toxins
|
||||
gas_covered.update_values()
|
||||
gas_covered.subtract(plasma_captured)
|
||||
//
|
||||
held_plasma.merge(plasma_captured)
|
||||
//
|
||||
@@ -175,15 +172,15 @@ Deuterium-tritium fusion: 4.5 x 10^7 K
|
||||
|
||||
//change held plasma temp according to energy levels
|
||||
//SPECIFIC_HEAT_TOXIN
|
||||
if(mega_energy > 0 && held_plasma.toxins)
|
||||
if(mega_energy > 0 && held_plasma[GAS_PLASMA])
|
||||
var/heat_capacity = held_plasma.heat_capacity()//200 * number of plasma moles
|
||||
if(heat_capacity > 0.0003) //formerly MINIMUM_HEAT_CAPACITY
|
||||
held_plasma.temperature = (heat_capacity + mega_energy * 35000)/heat_capacity
|
||||
|
||||
//if there is too much plasma in the field, lose some
|
||||
/*if( held_plasma.toxins > (MOLES_CELLSTANDARD * 7) * (50 / field_strength) )
|
||||
/*if( held_plasma[GAS_PLASMA] > (MOLES_CELLSTANDARD * 7) * (50 / field_strength) )
|
||||
Loseplasma()*/
|
||||
if(held_plasma.toxins > 1)
|
||||
if(held_plasma[GAS_PLASMA] > 1)
|
||||
//lose a random amount of plasma back into the air, increased by the field strength (want to switch this over to frequency eventually)
|
||||
var/loss_ratio = rand() * (0.05 + (0.05 * 50 / field_strength))
|
||||
// to_chat(world, "lost [loss_ratio*100]% of held plasma")
|
||||
@@ -191,17 +188,14 @@ Deuterium-tritium fusion: 4.5 x 10^7 K
|
||||
var/datum/gas_mixture/plasma_lost = new
|
||||
plasma_lost.temperature = held_plasma.temperature
|
||||
//
|
||||
plasma_lost.toxins = held_plasma.toxins * loss_ratio
|
||||
//plasma_lost.update_values()
|
||||
held_plasma.toxins -= held_plasma.toxins * loss_ratio
|
||||
//held_plasma.update_values()
|
||||
plasma_lost.adjust_gas(GAS_PLASMA, held_plasma[GAS_PLASMA] * loss_ratio)
|
||||
held_plasma.subtract(plasma_lost)
|
||||
//
|
||||
environment.merge(plasma_lost)
|
||||
radiation += loss_ratio * mega_energy * 0.1
|
||||
mega_energy -= loss_ratio * mega_energy * 0.1
|
||||
else
|
||||
held_plasma.toxins = 0
|
||||
//held_plasma.update_values()
|
||||
held_plasma.multiply(0) //Pretty sure this is equivalent but this thing is so fucked up already I don't even care enough to make sure
|
||||
|
||||
//handle some reactants formatting
|
||||
for(var/reactant in dormant_reactant_quantities)
|
||||
|
||||
@@ -299,8 +299,9 @@
|
||||
cabin_air = new
|
||||
cabin_air.temperature = T20C
|
||||
cabin_air.volume = 200
|
||||
cabin_air.oxygen = O2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
|
||||
cabin_air.nitrogen = N2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
|
||||
cabin_air.adjust_multi(
|
||||
GAS_OXYGEN, O2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature),
|
||||
GAS_NITROGEN, N2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature))
|
||||
return cabin_air
|
||||
|
||||
/obj/spacepod/proc/add_airtank()
|
||||
|
||||
@@ -7,7 +7,7 @@ client/proc/Zone_Info(turf/T as null|turf)
|
||||
to_chat(mob, "No zone here.")
|
||||
var/datum/gas_mixture/mix = T.return_air()
|
||||
to_chat(mob, "[mix.return_pressure()] kPa [mix.temperature]C")
|
||||
to_chat(mob, "O2: [mix.oxygen] N2: [mix.nitrogen] CO2: [mix.carbon_dioxide] TX: [mix.toxins]")
|
||||
to_chat(mob, "O2: [mix[GAS_OXYGEN]] N2: [mix[GAS_NITROGEN]] CO2: [mix[GAS_CARBON]] TX: [mix[GAS_PLASMA]]")
|
||||
else
|
||||
if(zone_debug_images)
|
||||
for(var/zone in zone_debug_images)
|
||||
@@ -71,157 +71,3 @@ client/proc/Test_ZAS_Connection(var/turf/simulated/T as turf)
|
||||
to_chat(mob, "the initial turf cannot merge.")
|
||||
else
|
||||
to_chat(mob, "both turfs can merge.")
|
||||
|
||||
|
||||
/*zone/proc/DebugDisplay(client/client)
|
||||
if(!istype(client))
|
||||
return
|
||||
|
||||
if(!dbg_output)
|
||||
dbg_output = 1 //Don't want to be spammed when someone investigates a zone...
|
||||
|
||||
if(!client.zone_debug_images)
|
||||
client.zone_debug_images = list()
|
||||
|
||||
var/list/current_zone_images = list()
|
||||
|
||||
for(var/turf/T in contents)
|
||||
current_zone_images += image('icons/misc/debug_group.dmi', T, null, TURF_LAYER)
|
||||
|
||||
for(var/turf/S in unsimulated_tiles)
|
||||
current_zone_images += image('icons/misc/debug_space.dmi', S, null, TURF_LAYER)
|
||||
|
||||
to_chat(client, "<u>Zone Air Contents</u>")
|
||||
to_chat(client, "Oxygen: [air.oxygen]")
|
||||
to_chat(client, "Nitrogen: [air.nitrogen]")
|
||||
to_chat(client, "Plasma: [air.toxins]")
|
||||
to_chat(client, "Carbon Dioxide: [air.carbon_dioxide]")
|
||||
to_chat(client, "Temperature: [air.temperature] K")
|
||||
to_chat(client, "Heat Energy: [air.temperature * air.heat_capacity()] J")
|
||||
to_chat(client, "Pressure: [air.return_pressure()] KPa")
|
||||
to_chat(client, "")
|
||||
to_chat(client, "Unsimulated Zone(space/catwalk) Tiles: [length(unsimulated_tiles)]")
|
||||
to_chat(client, "<u>Connections: [length(connections)]</u>")
|
||||
|
||||
for(var/connection/C in connections)
|
||||
to_chat(client, "\ref[C] [C.A] --> [C.B] [(C.indirect?"Open":"Closed")]")
|
||||
current_zone_images += image('icons/misc/debug_connect.dmi', C.A, null, TURF_LAYER)
|
||||
current_zone_images += image('icons/misc/debug_connect.dmi', C.B, null, TURF_LAYER)
|
||||
|
||||
to_chat(client, "Connected Zones:")
|
||||
for(var/zone/zone in connected_zones)
|
||||
to_chat(client, "\ref[zone] [zone] - [connected_zones[zone]] (Connected)")
|
||||
|
||||
for(var/zone/zone in closed_connection_zones)
|
||||
to_chat(client, "\ref[zone] [zone] - [closed_connection_zones[zone]] (Unconnected)")
|
||||
|
||||
for(var/C in connections)
|
||||
if(!istype(C,/connection))
|
||||
to_chat(client, "[C] (Not Connection!)")
|
||||
|
||||
if(!client.zone_debug_images)
|
||||
client.zone_debug_images = list()
|
||||
client.zone_debug_images[src] = current_zone_images
|
||||
|
||||
client.images += client.zone_debug_images[src]
|
||||
|
||||
else
|
||||
dbg_output = 0
|
||||
|
||||
client.images -= client.zone_debug_images[src]
|
||||
client.zone_debug_images.Remove(src)
|
||||
|
||||
if(SS_READY(SSair))
|
||||
for(var/zone/Z in SSair.zones)
|
||||
if(Z.air == air && Z != src)
|
||||
var/turf/zloc = pick(Z.contents)
|
||||
to_chat(client, "<span class='warning'>Illegal air datum shared by: [zloc.loc.name]</span>")
|
||||
*/
|
||||
|
||||
|
||||
/*client/proc/TestZASRebuild()
|
||||
set category = "Debug"
|
||||
// var/turf/turf = get_turf(mob)
|
||||
var/zone/current_zone = mob.loc:zone
|
||||
if(!current_zone)
|
||||
to_chat(src, "There is no zone there!")
|
||||
return
|
||||
|
||||
var/list/current_adjacents = list()
|
||||
var/list/overlays = list()
|
||||
var/adjacent_id
|
||||
var/lowest_id
|
||||
|
||||
var/list/identical_ids = list()
|
||||
var/list/turfs = current_zone.contents.Copy()
|
||||
var/current_identifier = 1
|
||||
|
||||
for(var/turf/simulated/current in turfs)
|
||||
lowest_id = null
|
||||
current_adjacents = list()
|
||||
|
||||
for(var/direction in cardinal)
|
||||
var/turf/simulated/adjacent = get_step(current, direction)
|
||||
if(!current.ZCross(adjacent))
|
||||
continue
|
||||
if(turfs.Find(adjacent))
|
||||
current_adjacents += adjacent
|
||||
adjacent_id = turfs[adjacent]
|
||||
|
||||
if(adjacent_id && (!lowest_id || adjacent_id < lowest_id))
|
||||
lowest_id = adjacent_id
|
||||
|
||||
if(!lowest_id)
|
||||
lowest_id = current_identifier++
|
||||
identical_ids += lowest_id
|
||||
overlays += image('icons/misc/debug_rebuild.dmi',, "[lowest_id]")
|
||||
|
||||
for(var/turf/simulated/adjacent in current_adjacents)
|
||||
adjacent_id = turfs[adjacent]
|
||||
if(adjacent_id != lowest_id)
|
||||
if(adjacent_id)
|
||||
adjacent.overlays -= overlays[adjacent_id]
|
||||
identical_ids[adjacent_id] = lowest_id
|
||||
|
||||
turfs[adjacent] = lowest_id
|
||||
adjacent.overlays += overlays[lowest_id]
|
||||
|
||||
sleep(5)
|
||||
|
||||
if(turfs[current])
|
||||
current.overlays -= overlays[turfs[current]]
|
||||
turfs[current] = lowest_id
|
||||
current.overlays += overlays[lowest_id]
|
||||
sleep(5)
|
||||
|
||||
var/list/final_arrangement = list()
|
||||
|
||||
for(var/turf/simulated/current in turfs)
|
||||
current_identifier = identical_ids[turfs[current]]
|
||||
current.overlays -= overlays[turfs[current]]
|
||||
current.overlays += overlays[current_identifier]
|
||||
sleep(5)
|
||||
|
||||
if( current_identifier > final_arrangement.len )
|
||||
final_arrangement.len = current_identifier
|
||||
final_arrangement[current_identifier] = list(current)
|
||||
|
||||
else
|
||||
final_arrangement[current_identifier] += current
|
||||
|
||||
//lazy but fast
|
||||
final_arrangement.Remove(null)
|
||||
|
||||
to_chat(src, "There are [final_arrangement.len] unique segments.")
|
||||
|
||||
for(var/turf/current in turfs)
|
||||
current.overlays -= overlays
|
||||
|
||||
return final_arrangement*/
|
||||
|
||||
/* /vg/ - We rolled our own.
|
||||
client/proc/ZASSettings()
|
||||
set category = "Debug"
|
||||
|
||||
vsc.SetDefault(mob)
|
||||
*/
|
||||
|
||||
@@ -164,18 +164,16 @@ Attach to transfer valve and open. BOOM.
|
||||
|
||||
var/datum/gas_mixture/air_contents = S.return_air()
|
||||
|
||||
//and the volatile stuff from the air
|
||||
var/datum/gas/volatile_fuel/fuel = locate() in air_contents.trace_gases
|
||||
|
||||
//since the air is processed in fractions, we need to make sure not to have any minuscle residue or
|
||||
//the amount of moles might get to low for some functions to catch them and thus result in wonky behaviour
|
||||
if(air_contents.molar_density("oxygen") < 0.1 / CELL_VOLUME)
|
||||
air_contents.oxygen = 0
|
||||
if(air_contents.molar_density("toxins") < 0.1 / CELL_VOLUME)
|
||||
air_contents.toxins = 0
|
||||
if(fuel)
|
||||
if(fuel.moles < 0.1)
|
||||
air_contents.trace_gases.Remove(fuel)
|
||||
if(air_contents.molar_density(GAS_OXYGEN) < 0.1 / CELL_VOLUME)
|
||||
air_contents[GAS_OXYGEN] = 0
|
||||
if(air_contents.molar_density(GAS_PLASMA) < 0.1 / CELL_VOLUME)
|
||||
air_contents[GAS_PLASMA] = 0
|
||||
if(air_contents.molar_density(GAS_VOLATILE) < 0.1 / CELL_VOLUME)
|
||||
air_contents[GAS_VOLATILE] = 0
|
||||
|
||||
air_contents.update_values()
|
||||
|
||||
// Check if there is something to combust.
|
||||
if (!air_contents.check_recombustability(S))
|
||||
@@ -277,13 +275,9 @@ datum/gas_mixture/proc/zburn(var/turf/T, force_burn)
|
||||
|
||||
if((temperature > PLASMA_MINIMUM_BURN_TEMPERATURE || force_burn) && check_recombustability(T))
|
||||
var/total_fuel = 0
|
||||
var/datum/gas/volatile_fuel/fuel = locate() in trace_gases
|
||||
|
||||
total_fuel += toxins
|
||||
|
||||
if(fuel)
|
||||
//Volatile Fuel
|
||||
total_fuel += fuel.moles
|
||||
total_fuel += src[GAS_PLASMA]
|
||||
total_fuel += src[GAS_VOLATILE]
|
||||
|
||||
var/can_use_turf=(T && istype(T))
|
||||
if(can_use_turf)
|
||||
@@ -304,10 +298,10 @@ datum/gas_mixture/proc/zburn(var/turf/T, force_burn)
|
||||
var/starting_energy = temperature * heat_capacity()
|
||||
|
||||
//determine the amount of oxygen used
|
||||
var/total_oxygen = min(oxygen, 2 * total_fuel)
|
||||
var/total_oxygen = min(src[GAS_OXYGEN], 2 * total_fuel)
|
||||
|
||||
//determine the amount of fuel actually used
|
||||
var/used_fuel_ratio = min(oxygen / 2 , total_fuel) / total_fuel
|
||||
var/used_fuel_ratio = min(src[GAS_OXYGEN] / 2 , total_fuel) / total_fuel
|
||||
total_fuel = total_fuel * used_fuel_ratio
|
||||
|
||||
var/total_reactants = total_fuel + total_oxygen
|
||||
@@ -316,19 +310,11 @@ datum/gas_mixture/proc/zburn(var/turf/T, force_burn)
|
||||
var/used_reactants_ratio = Clamp(total_reactants * firelevel / zas_settings.Get(/datum/ZAS_Setting/fire_firelevel_multiplier), 0.2, total_reactants) / total_reactants
|
||||
|
||||
//remove and add gasses as calculated
|
||||
oxygen -= min(oxygen, total_oxygen * used_reactants_ratio )
|
||||
|
||||
toxins -= min(toxins, (toxins * used_fuel_ratio * used_reactants_ratio ) * 3)
|
||||
if(toxins < 0)
|
||||
toxins = 0
|
||||
|
||||
carbon_dioxide += max(2 * total_fuel, 0)
|
||||
|
||||
if(fuel)
|
||||
fuel.moles -= (fuel.moles * used_fuel_ratio * used_reactants_ratio) * 5 //Fuel burns 5 times as quick
|
||||
if(fuel.moles <= 0)
|
||||
qdel (fuel)
|
||||
fuel = null
|
||||
adjust_multi(
|
||||
GAS_OXYGEN, -min(src[GAS_OXYGEN], total_oxygen * used_reactants_ratio),
|
||||
GAS_PLASMA, -min(src[GAS_PLASMA], (src[GAS_PLASMA] * used_fuel_ratio * used_reactants_ratio) * 3),
|
||||
GAS_CARBON, max(2 * total_fuel, 0),
|
||||
GAS_VOLATILE, (src[GAS_VOLATILE] * used_fuel_ratio * used_reactants_ratio) * 5) //Fuel burns 5 times as quick
|
||||
|
||||
if(can_use_turf)
|
||||
if(T.getFireFuel()>0)
|
||||
@@ -347,12 +333,10 @@ datum/gas_mixture/proc/zburn(var/turf/T, force_burn)
|
||||
/datum/gas_mixture/proc/check_recombustability(var/turf/T)
|
||||
//this is a copy proc to continue a fire after its been started.
|
||||
|
||||
var/datum/gas/volatile_fuel/fuel = locate() in trace_gases
|
||||
|
||||
if(oxygen && (toxins || fuel))
|
||||
if(QUANTIZE(molar_density("toxins") * zas_settings.Get(/datum/ZAS_Setting/fire_consumption_rate)) >= MOLES_PLASMA_VISIBLE / CELL_VOLUME)
|
||||
if(gas[GAS_OXYGEN] && (gas[GAS_PLASMA] || gas[GAS_VOLATILE]))
|
||||
if(QUANTIZE(molar_density(GAS_PLASMA) * zas_settings.Get(/datum/ZAS_Setting/fire_consumption_rate)) >= MOLES_PLASMA_VISIBLE / CELL_VOLUME)
|
||||
return 1
|
||||
if(fuel && QUANTIZE((fuel.moles / volume) * zas_settings.Get(/datum/ZAS_Setting/fire_consumption_rate)) >= BASE_ZAS_FUEL_REQ / CELL_VOLUME) //Not bothering to make molar_density() support trace_gases since I'm removing those soon anyway
|
||||
if(QUANTIZE(molar_density(GAS_VOLATILE) * zas_settings.Get(/datum/ZAS_Setting/fire_consumption_rate)) >= BASE_ZAS_FUEL_REQ / CELL_VOLUME)
|
||||
return 1
|
||||
|
||||
// Check if we're actually in a turf or not before trying to check object fires.
|
||||
@@ -369,7 +353,7 @@ datum/gas_mixture/proc/zburn(var/turf/T, force_burn)
|
||||
for(var/atom/A in T)
|
||||
if(!A)
|
||||
continue
|
||||
if(!oxygen/* || A.autoignition_temperature > temperature*/)
|
||||
if(!gas[GAS_OXYGEN]/* || A.autoignition_temperature > temperature*/)
|
||||
A.extinguish()
|
||||
continue
|
||||
// if(!A.autoignition_temperature)
|
||||
@@ -391,17 +375,15 @@ datum/gas_mixture/proc/check_combustability(var/turf/T, var/objects)
|
||||
return 0
|
||||
*/
|
||||
|
||||
var/datum/gas/volatile_fuel/fuel = locate() in trace_gases
|
||||
|
||||
if(oxygen && (toxins || fuel))
|
||||
if(QUANTIZE(molar_density("toxins") * zas_settings.Get(/datum/ZAS_Setting/fire_consumption_rate)) >= MOLES_PLASMA_VISIBLE / CELL_VOLUME)
|
||||
if(gas[GAS_OXYGEN] && (gas[GAS_PLASMA] || gas[GAS_VOLATILE]))
|
||||
if(QUANTIZE(molar_density(GAS_PLASMA) * zas_settings.Get(/datum/ZAS_Setting/fire_consumption_rate)) >= MOLES_PLASMA_VISIBLE / CELL_VOLUME)
|
||||
return 1
|
||||
if(fuel && QUANTIZE((fuel.moles / volume) * zas_settings.Get(/datum/ZAS_Setting/fire_consumption_rate)) >= BASE_ZAS_FUEL_REQ / CELL_VOLUME)
|
||||
if(QUANTIZE(molar_density(GAS_VOLATILE) * zas_settings.Get(/datum/ZAS_Setting/fire_consumption_rate)) >= BASE_ZAS_FUEL_REQ / CELL_VOLUME)
|
||||
return 1
|
||||
|
||||
if(objects && istype(T))
|
||||
for(var/atom/A in T)
|
||||
if(!A || !oxygen || A.autoignition_temperature > temperature)
|
||||
if(!A || !gas[GAS_OXYGEN] || A.autoignition_temperature > temperature)
|
||||
continue
|
||||
if(QUANTIZE(A.getFireFuel() * zas_settings.Get(/datum/ZAS_Setting/fire_consumption_rate)) >= A.volatility)
|
||||
return 1
|
||||
@@ -411,13 +393,12 @@ datum/gas_mixture/proc/check_combustability(var/turf/T, var/objects)
|
||||
datum/gas_mixture/proc/calculate_firelevel(var/turf/T)
|
||||
//Calculates the firelevel based on one equation instead of having to do this multiple times in different areas.
|
||||
|
||||
var/datum/gas/volatile_fuel/fuel = locate() in trace_gases
|
||||
var/total_fuel = 0
|
||||
var/firelevel = 0
|
||||
|
||||
if(check_recombustability(T))
|
||||
|
||||
total_fuel += toxins
|
||||
total_fuel += src[GAS_PLASMA]
|
||||
|
||||
if(T && istype(T))
|
||||
total_fuel += T.getFireFuel()
|
||||
@@ -426,21 +407,20 @@ datum/gas_mixture/proc/calculate_firelevel(var/turf/T)
|
||||
if(A)
|
||||
total_fuel += A.getFireFuel()
|
||||
|
||||
if(fuel)
|
||||
total_fuel += fuel.moles
|
||||
total_fuel += src[GAS_VOLATILE]
|
||||
|
||||
var/total_combustables = (total_fuel + oxygen)
|
||||
var/total_combustables = (total_fuel + src[GAS_OXYGEN])
|
||||
|
||||
if(total_fuel > 0 && oxygen > 0)
|
||||
if(total_fuel > 0 && src[GAS_OXYGEN] > 0)
|
||||
|
||||
//slows down the burning when the concentration of the reactants is low
|
||||
var/dampening_multiplier = total_combustables / (total_combustables + nitrogen + carbon_dioxide)
|
||||
var/dampening_multiplier = total_combustables / (total_combustables + src[GAS_NITROGEN] + src[GAS_CARBON])
|
||||
//calculates how close the mixture of the reactants is to the optimum
|
||||
var/mix_multiplier = 1 / (1 + (5 * ((oxygen / total_combustables) ** 2))) // Thanks, Mloc
|
||||
var/mix_multiplier = 1 / (1 + (5 * ((src[GAS_OXYGEN] / total_combustables) ** 2))) // Thanks, Mloc
|
||||
//toss everything together
|
||||
firelevel = zas_settings.Get(/datum/ZAS_Setting/fire_firelevel_multiplier) * mix_multiplier * dampening_multiplier
|
||||
|
||||
return max( 0, firelevel)
|
||||
return max(0, firelevel)
|
||||
|
||||
|
||||
/mob/living/proc/FireBurn(var/firelevel, var/last_temperature, var/pressure)
|
||||
|
||||
@@ -125,18 +125,3 @@ var/image/contamination_overlay = image('icons/effects/contamination.dmi')
|
||||
shoes.contaminate()
|
||||
if(gloves)
|
||||
gloves.contaminate()
|
||||
|
||||
/*
|
||||
/turf/Entered(atom/movable/Obj, atom/OldLoc)
|
||||
..(Obj, OldLoc)
|
||||
|
||||
var/obj/item/I = Obj
|
||||
|
||||
// items that are in plasma, but not on a mob, can still be contaminated.
|
||||
if(istype(I) && zas_settings.Get(/datum/ZAS_Setting/CLOTH_CONTAMINATION))
|
||||
var/datum/gas_mixture/environment = return_air()
|
||||
|
||||
if(environment.toxins > MOLES_PLASMA_VISIBLE + 1)
|
||||
if(I.can_contaminate())
|
||||
I.contaminate()
|
||||
*/
|
||||
|
||||
@@ -1,36 +1,14 @@
|
||||
/turf/simulated/var/zone/zone
|
||||
/turf/simulated/var/open_directions
|
||||
/turf/simulated/var/list/gasGraphics
|
||||
|
||||
/turf/var/needs_air_update = 0
|
||||
/turf/var/datum/gas_mixture/air
|
||||
|
||||
/turf/simulated/proc/set_graphic(const/newGraphics)
|
||||
if (!isnum(newGraphics))
|
||||
return
|
||||
|
||||
if (!newGraphics) // Clear overlay, or simply 0.
|
||||
if (gasGraphics)
|
||||
overlays -= gasGraphics
|
||||
gasGraphics = null
|
||||
|
||||
return
|
||||
|
||||
var/list/overlayGraphics = list()
|
||||
|
||||
if (GRAPHICS_PLASMA & newGraphics)
|
||||
overlayGraphics += plmaster
|
||||
|
||||
if (GRAPHICS_N2O & newGraphics)
|
||||
overlayGraphics += slmaster
|
||||
|
||||
if (overlayGraphics.len)
|
||||
if (gasGraphics)
|
||||
overlays -= gasGraphics
|
||||
gasGraphics = null
|
||||
|
||||
overlays += overlayGraphics
|
||||
gasGraphics = overlayGraphics.Copy()
|
||||
/turf/simulated/proc/update_graphic(list/graphic_add = null, list/graphic_remove = null)
|
||||
if(graphic_add && graphic_add.len)
|
||||
overlays += graphic_add
|
||||
if(graphic_remove && graphic_remove.len)
|
||||
overlays -= graphic_remove
|
||||
|
||||
/turf/proc/update_air_properties()
|
||||
var/block = c_airblock(src)
|
||||
@@ -209,10 +187,10 @@
|
||||
//Create gas mixture to hold data for passing
|
||||
var/datum/gas_mixture/unsimulated/GM = new
|
||||
|
||||
GM.oxygen = oxygen
|
||||
GM.carbon_dioxide = carbon_dioxide
|
||||
GM.nitrogen = nitrogen
|
||||
GM.toxins = toxins
|
||||
GM[GAS_OXYGEN] = oxygen
|
||||
GM[GAS_CARBON] = carbon_dioxide
|
||||
GM[GAS_NITROGEN] = nitrogen
|
||||
GM[GAS_PLASMA] = toxins
|
||||
|
||||
GM.temperature = temperature
|
||||
GM.update_values()
|
||||
@@ -224,10 +202,10 @@
|
||||
|
||||
var/sum = oxygen + carbon_dioxide + nitrogen + toxins
|
||||
if(sum>0)
|
||||
GM.oxygen = (oxygen/sum)*amount
|
||||
GM.carbon_dioxide = (carbon_dioxide/sum)*amount
|
||||
GM.nitrogen = (nitrogen/sum)*amount
|
||||
GM.toxins = (toxins/sum)*amount
|
||||
GM[GAS_OXYGEN] = (oxygen/sum)*amount
|
||||
GM[GAS_CARBON] = (carbon_dioxide/sum)*amount
|
||||
GM[GAS_NITROGEN] = (nitrogen/sum)*amount
|
||||
GM[GAS_PLASMA] = (toxins/sum)*amount
|
||||
|
||||
GM.temperature = temperature
|
||||
GM.update_values()
|
||||
@@ -259,7 +237,11 @@
|
||||
air = new/datum/gas_mixture
|
||||
air.temperature = temperature
|
||||
air.volume = CELL_VOLUME
|
||||
air.adjust(oxygen, carbon_dioxide, nitrogen, toxins)
|
||||
air.adjust_multi(
|
||||
GAS_OXYGEN, oxygen,
|
||||
GAS_CARBON, carbon_dioxide,
|
||||
GAS_NITROGEN, nitrogen,
|
||||
GAS_PLASMA, toxins)
|
||||
|
||||
/turf/simulated/proc/c_copy_air()
|
||||
if(!air)
|
||||
|
||||
40
code/ZAS/XGM.dm
Normal file
40
code/ZAS/XGM.dm
Normal file
@@ -0,0 +1,40 @@
|
||||
/var/datum/xgm_data/XGM = new()
|
||||
|
||||
/datum/xgm_data
|
||||
// List of ID = gas datum.
|
||||
var/list/gases = list()
|
||||
// The friendly, human-readable name for the gas.
|
||||
var/list/name = list()
|
||||
// Shorter and HTML formatted names, falls back to regular name if no short name is given.
|
||||
var/list/short_name = list()
|
||||
// Specific heat of the gas. Used for calculating heat capacity.
|
||||
var/list/specific_heat = list()
|
||||
// Molar mass of the gas. Used for calculating specific entropy.
|
||||
var/list/molar_mass = list()
|
||||
// Tile overlays. /images, created from references to 'icons/effects/tile_effects.dmi'
|
||||
var/list/tile_overlay = list()
|
||||
// Overlay limits. There must be at least this many moles for the overlay to appear.
|
||||
var/list/overlay_limit = list()
|
||||
// Flags.
|
||||
var/list/flags = list()
|
||||
|
||||
/datum/xgm_data/New()
|
||||
for(var/p in subtypesof(/datum/gas))
|
||||
var/datum/gas/gas = new p()
|
||||
|
||||
if(gas.id in gases)
|
||||
stack_trace("Duplicate gas id '[gas.id]' in from typepath '[p]'")
|
||||
continue
|
||||
|
||||
gases[gas.id] = gas
|
||||
name[gas.id] = gas.name
|
||||
short_name[gas.id] = gas.short_name || gas.name
|
||||
specific_heat[gas.id] = gas.specific_heat
|
||||
molar_mass[gas.id] = gas.molar_mass
|
||||
flags[gas.id] = gas.flags
|
||||
if(gas.tile_overlay)
|
||||
tile_overlay[gas.id] = image('icons/effects/tile_effects.dmi', gas.tile_overlay, FLY_LAYER)
|
||||
if(gas.overlay_limit)
|
||||
overlay_limit[gas.id] = gas.overlay_limit
|
||||
|
||||
return 1
|
||||
@@ -45,6 +45,9 @@ Class Procs:
|
||||
var/list/edges = list()
|
||||
var/datum/gas_mixture/air = new
|
||||
|
||||
var/list/graphic_add = list()
|
||||
var/list/graphic_remove = list()
|
||||
|
||||
/zone/New()
|
||||
SSair.add_zone(src)
|
||||
air.temperature = TCMB
|
||||
@@ -62,7 +65,7 @@ Class Procs:
|
||||
air.merge(turf_air)
|
||||
T.zone = src
|
||||
contents.Add(T)
|
||||
T.set_graphic(air.graphics)
|
||||
T.update_graphic(air.graphic)
|
||||
|
||||
/zone/proc/remove(turf/simulated/T)
|
||||
#ifdef ZASDBG
|
||||
@@ -77,7 +80,7 @@ Class Procs:
|
||||
air.multiply(1 - turf_air.volume / air.volume)
|
||||
air.volume -= turf_air.volume
|
||||
contents.Remove(T)
|
||||
T.set_graphic(0)
|
||||
T.update_graphic(graphic_remove = air.graphic)
|
||||
if(!contents.len)
|
||||
c_invalidate()
|
||||
|
||||
@@ -90,6 +93,7 @@ Class Procs:
|
||||
#endif
|
||||
c_invalidate()
|
||||
for(var/turf/simulated/T in contents)
|
||||
T.update_graphic(graphic_remove = air.graphic)
|
||||
into.add(T)
|
||||
#ifdef ZASDBG
|
||||
T.dbg(merged)
|
||||
@@ -108,6 +112,7 @@ Class Procs:
|
||||
return //Short circuit for explosions where rebuild is called many times over.
|
||||
c_invalidate()
|
||||
for(var/turf/simulated/T in contents)
|
||||
T.update_graphic(graphic_remove = air.graphic) //we need to remove the overlays so they're not doubled when the zone is rebuilt
|
||||
//T.dbg(invalid_zone)
|
||||
T.needs_air_update = 0 //Reset the marker so that it will be added to the list.
|
||||
SSair.mark_for_update(T)
|
||||
@@ -128,9 +133,11 @@ Class Procs:
|
||||
Z.get_equalized_zone_air(found)
|
||||
|
||||
/zone/proc/tick()
|
||||
if(air.check_tile_graphic())
|
||||
if(air.check_tile_graphic(graphic_add, graphic_remove))
|
||||
for(var/turf/simulated/T in contents)
|
||||
T.set_graphic(air.graphics)
|
||||
T.update_graphic(graphic_add, graphic_remove)
|
||||
graphic_add.len = 0
|
||||
graphic_remove.len = 0
|
||||
|
||||
for(var/connection_edge/E in edges)
|
||||
if(E.sleeping)
|
||||
@@ -138,9 +145,9 @@ Class Procs:
|
||||
|
||||
/zone/proc/dbg_data(mob/M)
|
||||
to_chat(M, name)
|
||||
to_chat(M, "O2: [air.oxygen] N2: [air.nitrogen] CO2: [air.carbon_dioxide] P: [air.toxins]")
|
||||
to_chat(M, "P: [air.return_pressure()] kPa V: [air.volume]L T: [air.temperature]<5D>K ([air.temperature - T0C]<5D>C)")
|
||||
to_chat(M, "O2 per N2: [(air.nitrogen ? air.oxygen/air.nitrogen : "N/A")] Moles: [air.total_moles]")
|
||||
to_chat(M, "O2: [air[GAS_OXYGEN]] N2: [air[GAS_NITROGEN]] CO2: [air[GAS_CARBON]] P: [air[GAS_PLASMA]]")
|
||||
to_chat(M, "P: [air.pressure] kPa V: [air.volume]L T: [air.temperature]<5D>K ([air.temperature - T0C]<5D>C)")
|
||||
to_chat(M, "O2 per N2: [(air[GAS_NITROGEN] ? air[GAS_OXYGEN]/air[GAS_NITROGEN] : "N/A")] Moles: [air.total_moles]")
|
||||
to_chat(M, "Simulated: [contents.len] ([air.volume / CELL_VOLUME])")
|
||||
// to_chat(M, "Unsimulated: [unsimulated_contents.len]")
|
||||
// to_chat(M, "Edges: [edges.len]")
|
||||
|
||||
@@ -1,54 +1,15 @@
|
||||
#define SPECIFIC_HEAT_TOXIN 200
|
||||
#define SPECIFIC_HEAT_AIR 20
|
||||
#define SPECIFIC_HEAT_CDO 30
|
||||
#define HEAT_CAPACITY_CALCULATION(oxygen,carbon_dioxide,nitrogen,toxins) \
|
||||
max(0, carbon_dioxide * SPECIFIC_HEAT_CDO + (oxygen + nitrogen) * SPECIFIC_HEAT_AIR + toxins * SPECIFIC_HEAT_TOXIN)
|
||||
|
||||
#define MINIMUM_HEAT_CAPACITY 0.0003
|
||||
#define TRANSFER_FRACTION 5 //What fraction (1/#) of the air difference to try and transfer
|
||||
|
||||
// /vg/ SHIT
|
||||
#define TEMPERATURE_ICE_FORMATION 273.15 // 273 kelvin is the freezing point of water.
|
||||
#define MIN_PRESSURE_ICE_FORMATION 10 // 10kPa should be okay
|
||||
|
||||
#define GRAPHICS_PLASMA 1
|
||||
#define GRAPHICS_N2O 2
|
||||
#define GRAPHICS_REAGENTS 4 //Not used. Yet.
|
||||
#define GRAPHICS_COLD 8
|
||||
// END /vg/SHIT
|
||||
|
||||
/hook/startup/proc/createGasOverlays()
|
||||
plmaster = new /obj/effect/overlay()
|
||||
plmaster.icon = 'icons/effects/tile_effects.dmi'
|
||||
plmaster.icon_state = "plasma"
|
||||
plmaster.layer = FLY_LAYER
|
||||
plmaster.plane = EFFECTS_PLANE
|
||||
plmaster.mouse_opacity = 0
|
||||
|
||||
slmaster = new /obj/effect/overlay()
|
||||
slmaster.icon = 'icons/effects/tile_effects.dmi'
|
||||
slmaster.icon_state = "sleeping_agent"
|
||||
slmaster.layer = FLY_LAYER
|
||||
slmaster.plane = EFFECTS_PLANE
|
||||
slmaster.mouse_opacity = 0
|
||||
return 1
|
||||
|
||||
/datum/gas/sleeping_agent/specific_heat = 40 //These are used for the "Trace Gases" stuff, but is buggy.
|
||||
|
||||
/datum/gas/oxygen_agent_b/specific_heat = 300
|
||||
|
||||
/datum/gas/volatile_fuel/specific_heat = 30
|
||||
|
||||
/datum/gas
|
||||
var/moles = 0
|
||||
|
||||
var/specific_heat = 0
|
||||
|
||||
/datum/gas_mixture
|
||||
var/oxygen = 0 //Holds the "moles" of each of the four gases.
|
||||
var/carbon_dioxide = 0
|
||||
var/nitrogen = 0
|
||||
var/toxins = 0
|
||||
//Associative list of gas moles.
|
||||
//Gases with 0 moles are not tracked and are pruned by update_values()
|
||||
var/list/gas = list()
|
||||
|
||||
var/total_moles = 0 //Updated when a reaction occurs.
|
||||
|
||||
@@ -56,11 +17,10 @@
|
||||
|
||||
var/temperature = 0 //in Kelvin
|
||||
|
||||
var/graphics=0
|
||||
//List of active tile overlays for this gas_mixture. Updated by check_tile_graphic()
|
||||
var/list/graphic = list()
|
||||
|
||||
var/pressure=0
|
||||
|
||||
var/list/datum/gas/trace_gases = list() //Seemed to be a good idea that was abandoned
|
||||
var/pressure = 0
|
||||
|
||||
var/tmp/fuel_burnt = 0
|
||||
|
||||
@@ -70,45 +30,22 @@
|
||||
volume = to_copy.volume
|
||||
copy_from(to_copy)
|
||||
|
||||
//Turns out that most of the time, people only want to adjust a single gas at a time, and using a proc set up like this just encourages bad behavior.
|
||||
//To be purged along with the trace gas system later.
|
||||
/datum/gas_mixture/proc/adjust(o2 = 0, co2 = 0, n2 = 0, tx = 0, list/datum/gas/traces = list())
|
||||
//Purpose: Adjusting the gases within a airmix
|
||||
//Called by: Fucking everything!
|
||||
//Inputs: The values of the gases to adjust
|
||||
//Outputs: null
|
||||
|
||||
oxygen = max(0, oxygen + o2)
|
||||
carbon_dioxide = max(0, carbon_dioxide + co2)
|
||||
nitrogen = max(0, nitrogen + n2)
|
||||
toxins = max(0, toxins + tx)
|
||||
//Since gases not present in the mix are culled from the list, we use this to make sure a number is returned for any valid gas.
|
||||
/datum/gas_mixture/proc/operator[](idx)
|
||||
return gas[idx] || (XGM.gases[idx] ? 0 : null)
|
||||
|
||||
//handle trace gasses
|
||||
for(var/datum/gas/G in traces)
|
||||
var/datum/gas/T = locate(G.type) in trace_gases
|
||||
if(T)
|
||||
T.moles = max(G.moles + T.moles, 0)
|
||||
else if(G.moles > 0)
|
||||
trace_gases |= G
|
||||
update_values()
|
||||
return
|
||||
//This just allows the [] operator to be used for writes as well as reads. The above proc means this WILL work with +=, etc., for any valid gas.
|
||||
/datum/gas_mixture/proc/operator[]=(idx, val)
|
||||
gas[idx] = val
|
||||
|
||||
|
||||
//Takes a gas string, and the number of moles to adjust by. Calls update_values() if update isn't 0.
|
||||
/datum/gas_mixture/proc/adjust_gas(gasid, moles, update = TRUE)
|
||||
if(!moles)
|
||||
return
|
||||
switch(gasid)
|
||||
if("oxygen")
|
||||
oxygen += moles
|
||||
if("plasma")
|
||||
toxins += moles
|
||||
if("carbon_dioxide")
|
||||
carbon_dioxide += moles
|
||||
if("nitrogen")
|
||||
nitrogen += moles
|
||||
else
|
||||
CRASH("Invalid gasid!")
|
||||
|
||||
src[gasid] += moles
|
||||
|
||||
if(update)
|
||||
update_values()
|
||||
@@ -118,19 +55,9 @@
|
||||
/datum/gas_mixture/proc/adjust_gas_temp(gasid, moles, temp, update = TRUE)
|
||||
if(moles > 0 && abs(temperature - temp) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
||||
var/self_heat_capacity = heat_capacity()
|
||||
|
||||
var/giver_heat_capacity = moles
|
||||
switch(gasid)
|
||||
if("oxygen", "nitrogen")
|
||||
giver_heat_capacity *= SPECIFIC_HEAT_AIR
|
||||
if("plasma")
|
||||
giver_heat_capacity *= SPECIFIC_HEAT_TOXIN
|
||||
if("carbon_dioxide")
|
||||
giver_heat_capacity *= SPECIFIC_HEAT_CDO
|
||||
else
|
||||
CRASH("Invalid gasid!")
|
||||
|
||||
var/giver_heat_capacity = XGM.specific_heat[gasid] * moles
|
||||
var/combined_heat_capacity = giver_heat_capacity + self_heat_capacity
|
||||
|
||||
temperature = (temp * giver_heat_capacity + temperature * self_heat_capacity) / combined_heat_capacity
|
||||
|
||||
adjust_gas(gasid, moles, update)
|
||||
@@ -147,7 +74,8 @@
|
||||
|
||||
|
||||
//Variadic version of adjust_gas_temp(). Takes any number of gas, mole and temperature associations and applies them.
|
||||
//This proc is evil. Temperature will not behave how you expect it to. You have been warned.
|
||||
//This proc is evil. Temperature will not behave how you expect it to unless this mixture starts off empty.
|
||||
//Honestly, just make a new gas_mixture and merge it into this one instead.
|
||||
/datum/gas_mixture/proc/adjust_multi_temp()
|
||||
ASSERT(!(args.len % 3))
|
||||
|
||||
@@ -159,27 +87,18 @@
|
||||
|
||||
//Merges all the gas from another mixture into this one. Adjusts temperature correctly.
|
||||
//Does not modify giver in any way.
|
||||
/datum/gas_mixture/proc/merge(datum/gas_mixture/giver)
|
||||
/datum/gas_mixture/proc/merge(datum/gas_mixture/giver, update = TRUE)
|
||||
if(!giver)
|
||||
return 0
|
||||
|
||||
var/self_heat_capacity = heat_capacity()
|
||||
var/giver_heat_capacity = giver.heat_capacity()
|
||||
|
||||
temperature = (temperature * self_heat_capacity + giver.temperature * giver_heat_capacity) / (self_heat_capacity + giver_heat_capacity)
|
||||
adjust_multi(\
|
||||
"oxygen", giver.oxygen,\
|
||||
"nitrogen", giver.nitrogen,\
|
||||
"plasma", giver.toxins,\
|
||||
"carbon_dioxide", giver.carbon_dioxide)
|
||||
|
||||
if(giver.trace_gases.len) //This really should use adjust(), but I think it would break things, and I don't care enough to fix a system I'm removing soon anyway.
|
||||
for(var/datum/gas/trace_gas in giver.trace_gases)
|
||||
var/datum/gas/corresponding = locate(trace_gas.type) in trace_gases
|
||||
if(!corresponding)
|
||||
corresponding = new trace_gas.type()
|
||||
trace_gases += corresponding
|
||||
corresponding.moles += trace_gas.moles
|
||||
for(var/g in giver.gas)
|
||||
adjust_gas(g, giver.gas[g], FALSE)
|
||||
|
||||
if(update)
|
||||
update_values()
|
||||
|
||||
return 1
|
||||
@@ -206,46 +125,44 @@
|
||||
return temperature * heat_capacity()
|
||||
|
||||
|
||||
/datum/gas_mixture/proc/molar_density(gas) //Per liter. You should probably be using pressure instead, but considering this had to be made, you wouldn't be the first not to.
|
||||
return (gas ? vars[gas] : total_moles) / volume //Should verify if gas is actually a valid gas, but this shouldn't be in use for long anyway.
|
||||
/datum/gas_mixture/proc/molar_density(g) //Per liter. You should probably be using pressure instead, but considering this had to be made, you wouldn't be the first not to.
|
||||
return (g ? src[g] : total_moles) / volume
|
||||
|
||||
|
||||
/datum/gas_mixture/proc/partial_pressure(g)
|
||||
return src[g] / total_moles * pressure
|
||||
|
||||
///////////////////////////////
|
||||
//PV=nRT - related procedures//
|
||||
///////////////////////////////
|
||||
|
||||
/datum/gas_mixture/proc/heat_capacity()
|
||||
//Purpose: Returning the heat capacity of the gas mix
|
||||
//Called by: UNKNOWN
|
||||
//Inputs: None
|
||||
//Outputs: Heat capacity
|
||||
var/heat_capacity = 0
|
||||
|
||||
var/heat_capacity = HEAT_CAPACITY_CALCULATION(oxygen,carbon_dioxide,nitrogen,toxins)
|
||||
for(var/g in gas)
|
||||
heat_capacity += XGM.specific_heat[g] * gas[g]
|
||||
|
||||
if(trace_gases && trace_gases.len) //sanity check because somehow the tracegases gets nulled?
|
||||
for(var/datum/gas/trace_gas in trace_gases)
|
||||
heat_capacity += trace_gas.moles*trace_gas.specific_heat
|
||||
|
||||
return max(MINIMUM_HEAT_CAPACITY,heat_capacity)
|
||||
return max(MINIMUM_HEAT_CAPACITY, heat_capacity)
|
||||
|
||||
|
||||
//Adds or removes thermal energy. Returns the actual thermal energy change, as in the case of removing energy we can't go below TCMB.
|
||||
/datum/gas_mixture/proc/add_thermal_energy(var/thermal_energy)
|
||||
if (total_moles == 0)
|
||||
if(total_moles == 0)
|
||||
return 0
|
||||
|
||||
var/heat_capacity = heat_capacity()
|
||||
if (thermal_energy < 0)
|
||||
if (temperature < TCMB)
|
||||
if(thermal_energy < 0)
|
||||
if(temperature < TCMB)
|
||||
return 0
|
||||
var/thermal_energy_limit = -(temperature - TCMB)*heat_capacity //ensure temperature does not go below TCMB
|
||||
thermal_energy = max( thermal_energy, thermal_energy_limit ) //thermal_energy and thermal_energy_limit are negative here.
|
||||
var/thermal_energy_limit = -(temperature - TCMB) * heat_capacity //ensure temperature does not go below TCMB
|
||||
thermal_energy = max(thermal_energy, thermal_energy_limit) //thermal_energy and thermal_energy_limit are negative here.
|
||||
temperature += thermal_energy/heat_capacity
|
||||
return thermal_energy
|
||||
|
||||
|
||||
//Returns the thermal energy change required to get to a new temperature
|
||||
/datum/gas_mixture/proc/get_thermal_energy_change(var/new_temperature)
|
||||
return heat_capacity()*(max(new_temperature, 0) - temperature)
|
||||
return heat_capacity() * (max(new_temperature, 0) - temperature)
|
||||
|
||||
|
||||
//The below wasn't even implemented yet in the big XGM PR. Just saving it here for later.
|
||||
@@ -274,138 +191,84 @@
|
||||
// which is bit more realistic (natural log), and returns a fairly accurate entropy around room temperatures and pressures.
|
||||
//*/
|
||||
///datum/gas_mixture/proc/specific_entropy_gas(var/gasid)
|
||||
// if (!(gasid in gas) || gas[gasid] == 0)
|
||||
// if (src[gasid] == 0)
|
||||
// return SPECIFIC_ENTROPY_VACUUM //that gas isn't here
|
||||
//
|
||||
// //V/(m*T) = R/(partial pressure)
|
||||
// var/molar_mass = XGM.molar_mass[gasid]
|
||||
// var/specific_heat = XGM.specific_heat[gasid]
|
||||
// return R_IDEAL_GAS_EQUATION * ( log( (IDEAL_GAS_ENTROPY_CONSTANT*volume/(gas[gasid] * temperature)) * (molar_mass*specific_heat*temperature)**(2/3) + 1 ) + 15 )
|
||||
// return R_IDEAL_GAS_EQUATION * ( log( (IDEAL_GAS_ENTROPY_CONSTANT*volume/(src[gasid] * temperature)) * (molar_mass*specific_heat*temperature)**(2/3) + 1 ) + 15 )
|
||||
//
|
||||
// //alternative, simpler equation
|
||||
// //var/partial_pressure = gas[gasid] * R_IDEAL_GAS_EQUATION * temperature / volume
|
||||
// //var/partial_pressure = src[gasid] * R_IDEAL_GAS_EQUATION * temperature / volume
|
||||
// //return R_IDEAL_GAS_EQUATION * ( log (1 + IDEAL_GAS_ENTROPY_CONSTANT/partial_pressure) + 20 )
|
||||
|
||||
|
||||
//Updates the calculated vars (total_moles, pressure, etc.) (actually currently only those two), and culls empty gases from the mix.
|
||||
//Called by default by all methods that alter a gas_mixture, and should be called if you manually alter it.
|
||||
/datum/gas_mixture/proc/update_values()
|
||||
//Purpose: Calculating and storing values which were normally called CONSTANTLY
|
||||
//Called by: Anything that changes values within a gas mix.
|
||||
//Inputs: None
|
||||
//Outputs: None
|
||||
total_moles = 0
|
||||
for(var/g in gas)
|
||||
var/moles = gas[g]
|
||||
if(moles)
|
||||
total_moles += gas[g]
|
||||
else
|
||||
gas -= g
|
||||
|
||||
total_moles = oxygen + carbon_dioxide + nitrogen + toxins
|
||||
|
||||
if(trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in trace_gases)
|
||||
total_moles += trace_gas.moles
|
||||
|
||||
if(volume>0)
|
||||
pressure = total_moles()*R_IDEAL_GAS_EQUATION*temperature/volume
|
||||
if(volume > 0)
|
||||
pressure = total_moles * R_IDEAL_GAS_EQUATION * temperature / volume
|
||||
else
|
||||
pressure = 0
|
||||
|
||||
return
|
||||
|
||||
|
||||
/datum/gas_mixture/proc/total_moles()
|
||||
return total_moles
|
||||
|
||||
|
||||
/datum/gas_mixture/proc/return_pressure()
|
||||
//Purpose: Calculating Current Pressure
|
||||
//Called by:
|
||||
//Inputs: None
|
||||
//Outputs: Gas pressure.
|
||||
return pressure
|
||||
|
||||
|
||||
/datum/gas_mixture/proc/remove(amount)
|
||||
//Purpose: Removes a certain number of moles from the air.
|
||||
//Called by: ?
|
||||
//Inputs: How many moles to remove.
|
||||
//Outputs: Removed air.
|
||||
|
||||
var/sum = total_moles()
|
||||
amount = min(amount,sum) //Can not take more air than tile has!
|
||||
if(amount <= 0)
|
||||
return null
|
||||
|
||||
var/datum/gas_mixture/removed = new
|
||||
//Removes the given number of moles from src, and returns a new gas_mixture containing the removed gas.
|
||||
/datum/gas_mixture/proc/remove(moles, update = TRUE, update_removed = TRUE)
|
||||
var/sum = total_moles
|
||||
if(!sum)
|
||||
return
|
||||
moles = min(moles, sum) //Cannot take more air than tile has!
|
||||
return remove_ratio(moles / sum, update, update_removed)
|
||||
|
||||
|
||||
removed.oxygen = QUANTIZE((oxygen/sum)*amount)
|
||||
removed.nitrogen = QUANTIZE((nitrogen/sum)*amount)
|
||||
removed.carbon_dioxide = QUANTIZE((carbon_dioxide/sum)*amount)
|
||||
removed.toxins = QUANTIZE((toxins/sum)*amount)
|
||||
|
||||
oxygen -= removed.oxygen
|
||||
nitrogen -= removed.nitrogen
|
||||
carbon_dioxide -= removed.carbon_dioxide
|
||||
toxins -= removed.toxins
|
||||
|
||||
if(trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in trace_gases)
|
||||
var/datum/gas/corresponding = new trace_gas.type()
|
||||
removed.trace_gases += corresponding
|
||||
|
||||
corresponding.moles = (trace_gas.moles/sum)*amount
|
||||
trace_gas.moles -= corresponding.moles
|
||||
/*
|
||||
if(aerosols.total_volume > 1)
|
||||
removed.aerosols.trans_to_atmos(src,(aerosols.total_volume/sum)*amount)
|
||||
*/
|
||||
|
||||
removed.temperature = temperature
|
||||
update_values()
|
||||
removed.update_values()
|
||||
|
||||
return removed
|
||||
|
||||
|
||||
/datum/gas_mixture/proc/remove_ratio(ratio)
|
||||
//Purpose: Removes a certain ratio of the air.
|
||||
//Called by: ?
|
||||
//Inputs: Percentage to remove.
|
||||
//Outputs: Removed air.
|
||||
|
||||
//Removes the given proportion of the gas in src, and returns a new gas_mixture containing the removed gas.
|
||||
/datum/gas_mixture/proc/remove_ratio(ratio, update = TRUE, update_removed = TRUE)
|
||||
if(ratio <= 0 || total_moles <= 0)
|
||||
return null
|
||||
return
|
||||
|
||||
ratio = min(ratio, 1)
|
||||
|
||||
var/datum/gas_mixture/removed = new
|
||||
var/datum/gas_mixture/removed = new()
|
||||
|
||||
removed.oxygen = QUANTIZE(oxygen*ratio)
|
||||
removed.nitrogen = QUANTIZE(nitrogen*ratio)
|
||||
removed.carbon_dioxide = QUANTIZE(carbon_dioxide*ratio)
|
||||
removed.toxins = QUANTIZE(toxins*ratio)
|
||||
|
||||
oxygen -= removed.oxygen
|
||||
nitrogen -= removed.nitrogen
|
||||
carbon_dioxide -= removed.carbon_dioxide
|
||||
toxins -= removed.toxins
|
||||
|
||||
if(trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in trace_gases)
|
||||
var/datum/gas/corresponding = new trace_gas.type()
|
||||
removed.trace_gases += corresponding
|
||||
|
||||
corresponding.moles = trace_gas.moles*ratio
|
||||
trace_gas.moles -= corresponding.moles
|
||||
for(var/g in gas)
|
||||
var/moles = gas[g] * ratio
|
||||
gas[g] -= moles
|
||||
removed[g] += moles
|
||||
|
||||
removed.temperature = temperature
|
||||
update_values()
|
||||
removed.update_values()
|
||||
|
||||
if(update)
|
||||
update_values()
|
||||
if(update_removed)
|
||||
removed.update_values()
|
||||
|
||||
return removed
|
||||
|
||||
|
||||
//Removes a volume of gas from the mixture and returns a gas_mixture containing the removed air with the given volume.
|
||||
/datum/gas_mixture/proc/remove_volume(removed_volume)
|
||||
var/datum/gas_mixture/removed = remove_ratio(removed_volume/volume)
|
||||
//Removes the given volume of gas from src, and returns a new gas_mixture containing the removed gas, with the given volume.
|
||||
/datum/gas_mixture/proc/remove_volume(removed_volume, update = TRUE, update_removed = TRUE)
|
||||
var/datum/gas_mixture/removed = remove_ratio(removed_volume / volume, update, FALSE)
|
||||
if(removed)
|
||||
removed.volume = removed_volume
|
||||
removed.update_values()
|
||||
if(update_removed)
|
||||
removed.update_values()
|
||||
return removed
|
||||
|
||||
|
||||
@@ -413,37 +276,31 @@
|
||||
//Procedures used for very specific events//
|
||||
////////////////////////////////////////////
|
||||
|
||||
/datum/gas_mixture/proc/check_tile_graphic()
|
||||
//Purpose: Calculating the graphic for a tile
|
||||
//Called by: Turfs updating
|
||||
//Inputs: None
|
||||
//Outputs: 1 if graphic changed, 0 if unchanged
|
||||
//Rechecks the gas_mixture and adjusts the graphic list if needed.
|
||||
//Two lists can be passed by reference if you need know specifically which graphics were added and removed.
|
||||
/datum/gas_mixture/proc/check_tile_graphic(list/graphic_add = null, list/graphic_remove = null)
|
||||
for(var/g in XGM.overlay_limit)
|
||||
if(graphic.Find(XGM.tile_overlay[g]))
|
||||
//Overlay is already applied for this gas, check if it's still valid.
|
||||
if(molar_density(g) <= XGM.overlay_limit[g])
|
||||
if(!graphic_remove)
|
||||
graphic_remove = list()
|
||||
graphic_remove += XGM.tile_overlay[g]
|
||||
else
|
||||
//Overlay isn't applied for this gas, check if it's valid and needs to be added.
|
||||
if(molar_density(g) > XGM.overlay_limit[g])
|
||||
if(!graphic_add)
|
||||
graphic_add = list()
|
||||
graphic_add += XGM.tile_overlay[g]
|
||||
|
||||
var/old_graphics = graphics
|
||||
|
||||
graphics = 0
|
||||
|
||||
// If configured and cold, maek ice
|
||||
if(zas_settings.Get(/datum/ZAS_Setting/ice_formation))
|
||||
if(temperature <= TEMPERATURE_ICE_FORMATION && return_pressure()>MIN_PRESSURE_ICE_FORMATION)
|
||||
// If we're just forming, do a probability check. Otherwise, KEEP IT ON~
|
||||
// This ordering will hopefully keep it from sampling random noise every damn tick.
|
||||
//if(was_icy || (!was_icy && prob(25)))
|
||||
graphics |= GRAPHICS_COLD
|
||||
|
||||
if((toxins / volume * CELL_VOLUME) > MOLES_PLASMA_VISIBLE)
|
||||
graphics |= GRAPHICS_PLASMA
|
||||
|
||||
if(length(trace_gases))
|
||||
var/datum/gas/sleeping_agent = locate(/datum/gas/sleeping_agent) in trace_gases
|
||||
if(sleeping_agent && ((sleeping_agent.moles / volume * CELL_VOLUME) > 1))
|
||||
graphics |= GRAPHICS_N2O
|
||||
/*
|
||||
if(aerosols && aerosols.total_volume >= 1)
|
||||
graphics |= GRAPHICS_REAGENTS
|
||||
*/
|
||||
|
||||
return graphics != old_graphics
|
||||
. = 0
|
||||
//Apply changes
|
||||
if(graphic_add && graphic_add.len)
|
||||
graphic += graphic_add
|
||||
. = 1
|
||||
if(graphic_remove && graphic_remove.len)
|
||||
graphic -= graphic_remove
|
||||
. = 1
|
||||
|
||||
/datum/gas_mixture/proc/react(atom/dump_location)
|
||||
//Purpose: Calculating if it is possible for a fire to occur in the airmix
|
||||
@@ -461,27 +318,14 @@
|
||||
//////////////////////////////////////////////
|
||||
|
||||
|
||||
//Copies the gases from sample to src, per unit volume.
|
||||
/datum/gas_mixture/proc/copy_from(datum/gas_mixture/sample)
|
||||
//Purpose: Copies the per unit volume properties of sample.
|
||||
//Called by: airgroups splitting, ?
|
||||
//Inputs: Gas to copy
|
||||
//Outputs: 1
|
||||
|
||||
oxygen = sample.oxygen
|
||||
carbon_dioxide = sample.carbon_dioxide
|
||||
nitrogen = sample.nitrogen
|
||||
toxins = sample.toxins
|
||||
gas.len = 0
|
||||
for(var/g in sample.gas)
|
||||
src[g] = sample.gas[g]
|
||||
|
||||
temperature = sample.temperature
|
||||
|
||||
trace_gases.len = 0
|
||||
if(sample.trace_gases.len > 0)
|
||||
for(var/datum/gas/trace_gas in sample.trace_gases)
|
||||
var/datum/gas/corresponding = new trace_gas.type()
|
||||
trace_gases += corresponding
|
||||
|
||||
corresponding.moles = trace_gas.moles
|
||||
|
||||
multiply(volume / sample.volume)
|
||||
return 1
|
||||
|
||||
@@ -493,122 +337,63 @@
|
||||
//The above except for gases specifically.
|
||||
#define FAIL_AIR_SIMILARITY_CHECK(ownvar, samplevar) (FAIL_SIMILARITY_CHECK((ownvar), (samplevar), MINIMUM_AIR_TO_SUSPEND, MINIMUM_AIR_RATIO_TO_SUSPEND))
|
||||
|
||||
//Compares src's gas to sample's gas, per unit volume.
|
||||
//Returns TRUE if they are close enough to equal to equalize or merge (in the case of zones), FALSE otherwise.
|
||||
/datum/gas_mixture/proc/compare(datum/gas_mixture/sample)
|
||||
//Purpose: Compares sample to self to see if within acceptable ranges that group processing may be enabled
|
||||
//Called by: Airgroups trying to rebuild
|
||||
//Inputs: Gas mix to compare
|
||||
//Outputs: 1 if can rebuild, 0 if not.
|
||||
if(!istype(sample))
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
if(FAIL_SIMILARITY_CHECK(temperature, sample.temperature, MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND, MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND))
|
||||
return 0
|
||||
return FALSE
|
||||
if(FAIL_SIMILARITY_CHECK(pressure, sample.pressure, MINIMUM_PRESSURE_DELTA_TO_SUSPEND, MINIMUM_PRESSURE_RATIO_TO_SUSPEND))
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
var/volume_ratio = volume / sample.volume //We want to compare the number of moles per unit volume, not total.
|
||||
for(var/g in gas | sample.gas)
|
||||
if(FAIL_AIR_SIMILARITY_CHECK(molar_density(g), sample.molar_density(g)))
|
||||
return FALSE
|
||||
|
||||
if(FAIL_AIR_SIMILARITY_CHECK(oxygen, sample.oxygen * volume_ratio))
|
||||
return 0
|
||||
if(FAIL_AIR_SIMILARITY_CHECK(nitrogen, sample.nitrogen * volume_ratio))
|
||||
return 0
|
||||
if(FAIL_AIR_SIMILARITY_CHECK(carbon_dioxide, sample.carbon_dioxide * volume_ratio))
|
||||
return 0
|
||||
if(FAIL_AIR_SIMILARITY_CHECK(toxins, sample.toxins * volume_ratio))
|
||||
return 0
|
||||
|
||||
var/check_moles
|
||||
if(sample.trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in sample.trace_gases)
|
||||
var/datum/gas/corresponding = locate(trace_gas.type) in trace_gases
|
||||
if(corresponding)
|
||||
check_moles = corresponding.moles / volume_ratio
|
||||
else
|
||||
check_moles = 0
|
||||
|
||||
if(FAIL_AIR_SIMILARITY_CHECK(check_moles, trace_gas.moles))
|
||||
return 0
|
||||
|
||||
if(trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in trace_gases)
|
||||
var/datum/gas/corresponding = locate(trace_gas.type) in sample.trace_gases
|
||||
if(corresponding)
|
||||
check_moles = corresponding.moles * volume_ratio
|
||||
else
|
||||
check_moles = 0
|
||||
|
||||
if(FAIL_AIR_SIMILARITY_CHECK(trace_gas.moles, check_moles))
|
||||
return 0
|
||||
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
#undef FAIL_AIR_SIMILARITY_CHECK
|
||||
#undef FAIL_SIMILARITY_CHECK
|
||||
|
||||
/datum/gas_mixture/proc/add(datum/gas_mixture/right_side)
|
||||
if(!right_side)
|
||||
return 0
|
||||
oxygen += right_side.oxygen
|
||||
carbon_dioxide += right_side.carbon_dioxide
|
||||
nitrogen += right_side.nitrogen
|
||||
toxins += right_side.toxins
|
||||
|
||||
if(trace_gases.len || right_side.trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in right_side.trace_gases)
|
||||
var/datum/gas/corresponding = locate(trace_gas.type) in trace_gases
|
||||
if(!corresponding)
|
||||
corresponding = new trace_gas.type()
|
||||
trace_gases += corresponding
|
||||
corresponding.moles += trace_gas.moles
|
||||
/datum/gas_mixture/proc/add(datum/gas_mixture/right_side)
|
||||
if(!istype(right_side))
|
||||
return FALSE
|
||||
|
||||
for(var/g in right_side.gas)
|
||||
src[g] += right_side.gas[g]
|
||||
|
||||
update_values()
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
|
||||
/datum/gas_mixture/proc/subtract(datum/gas_mixture/right_side)
|
||||
//Purpose: Subtracts right_side from air_mixture. Used to help turfs mingle
|
||||
//Called by: Pipelines ending in a break (or something)
|
||||
//Inputs: Gas mix to remove
|
||||
//Outputs: 1
|
||||
if(!istype(right_side))
|
||||
return FALSE
|
||||
|
||||
oxygen = max(0, oxygen - right_side.oxygen)
|
||||
carbon_dioxide = max(0, carbon_dioxide - right_side.carbon_dioxide)
|
||||
nitrogen = max(0, nitrogen - right_side.nitrogen)
|
||||
toxins = max(0, toxins - right_side.toxins)
|
||||
|
||||
if(trace_gases.len || right_side.trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in right_side.trace_gases)
|
||||
var/datum/gas/corresponding = locate(trace_gas.type) in trace_gases
|
||||
if(corresponding)
|
||||
corresponding.moles = max(0, corresponding.moles - trace_gas.moles)
|
||||
for(var/g in right_side.gas)
|
||||
src[g] -= right_side.gas[g]
|
||||
|
||||
update_values()
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
|
||||
/datum/gas_mixture/proc/multiply(factor)
|
||||
oxygen *= factor
|
||||
carbon_dioxide *= factor
|
||||
nitrogen *= factor
|
||||
toxins *= factor
|
||||
|
||||
if(trace_gases && trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in trace_gases)
|
||||
trace_gas.moles *= factor
|
||||
for(var/g in gas)
|
||||
gas[g] *= factor
|
||||
|
||||
update_values()
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
|
||||
/datum/gas_mixture/proc/divide(factor)
|
||||
oxygen /= factor
|
||||
carbon_dioxide /= factor
|
||||
nitrogen /= factor
|
||||
toxins /= factor
|
||||
|
||||
if(trace_gases && trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in trace_gases)
|
||||
trace_gas.moles /= factor
|
||||
for(var/g in gas)
|
||||
gas[g] /= factor
|
||||
|
||||
update_values()
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
|
||||
//Mixes the given ratio of the two gas_mixtures.
|
||||
@@ -632,6 +417,7 @@ var/static/list/sharing_lookup_table = list(0.30, 0.40, 0.48, 0.54, 0.60, 0.66)
|
||||
share_ratio(other, ratio)
|
||||
return compare(other)
|
||||
|
||||
|
||||
/datum/gas_mixture/proc/share_space(datum/gas_mixture/unsim_air, connecting_tiles)
|
||||
var/datum/gas_mixture/sharer = new() //Make a new gas_mixture to copy unsim_air into so it doesn't get changed.
|
||||
sharer.volume = unsim_air.volume + volume + 3 * CELL_VOLUME //Then increase the copy's volume so larger rooms don't drain slowly as fuck.
|
||||
@@ -639,28 +425,22 @@ var/static/list/sharing_lookup_table = list(0.30, 0.40, 0.48, 0.54, 0.60, 0.66)
|
||||
sharer.copy_from(unsim_air) //Finally, perform the actual copy
|
||||
return share_tiles(sharer, connecting_tiles)
|
||||
|
||||
|
||||
/datum/gas_mixture/proc/english_contents_list()
|
||||
var/all_contents = list()
|
||||
if(oxygen)
|
||||
all_contents += "Oxygen"
|
||||
if(nitrogen)
|
||||
all_contents += "Nitrogen"
|
||||
if(carbon_dioxide)
|
||||
all_contents += "CO<sub>2</sub>"
|
||||
if(toxins)
|
||||
all_contents += "Plasma"
|
||||
if(locate(/datum/gas/sleeping_agent) in trace_gases)
|
||||
all_contents += "N<sub>2</sub>O"
|
||||
var/list/all_contents = list()
|
||||
|
||||
for(var/g in gas)
|
||||
all_contents += XGM.name[g]
|
||||
|
||||
return english_list(all_contents)
|
||||
|
||||
|
||||
/datum/gas_mixture/proc/loggable_contents()
|
||||
var/naughty_stuff = list()
|
||||
if(toxins)
|
||||
naughty_stuff += "<b><font color='red'>Plasma</font></b>"
|
||||
if(carbon_dioxide)
|
||||
naughty_stuff += "<b><font color='red'>CO<sub>2</sub></font></b>"
|
||||
if(locate(/datum/gas/sleeping_agent) in trace_gases)
|
||||
naughty_stuff += "<b><font color='red'>N<sub>2</sub>O</font>"
|
||||
|
||||
for(var/g in gas)
|
||||
if(XGM.flags[g] & XGM_GAS_LOGGED)
|
||||
naughty_stuff += "<span class='bold red'>[XGM.short_name[g]]</span>"
|
||||
return english_list(naughty_stuff, nothing_text = "")
|
||||
|
||||
|
||||
@@ -668,10 +448,6 @@ var/static/list/sharing_lookup_table = list(0.30, 0.40, 0.48, 0.54, 0.60, 0.66)
|
||||
//Unsimulated gas_mixture
|
||||
//Acts like a gas_mixture, except none of the procs actually change it.
|
||||
|
||||
/datum/gas_mixture/unsimulated/adjust(o2 = 0, co2 = 0, n2 = 0, tx = 0, list/datum/gas/traces)
|
||||
return
|
||||
|
||||
|
||||
/datum/gas_mixture/unsimulated/adjust_gas(gasid, moles, update = TRUE)
|
||||
return
|
||||
|
||||
@@ -704,52 +480,21 @@ var/static/list/sharing_lookup_table = list(0.30, 0.40, 0.48, 0.54, 0.60, 0.66)
|
||||
return 0 //Real answer would be infinity, but that would be virtually guaranteed to cause problems.
|
||||
|
||||
|
||||
/datum/gas_mixture/unsimulated/remove(amount)
|
||||
var/sum = total_moles()
|
||||
amount = min(amount, sum) //Can not take more air than tile has!
|
||||
if(amount <= 0)
|
||||
return null
|
||||
|
||||
var/datum/gas_mixture/removed = new
|
||||
|
||||
removed.oxygen = QUANTIZE((oxygen / sum) * amount)
|
||||
removed.nitrogen = QUANTIZE((nitrogen / sum) * amount)
|
||||
removed.carbon_dioxide = QUANTIZE((carbon_dioxide / sum) * amount)
|
||||
removed.toxins = QUANTIZE((toxins / sum) * amount)
|
||||
|
||||
if(trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in trace_gases)
|
||||
var/datum/gas/corresponding = new trace_gas.type()
|
||||
removed.trace_gases += corresponding
|
||||
corresponding.moles = (trace_gas.moles / sum) * amount
|
||||
|
||||
removed.temperature = temperature
|
||||
removed.update_values()
|
||||
|
||||
return removed
|
||||
|
||||
|
||||
/datum/gas_mixture/unsimulated/remove_ratio(ratio)
|
||||
/datum/gas_mixture/unsimulated/remove_ratio(ratio, update, update_removed = TRUE)
|
||||
if(ratio <= 0 || total_moles <= 0)
|
||||
return null
|
||||
|
||||
ratio = min(ratio, 1)
|
||||
|
||||
var/datum/gas_mixture/removed = new
|
||||
var/datum/gas_mixture/removed = new()
|
||||
|
||||
removed.oxygen = QUANTIZE(oxygen * ratio)
|
||||
removed.nitrogen = QUANTIZE(nitrogen * ratio)
|
||||
removed.carbon_dioxide = QUANTIZE(carbon_dioxide * ratio)
|
||||
removed.toxins = QUANTIZE(toxins * ratio)
|
||||
|
||||
if(trace_gases.len)
|
||||
for(var/datum/gas/trace_gas in trace_gases)
|
||||
var/datum/gas/corresponding = new trace_gas.type()
|
||||
removed.trace_gases += corresponding
|
||||
corresponding.moles = trace_gas.moles * ratio
|
||||
for(var/g in gas)
|
||||
removed[g] += gas[g] * ratio
|
||||
|
||||
removed.temperature = temperature
|
||||
removed.update_values()
|
||||
|
||||
if(update_removed)
|
||||
removed.update_values()
|
||||
|
||||
return removed
|
||||
|
||||
|
||||
@@ -252,8 +252,8 @@
|
||||
max=28
|
||||
protected_jobs = list("Research Director", "Scientist")
|
||||
|
||||
/datum/theft_objective/number/traitor/plasma_gas/getAmountStolen(var/obj/item/I)
|
||||
return I:air_contents:toxins
|
||||
/datum/theft_objective/number/traitor/plasma_gas/getAmountStolen(var/obj/item/weapon/tank/I)
|
||||
return I.air_contents[GAS_PLASMA]
|
||||
|
||||
/datum/theft_objective/number/traitor/coins
|
||||
name = "credits of coins (in bag)"
|
||||
|
||||
@@ -31,6 +31,9 @@
|
||||
#define MAX_TEMPERATURE 90
|
||||
#define MIN_TEMPERATURE -40
|
||||
|
||||
//All gases that do not fall under "other"
|
||||
#define CHECKED_GAS GAS_OXYGEN, GAS_NITROGEN, GAS_CARBON, GAS_PLASMA, GAS_SLEEPING
|
||||
|
||||
//all air alarms in area are connected via magic
|
||||
/area
|
||||
var/obj/machinery/alarm/master_air_alarm
|
||||
@@ -278,24 +281,23 @@
|
||||
if (isnull(environment))
|
||||
return 0
|
||||
|
||||
var/partial_pressure = R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume
|
||||
var/environment_pressure = environment.return_pressure()
|
||||
var/n2o_moles = 0.0
|
||||
var/other_moles = 0.0
|
||||
for(var/datum/gas/G in environment.trace_gases)
|
||||
if(istype(G, /datum/gas/sleeping_agent))
|
||||
n2o_moles+=G.moles
|
||||
else
|
||||
other_moles+=G.moles
|
||||
var/other_moles
|
||||
for(var/g in environment.gas)
|
||||
switch(g)
|
||||
if(CHECKED_GAS)
|
||||
//Do nothing
|
||||
else
|
||||
other_moles += environment[g]
|
||||
|
||||
var/pressure_dangerlevel = get_danger_level(environment_pressure, TLV["pressure"])
|
||||
var/oxygen_dangerlevel = get_danger_level(environment.oxygen*partial_pressure, TLV["oxygen"])
|
||||
var/nitrogen_dangerlevel = get_danger_level(environment.nitrogen*partial_pressure, TLV["nitrogen"])
|
||||
var/co2_dangerlevel = get_danger_level(environment.carbon_dioxide*partial_pressure, TLV["carbon_dioxide"])
|
||||
var/plasma_dangerlevel = get_danger_level(environment.toxins*partial_pressure, TLV["plasma"])
|
||||
|
||||
var/pressure_dangerlevel = get_danger_level(environment.pressure, TLV["pressure"])
|
||||
var/oxygen_dangerlevel = get_danger_level(environment.partial_pressure(GAS_OXYGEN), TLV["oxygen"])
|
||||
var/nitrogen_dangerlevel = get_danger_level(environment.partial_pressure(GAS_NITROGEN), TLV["nitrogen"])
|
||||
var/co2_dangerlevel = get_danger_level(environment.partial_pressure(GAS_CARBON), TLV["carbon_dioxide"])
|
||||
var/plasma_dangerlevel = get_danger_level(environment.partial_pressure(GAS_PLASMA), TLV["plasma"])
|
||||
var/temperature_dangerlevel = get_danger_level(environment.temperature, TLV["temperature"])
|
||||
var/n2o_dangerlevel = get_danger_level(n2o_moles*partial_pressure, TLV["n2o"])
|
||||
var/other_dangerlevel = get_danger_level(other_moles*partial_pressure, TLV["other"])
|
||||
var/n2o_dangerlevel = get_danger_level(environment.partial_pressure(GAS_SLEEPING), TLV["n2o"])
|
||||
var/other_dangerlevel = get_danger_level(other_moles / environment.total_moles * environment.pressure, TLV["other"])
|
||||
|
||||
return max(
|
||||
pressure_dangerlevel,
|
||||
@@ -526,54 +528,50 @@
|
||||
return null
|
||||
|
||||
var/datum/gas_mixture/environment = location.return_air()
|
||||
var/total = environment.total_moles()
|
||||
var/total = environment.total_moles
|
||||
if(total==0)
|
||||
return null
|
||||
|
||||
var/partial_pressure = R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume
|
||||
|
||||
var/list/current_settings = TLV["pressure"]
|
||||
var/environment_pressure = environment.return_pressure()
|
||||
var/pressure_dangerlevel = get_danger_level(environment_pressure, current_settings)
|
||||
var/pressure_dangerlevel = get_danger_level(environment.pressure, current_settings)
|
||||
|
||||
current_settings = TLV["oxygen"]
|
||||
var/oxygen_dangerlevel = get_danger_level(environment.oxygen*partial_pressure, current_settings)
|
||||
var/oxygen_percent = round(environment.oxygen / total * 100, 2)
|
||||
var/oxygen_dangerlevel = get_danger_level(environment.partial_pressure(GAS_OXYGEN), current_settings)
|
||||
var/oxygen_percent = round(environment[GAS_OXYGEN] / total * 100, 2)
|
||||
|
||||
current_settings = TLV["nitrogen"]
|
||||
var/nitrogen_dangerlevel = get_danger_level(environment.nitrogen*partial_pressure, current_settings)
|
||||
var/nitrogen_percent = round(environment.nitrogen / total * 100, 2)
|
||||
var/nitrogen_dangerlevel = get_danger_level(environment.partial_pressure(GAS_NITROGEN), current_settings)
|
||||
var/nitrogen_percent = round(environment[GAS_NITROGEN] / total * 100, 2)
|
||||
|
||||
current_settings = TLV["carbon_dioxide"]
|
||||
var/co2_dangerlevel = get_danger_level(environment.carbon_dioxide*partial_pressure, current_settings)
|
||||
var/co2_percent = round(environment.carbon_dioxide / total * 100, 2)
|
||||
var/co2_dangerlevel = get_danger_level(environment.partial_pressure(GAS_CARBON), current_settings)
|
||||
var/co2_percent = round(environment[GAS_CARBON] / total * 100, 2)
|
||||
|
||||
current_settings = TLV["plasma"]
|
||||
var/plasma_dangerlevel = get_danger_level(environment.toxins*partial_pressure, current_settings)
|
||||
var/plasma_percent = round(environment.toxins / total * 100, 2)
|
||||
var/plasma_dangerlevel = get_danger_level(environment.partial_pressure(GAS_PLASMA), current_settings)
|
||||
var/plasma_percent = round(environment[GAS_PLASMA] / total * 100, 2)
|
||||
|
||||
current_settings = TLV["n2o"]
|
||||
var/n2o_dangerlevel = get_danger_level(environment.partial_pressure(GAS_SLEEPING), current_settings)
|
||||
var/n2o_percent = round(environment[GAS_SLEEPING] / total * 100, 2)
|
||||
|
||||
current_settings = TLV["other"]
|
||||
var/n2o_moles = 0.0
|
||||
var/other_moles = 0.0
|
||||
for(var/datum/gas/G in environment.trace_gases)
|
||||
if(istype(G, /datum/gas/sleeping_agent))
|
||||
n2o_moles+=G.moles
|
||||
else
|
||||
other_moles+=G.moles
|
||||
|
||||
var/n2o_percent = round(n2o_moles / total * 100, 2)
|
||||
var/other_moles
|
||||
for(var/g in environment.gas)
|
||||
switch(g)
|
||||
if(CHECKED_GAS)
|
||||
//Do nothing
|
||||
else
|
||||
other_moles += environment[g]
|
||||
var/other_dangerlevel = get_danger_level(other_moles / total * environment.pressure, current_settings)
|
||||
var/other_percent = round(other_moles / total * 100, 2)
|
||||
|
||||
var/other_dangerlevel = get_danger_level(other_moles*partial_pressure, current_settings)
|
||||
current_settings = TLV["n2o"]
|
||||
var/n2o_dangerlevel = get_danger_level(n2o_moles*partial_pressure, current_settings)
|
||||
|
||||
current_settings = TLV["temperature"]
|
||||
var/temperature_dangerlevel = get_danger_level(environment.temperature, current_settings)
|
||||
|
||||
|
||||
var/data[0]
|
||||
data["pressure"]=environment_pressure
|
||||
data["pressure"]=environment.pressure
|
||||
data["temperature"]=environment.temperature
|
||||
data["temperature_c"]=round(environment.temperature - T0C, 0.1)
|
||||
|
||||
@@ -1065,7 +1063,7 @@ FIRE ALARM
|
||||
var/turf/simulated/location = loc
|
||||
if(shelter && istype(location)) //If simulated turf and we have a shelter to drop
|
||||
var/datum/gas_mixture/environment = location.return_air()
|
||||
if(environment.toxins*(R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume)>0.5) //Partial Pressure of 0.5%
|
||||
if(environment.partial_pressure(GAS_PLASMA) > 0.5) //Partial Pressure of 0.5kPa
|
||||
var/obj/item/inflatable/shelter/S = new /obj/item/inflatable/shelter(loc)
|
||||
S.inflate()
|
||||
shelter = FALSE
|
||||
@@ -1321,3 +1319,7 @@ var/global/list/firealarms = list() //shrug
|
||||
/obj/machinery/alarm/npc_tamper_act(mob/living/L)
|
||||
if(wires)
|
||||
wires.npc_tamper(L)
|
||||
|
||||
|
||||
|
||||
#undef CHECKED_GAS
|
||||
|
||||
@@ -77,20 +77,18 @@
|
||||
signal.data["temperature"] = round(air_sample.temperature,0.1)
|
||||
|
||||
if(output>=4)
|
||||
var/total_moles = air_sample.total_moles()
|
||||
var/total_moles = air_sample.total_moles
|
||||
if(total_moles > 0)
|
||||
if(output&4)
|
||||
signal.data["oxygen"] = round(100*air_sample.oxygen/total_moles,0.1)
|
||||
if(output&8)
|
||||
signal.data["toxins"] = round(100*air_sample.toxins/total_moles,0.1)
|
||||
if(output&16)
|
||||
signal.data["nitrogen"] = round(100*air_sample.nitrogen/total_moles,0.1)
|
||||
if(output&32)
|
||||
signal.data["carbon_dioxide"] = round(100*air_sample.carbon_dioxide/total_moles,0.1)
|
||||
if(output&64)
|
||||
var/datum/gas/sleeping_agent/G = locate(/datum/gas/sleeping_agent) in air_sample.trace_gases
|
||||
var/n2o_moles = G ? G.moles : 0
|
||||
signal.data["nitrous_oxide"] = round(100 *n2o_moles/total_moles,0.1)
|
||||
if(output & 4)
|
||||
signal.data["oxygen"] = round(100 * air_sample[GAS_OXYGEN] / total_moles, 0.1)
|
||||
if(output & 8)
|
||||
signal.data["toxins"] = round(100 * air_sample[GAS_PLASMA] / total_moles, 0.1)
|
||||
if(output & 16)
|
||||
signal.data["nitrogen"] = round(100 * air_sample[GAS_NITROGEN] / total_moles, 0.1)
|
||||
if(output & 32)
|
||||
signal.data["carbon_dioxide"] = round(100 * air_sample[GAS_CARBON] / total_moles, 0.1)
|
||||
if(output & 64)
|
||||
signal.data["nitrous_oxide"] = round(100 * air_sample[GAS_SLEEPING] / total_moles, 0.1)
|
||||
else
|
||||
signal.data["oxygen"] = 0
|
||||
signal.data["toxins"] = 0
|
||||
|
||||
@@ -413,54 +413,35 @@
|
||||
|
||||
/obj/machinery/portable_atmospherics/canister/plasma/New(loc)
|
||||
..(loc)
|
||||
air_contents.adjust(tx = (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature))
|
||||
air_contents.adjust_gas(GAS_PLASMA, (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature))
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/portable_atmospherics/canister/oxygen/New(loc)
|
||||
..(loc)
|
||||
src.air_contents.adjust((maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature))
|
||||
air_contents.adjust_gas(GAS_OXYGEN, (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature))
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/portable_atmospherics/canister/sleeping_agent/New(loc)
|
||||
..(loc)
|
||||
var/datum/gas/sleeping_agent/sleeping_agent = new
|
||||
sleeping_agent.moles = (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
|
||||
air_contents.adjust(traces = list(sleeping_agent))
|
||||
air_contents.adjust_gas(GAS_SLEEPING, (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature))
|
||||
update_icon()
|
||||
|
||||
/*
|
||||
//Dirty way to fill room with gas. However it is a bit easier to do than creating some floor/engine/n2o -rastaf0
|
||||
/obj/machinery/portable_atmospherics/canister/sleeping_agent/roomfiller/New()
|
||||
..()
|
||||
var/datum/gas/sleeping_agent/trace_gas = air_contents.trace_gases[1]
|
||||
trace_gas.moles = 9*4000
|
||||
spawn(10)
|
||||
var/turf/simulated/location = src.loc
|
||||
if (istype(src.loc))
|
||||
while (!location.air)
|
||||
sleep(10)
|
||||
location.assume_air(air_contents)
|
||||
air_contents = new
|
||||
return 1
|
||||
*/
|
||||
|
||||
/obj/machinery/portable_atmospherics/canister/nitrogen/New(loc)
|
||||
..(loc)
|
||||
air_contents.adjust(n2 = (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature))
|
||||
air_contents.adjust_gas(GAS_NITROGEN, (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature))
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/portable_atmospherics/canister/carbon_dioxide/New(loc)
|
||||
..(loc)
|
||||
air_contents.adjust(co2 = (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature))
|
||||
air_contents.adjust_gas(GAS_CARBON, (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature))
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/portable_atmospherics/canister/air/New(loc)
|
||||
..(loc)
|
||||
|
||||
air_contents.adjust(\
|
||||
(O2STANDARD * maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature),\
|
||||
n2 = (N2STANDARD * maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)\
|
||||
)
|
||||
air_contents.adjust_multi(
|
||||
GAS_OXYGEN, (O2STANDARD * maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature),
|
||||
GAS_NITROGEN, (N2STANDARD * maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature))
|
||||
|
||||
update_icon()
|
||||
|
||||
|
||||
@@ -121,42 +121,45 @@
|
||||
|
||||
loc.assume_air(removed)
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/miner/sleeping_agent
|
||||
name = "\improper N2O Gas Miner"
|
||||
overlay_color = "#FFCCCC"
|
||||
|
||||
AddAir()
|
||||
var/datum/gas/sleeping_agent/trace_gas = new
|
||||
air_contents.trace_gases += trace_gas
|
||||
trace_gas.moles = internal_pressure * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
|
||||
/obj/machinery/atmospherics/miner/sleeping_agent/AddAir()
|
||||
air_contents.adjust_gas(GAS_SLEEPING, internal_pressure * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature))
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/miner/nitrogen
|
||||
name = "\improper N2 Gas Miner"
|
||||
overlay_color = "#CCFFCC"
|
||||
|
||||
AddAir()
|
||||
air_contents.nitrogen = internal_pressure * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
|
||||
/obj/machinery/atmospherics/miner/nitrogen/AddAir()
|
||||
air_contents.adjust_gas(GAS_NITROGEN, internal_pressure * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature))
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/miner/oxygen
|
||||
name = "\improper O2 Gas Miner"
|
||||
overlay_color = "#007FFF"
|
||||
|
||||
AddAir()
|
||||
air_contents.oxygen = internal_pressure * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
|
||||
/obj/machinery/atmospherics/miner/oxygen/AddAir()
|
||||
air_contents.adjust_gas(GAS_OXYGEN, internal_pressure * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature))
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/miner/toxins
|
||||
name = "\improper Plasma Gas Miner"
|
||||
overlay_color = "#FF0000"
|
||||
|
||||
AddAir()
|
||||
air_contents.toxins = internal_pressure * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
|
||||
/obj/machinery/atmospherics/miner/toxins/AddAir()
|
||||
air_contents.adjust_gas(GAS_PLASMA, internal_pressure * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature))
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/miner/carbon_dioxide
|
||||
name = "\improper CO2 Gas Miner"
|
||||
overlay_color = "#CDCDCD"
|
||||
|
||||
AddAir()
|
||||
air_contents.carbon_dioxide = internal_pressure * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
|
||||
/obj/machinery/atmospherics/miner/carbon_dioxide/AddAir()
|
||||
air_contents.adjust_gas(GAS_CARBON, internal_pressure * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature))
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/miner/air
|
||||
@@ -166,6 +169,7 @@
|
||||
|
||||
on = 0
|
||||
|
||||
AddAir()
|
||||
air_contents.oxygen = 0.2 * internal_pressure * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
|
||||
air_contents.nitrogen = 0.8 * internal_pressure * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
|
||||
/obj/machinery/atmospherics/miner/air/AddAir()
|
||||
air_contents.adjust_multi(
|
||||
GAS_OXYGEN, O2STANDARD * internal_pressure * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature),
|
||||
GAS_NITROGEN, N2STANDARD * internal_pressure * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature))
|
||||
|
||||
@@ -89,12 +89,12 @@
|
||||
"sigtype" = "status"
|
||||
)
|
||||
|
||||
var/total_moles = environment.total_moles()
|
||||
var/total_moles = environment.total_moles
|
||||
if(total_moles > 0)
|
||||
signal.data["oxygen"] = round(100*environment.oxygen/total_moles,0.1)
|
||||
signal.data["toxins"] = round(100*environment.toxins/total_moles,0.1)
|
||||
signal.data["nitrogen"] = round(100*environment.nitrogen/total_moles,0.1)
|
||||
signal.data["carbon_dioxide"] = round(100*environment.carbon_dioxide/total_moles,0.1)
|
||||
signal.data["oxygen"] = round(100*environment[GAS_OXYGEN]/total_moles,0.1)
|
||||
signal.data["toxins"] = round(100*environment[GAS_PLASMA]/total_moles,0.1)
|
||||
signal.data["nitrogen"] = round(100*environment[GAS_NITROGEN]/total_moles,0.1)
|
||||
signal.data["carbon_dioxide"] = round(100*environment[GAS_CARBON]/total_moles,0.1)
|
||||
else
|
||||
signal.data["oxygen"] = 0
|
||||
signal.data["toxins"] = 0
|
||||
@@ -175,4 +175,4 @@
|
||||
src.target = loc
|
||||
|
||||
/obj/machinery/meter/turf/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
return
|
||||
return
|
||||
|
||||
@@ -113,9 +113,8 @@
|
||||
if(possible_port)
|
||||
if(connect(possible_port))
|
||||
to_chat(user, "<span class='notice'>You connect [name] to the port.</span>")
|
||||
var/datum/gas/sleeping_agent/S = locate() in src.air_contents.trace_gases
|
||||
if(src.air_contents.toxins > 0 || (istype(S)))
|
||||
log_admin("[usr]([ckey(usr.key)]) connected a canister that contains \[[src.air_contents.toxins > 0 ? "Toxins" : ""] [istype(S) ? " N2O" : ""]\] to a connector_port at [loc.x], [loc.y], [loc.z]")
|
||||
if(air_contents[GAS_PLASMA] > 0 || air_contents[GAS_SLEEPING] > 0)
|
||||
log_admin("[usr]([ckey(usr.key)]) connected a canister that contains \[[air_contents[GAS_PLASMA] > 0 ? "Toxins" : ""] [air_contents[GAS_SLEEPING] > 0 ? " N2O" : ""]\] to a connector_port at [loc.x], [loc.y], [loc.z]")
|
||||
pixel_x = possible_port.pixel_x
|
||||
pixel_y = possible_port.pixel_y
|
||||
return 1
|
||||
|
||||
@@ -128,23 +128,12 @@
|
||||
filtered_out.temperature = removed.temperature
|
||||
|
||||
|
||||
filtered_out.toxins = removed.toxins
|
||||
removed.toxins = 0
|
||||
|
||||
filtered_out.carbon_dioxide = removed.carbon_dioxide
|
||||
removed.carbon_dioxide = 0
|
||||
|
||||
if(removed.trace_gases.len>0)
|
||||
for(var/datum/gas/trace_gas in removed.trace_gases)
|
||||
if(istype(trace_gas, /datum/gas/sleeping_agent))
|
||||
removed.trace_gases -= trace_gas
|
||||
filtered_out.trace_gases += trace_gas
|
||||
|
||||
if(removed.trace_gases.len>0)
|
||||
for(var/datum/gas/trace_gas in removed.trace_gases)
|
||||
if(istype(trace_gas, /datum/gas/oxygen_agent_b))
|
||||
removed.trace_gases -= trace_gas
|
||||
filtered_out.trace_gases += trace_gas
|
||||
filtered_out.adjust_multi(
|
||||
GAS_PLASMA, removed[GAS_PLASMA],
|
||||
GAS_CARBON, removed[GAS_CARBON],
|
||||
GAS_SLEEPING, removed[GAS_SLEEPING],
|
||||
GAS_OXAGENT, removed[GAS_OXAGENT])
|
||||
removed.subtract(filtered_out)
|
||||
|
||||
//Remix the resulting gases
|
||||
air_contents.merge(filtered_out)
|
||||
|
||||
@@ -481,7 +481,7 @@ var/global/list/cryo_health_indicator = list( "full" = image("icon" = 'icons/obj
|
||||
var/mob/living/carbon/human/guy = occupant //Gotta cast to read this guy's species
|
||||
if(istype(guy) && guy.species && guy.species.breath_type != "oxygen")
|
||||
occupant.nobreath = 15 //Prevent them from suffocating until someone can get them internals. Also prevents plasmamen from combusting.
|
||||
if(air_contents.oxygen > 2)
|
||||
if(air_contents[GAS_OXYGEN] > 2)
|
||||
if(occupant.getOxyLoss())
|
||||
occupant.adjustOxyLoss(-1)
|
||||
else
|
||||
|
||||
@@ -285,8 +285,8 @@
|
||||
// target_tile.parent.suspend_group_processing()
|
||||
var/datum/gas_mixture/napalm = new
|
||||
var/toxinsToDeduce = 35
|
||||
napalm.toxins = toxinsToDeduce
|
||||
napalm.temperature = 400+T0C
|
||||
napalm.adjust_gas(GAS_PLASMA, toxinsToDeduce)
|
||||
target_tile.assume_air(napalm)
|
||||
spawn (0)
|
||||
target_tile.hotspot_expose(temperature, 400, surfaces=1)
|
||||
|
||||
@@ -179,8 +179,8 @@
|
||||
|
||||
var/toxinsToDeduce = temperature/10
|
||||
|
||||
napalm.toxins = toxinsToDeduce
|
||||
napalm.temperature = 200+T0C
|
||||
napalm.adjust_gas(GAS_PLASMA, toxinsToDeduce)
|
||||
|
||||
target_tile.assume_air(napalm)
|
||||
spawn (0) target_tile.hotspot_expose(temperature, 400,surfaces=1)
|
||||
|
||||
@@ -127,7 +127,6 @@
|
||||
if(!colour2 && !T.density)
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
var/turf_total = environment.molar_density() * CELL_VOLUME
|
||||
//var/turf_total = T.co2 + T.oxygen + T.poison + T.sl_gas + T.n2
|
||||
|
||||
|
||||
var/t1 = turf_total / MOLES_CELLSTANDARD * 150
|
||||
|
||||
@@ -1215,13 +1215,13 @@
|
||||
return
|
||||
var/datum/gas_mixture/GM = new
|
||||
if(prob(10))
|
||||
GM.toxins += 100
|
||||
GM.temperature = 1500+T0C //should be enough to start a fire
|
||||
GM.adjust_gas(GAS_PLASMA, 100)
|
||||
T.visible_message("The [src] suddenly disgorges a cloud of heated plasma.")
|
||||
destroy()
|
||||
else
|
||||
GM.toxins += 5
|
||||
GM.temperature = istype(T) ? T.air.temperature : T20C
|
||||
GM.adjust_gas(GAS_PLASMA, 5)
|
||||
T.visible_message("The [src] suddenly disgorges a cloud of plasma.")
|
||||
T.assume_air(GM)
|
||||
return
|
||||
@@ -1559,7 +1559,7 @@
|
||||
/obj/item/mecha_parts/mecha_equipment/tool/collector/get_equip_info()
|
||||
if(!collector.P)
|
||||
return "[..()] No tank loaded."
|
||||
if(collector.P.air_contents.toxins <= 0)
|
||||
if(collector.P.air_contents[GAS_PLASMA] <= 0)
|
||||
return "[..()] ERROR: Tank empty. \[<a href='?src=\ref[src];eject=0'>eject tank</a>\]"
|
||||
return "[..()] \[<a href='?src=\ref[src];toggle=0'>[collector.active ? "Deactivate" : "Activate"] radiation collector array</a>\]\[<a href='?src=\ref[src];eject=0'>eject tank</a>\]"
|
||||
|
||||
|
||||
@@ -189,8 +189,9 @@
|
||||
cabin_air = new
|
||||
cabin_air.temperature = T20C
|
||||
cabin_air.volume = 200
|
||||
cabin_air.oxygen = O2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
|
||||
cabin_air.nitrogen = N2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
|
||||
cabin_air.adjust_multi(
|
||||
GAS_OXYGEN, O2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature),
|
||||
GAS_NITROGEN, N2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature))
|
||||
return cabin_air
|
||||
|
||||
/obj/mecha/proc/add_radio()
|
||||
|
||||
@@ -38,9 +38,7 @@
|
||||
/obj/effect/mine/plasma/trigger(AM)
|
||||
for(var/turf/simulated/floor/target in range(1,src))
|
||||
if(!target.blocks_air)
|
||||
var/datum/gas_mixture/payload = new
|
||||
payload.toxins = 30
|
||||
target.zone.air.merge(payload)
|
||||
target.zone.air.adjust_gas(GAS_PLASMA, 30)
|
||||
target.hotspot_expose(1000, CELL_VOLUME)
|
||||
qdel(src)
|
||||
|
||||
@@ -52,26 +50,6 @@
|
||||
del(AM.client)
|
||||
qdel(src)
|
||||
|
||||
/obj/effect/mine/n2o
|
||||
name = "N2O Mine"
|
||||
|
||||
/obj/effect/mine/n2o/trigger(AM)
|
||||
//example: n2o triggerproc
|
||||
//note: im lazy
|
||||
|
||||
for (var/turf/simulated/floor/target in range(1,src))
|
||||
if(!target.blocks_air)
|
||||
|
||||
var/datum/gas_mixture/payload = new
|
||||
var/datum/gas/sleeping_agent/trace_gas = new
|
||||
|
||||
trace_gas.moles = 187 // total mols of a n2o canister 1870.81
|
||||
payload += trace_gas
|
||||
|
||||
target.zone.air.merge(payload)
|
||||
|
||||
qdel(src)
|
||||
|
||||
/obj/effect/mine/stun
|
||||
name = "Stun Mine"
|
||||
|
||||
@@ -79,4 +57,4 @@
|
||||
if(ismob(AM))
|
||||
AM.Knockdown(10)
|
||||
spark(src)
|
||||
qdel(src)
|
||||
qdel(src)
|
||||
|
||||
@@ -137,13 +137,12 @@
|
||||
OT.master = V
|
||||
|
||||
PT.air_contents.temperature = PLASMA_FLASHPOINT
|
||||
PT.air_contents.toxins = 15
|
||||
PT.air_contents.carbon_dioxide = 33
|
||||
PT.air_contents.update_values()
|
||||
PT.air_contents.adjust_multi(
|
||||
GAS_PLASMA, 15,
|
||||
GAS_CARBON, 33)
|
||||
|
||||
OT.air_contents.temperature = PLASMA_FLASHPOINT
|
||||
OT.air_contents.oxygen = 48
|
||||
OT.air_contents.update_values()
|
||||
OT.air_contents.adjust_gas(GAS_OXYGEN, 48)
|
||||
|
||||
var/obj/item/device/assembly/S
|
||||
|
||||
|
||||
@@ -866,10 +866,10 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
dat += "Air Pressure: [round(pressure,0.1)] kPa<br>"
|
||||
|
||||
if (total_moles)
|
||||
var/o2_level = environment.oxygen/total_moles
|
||||
var/n2_level = environment.nitrogen/total_moles
|
||||
var/co2_level = environment.carbon_dioxide/total_moles
|
||||
var/plasma_level = environment.toxins/total_moles
|
||||
var/o2_level = environment[GAS_OXYGEN]/total_moles
|
||||
var/n2_level = environment[GAS_NITROGEN]/total_moles
|
||||
var/co2_level = environment[GAS_CARBON]/total_moles
|
||||
var/plasma_level = environment[GAS_PLASMA]/total_moles
|
||||
var/unknown_level = 1-(o2_level+n2_level+co2_level+plasma_level)
|
||||
|
||||
dat += {"Nitrogen: [round(n2_level*100)]%<br>
|
||||
|
||||
@@ -354,22 +354,22 @@ Subject's pulse: ??? BPM"})
|
||||
message += "<span class='bnotice'><B>[bicon(container)] Results of [container] scan:</span></B>"
|
||||
if(total_moles)
|
||||
message += "<br>[human_standard && abs(pressure - ONE_ATMOSPHERE) > 10 ? "<span class='bad'>" : "<span class='notice'>"] Pressure: [round(pressure, 0.1)] kPa</span>"
|
||||
var/o2_concentration = scanned.oxygen/total_moles
|
||||
var/n2_concentration = scanned.nitrogen/total_moles
|
||||
var/co2_concentration = scanned.carbon_dioxide/total_moles
|
||||
var/plasma_concentration = scanned.toxins/total_moles
|
||||
var/o2_concentration = scanned[GAS_OXYGEN]/total_moles
|
||||
var/n2_concentration = scanned[GAS_NITROGEN]/total_moles
|
||||
var/co2_concentration = scanned[GAS_CARBON]/total_moles
|
||||
var/plasma_concentration = scanned[GAS_PLASMA]/total_moles
|
||||
var/heat_capacity = scanned.heat_capacity()
|
||||
|
||||
var/unknown_concentration = 1 - (o2_concentration + n2_concentration + co2_concentration + plasma_concentration)
|
||||
|
||||
if(n2_concentration > 0.01)
|
||||
message += "<br>[human_standard && abs(n2_concentration - N2STANDARD) > 20 ? "<span class='bad'>" : "<span class='notice'>"] Nitrogen: [round(scanned.nitrogen, 0.1)] mol, [round(n2_concentration*100)]%</span>"
|
||||
message += "<br>[human_standard && abs(n2_concentration - N2STANDARD) > 20 ? "<span class='bad'>" : "<span class='notice'>"] Nitrogen: [round(scanned[GAS_NITROGEN], 0.1)] mol, [round(n2_concentration*100)]%</span>"
|
||||
if(o2_concentration > 0.01)
|
||||
message += "<br>[human_standard && abs(o2_concentration - O2STANDARD) > 2 ? "<span class='bad'>" : "<span class='notice'>"] Oxygen: [round(scanned.oxygen, 0.1)] mol, [round(o2_concentration*100)]%</span>"
|
||||
message += "<br>[human_standard && abs(o2_concentration - O2STANDARD) > 2 ? "<span class='bad'>" : "<span class='notice'>"] Oxygen: [round(scanned[GAS_OXYGEN], 0.1)] mol, [round(o2_concentration*100)]%</span>"
|
||||
if(co2_concentration > 0.01)
|
||||
message += "<br>[human_standard ? "<span class='bad'>" : "<span class='notice'>"] CO2: [round(scanned.carbon_dioxide, 0.1)] mol, [round(co2_concentration*100)]%</span>"
|
||||
message += "<br>[human_standard ? "<span class='bad'>" : "<span class='notice'>"] CO2: [round(scanned[GAS_CARBON], 0.1)] mol, [round(co2_concentration*100)]%</span>"
|
||||
if(plasma_concentration > 0.01)
|
||||
message += "<br>[human_standard ? "<span class='bad'>" : "<span class='notice'>"] Plasma: [round(scanned.toxins, 0.1)] mol, [round(plasma_concentration*100)]%</span>"
|
||||
message += "<br>[human_standard ? "<span class='bad'>" : "<span class='notice'>"] Plasma: [round(scanned[GAS_PLASMA], 0.1)] mol, [round(plasma_concentration*100)]%</span>"
|
||||
if(unknown_concentration > 0.01)
|
||||
message += "<br><span class='notice'>Unknown: [round(unknown_concentration*100)]%</span>"
|
||||
|
||||
|
||||
@@ -1169,22 +1169,9 @@
|
||||
for(var/i in L.gasses)
|
||||
if(istype(i, /datum/lung_gas/waste))
|
||||
var/datum/lung_gas/waste/W = i
|
||||
switch(W.id)
|
||||
if("oxygen")
|
||||
B.air_contents.adjust(o2 = 0.5)
|
||||
if("carbon_dioxide")
|
||||
B.air_contents.adjust(co2 = 0.5)
|
||||
if("nitrogen")
|
||||
B.air_contents.adjust(n2 = 0.5)
|
||||
if("toxins")
|
||||
B.air_contents.adjust(tx = 0.5)
|
||||
if("/datum/gas/sleeping_agent")
|
||||
var/datum/gas/sleeping_agent/S = new()
|
||||
S.moles = 0.5
|
||||
B.air_contents.adjust(traces = list(S))
|
||||
B.air_contents.adjust_gas(W.id, 0.5)
|
||||
else
|
||||
B.air_contents.adjust(co2 = 0.5)
|
||||
B.air_contents.update_values()
|
||||
B.air_contents.adjust_gas(GAS_CARBON, 0.5)
|
||||
else
|
||||
var/moles = ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*G.temperature)
|
||||
B.air_contents = G.remove(moles)
|
||||
|
||||
@@ -355,14 +355,14 @@ MATCHBOXES ARE ALSO IN FANCY.DM
|
||||
M.IgniteMob()
|
||||
smoketime--
|
||||
var/datum/gas_mixture/env = location.return_air()
|
||||
if(smoketime <= 0 | env.molar_density("oxygen") < (5 / CELL_VOLUME))
|
||||
if(smoketime <= 0 | env.molar_density(GAS_OXYGEN) < (5 / CELL_VOLUME))
|
||||
if(!inside_item)
|
||||
var/atom/new_butt = new type_butt(location) //Spawn the cigarette butt
|
||||
transfer_fingerprints_to(new_butt)
|
||||
lit = 0 //Actually unlight the cigarette so that the lighting can update correctly
|
||||
update_brightness()
|
||||
if(ismob(loc))
|
||||
if(env.oxygen < 5)
|
||||
if(env.molar_density(GAS_OXYGEN) < (5 / CELL_VOLUME))
|
||||
to_chat(M, "<span class='notice'>\The [src] suddenly goes out in a weak fashion.</span>")
|
||||
else
|
||||
to_chat(M, "<span class='notice'>Your [name] goes out.</span>")
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
|
||||
/obj/item/weapon/tank/jetpack/void/New()
|
||||
. = ..()
|
||||
air_contents.adjust((6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C))
|
||||
air_contents.adjust_gas(GAS_OXYGEN, (6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C))
|
||||
|
||||
/obj/item/weapon/tank/jetpack/oxygen
|
||||
name = "Jetpack (Oxygen)"
|
||||
@@ -96,7 +96,7 @@
|
||||
|
||||
/obj/item/weapon/tank/jetpack/oxygen/New()
|
||||
. = ..()
|
||||
air_contents.adjust((6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C))
|
||||
air_contents.adjust_gas(GAS_OXYGEN, (6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C))
|
||||
|
||||
/obj/item/weapon/tank/jetpack/oxygen/nukeops
|
||||
desc = "A tank of compressed oxygen for use as propulsion in zero-gravity areas. This one is unusually heavy."
|
||||
@@ -110,7 +110,7 @@
|
||||
|
||||
/obj/item/weapon/tank/jetpack/nitrogen/New()
|
||||
. = ..()
|
||||
air_contents.adjust(, , (6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C))
|
||||
air_contents.adjust_gas(GAS_NITROGEN, (6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C))
|
||||
|
||||
/obj/item/weapon/tank/jetpack/carbondioxide
|
||||
name = "Jetpack (Carbon Dioxide)"
|
||||
@@ -121,7 +121,7 @@
|
||||
|
||||
/obj/item/weapon/tank/jetpack/carbondioxide/New()
|
||||
. = ..()
|
||||
air_contents.adjust(, (6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C))
|
||||
air_contents.adjust_gas(GAS_CARBON, (6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C))
|
||||
|
||||
/obj/item/weapon/tank/jetpack/carbondioxide/silicon
|
||||
actions_types = list(/datum/action/item_action/jetpack_stabilization,/datum/action/item_action/toggle_jetpack)
|
||||
actions_types = list(/datum/action/item_action/jetpack_stabilization,/datum/action/item_action/toggle_jetpack)
|
||||
|
||||
@@ -18,12 +18,11 @@
|
||||
|
||||
/obj/item/weapon/tank/oxygen/New()
|
||||
. = ..()
|
||||
air_contents.adjust((6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C))
|
||||
air_contents.adjust_gas(GAS_OXYGEN, (6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C))
|
||||
|
||||
/obj/item/weapon/tank/oxygen/empty/New()
|
||||
..()
|
||||
air_contents.oxygen = 0
|
||||
air_contents.update_values()
|
||||
air_contents.multiply(0)
|
||||
|
||||
/obj/item/weapon/tank/oxygen/yellow
|
||||
desc = "A tank of oxygen, this one is yellow."
|
||||
@@ -44,9 +43,9 @@
|
||||
|
||||
/obj/item/weapon/tank/anesthetic/New()
|
||||
. = ..()
|
||||
var/datum/gas/sleeping_agent/sleeping_agent = new
|
||||
sleeping_agent.moles = (3 * ONE_ATMOSPHERE) * 70 / (R_IDEAL_GAS_EQUATION * T20C) * N2STANDARD
|
||||
air_contents.adjust((3 * ONE_ATMOSPHERE) * 70 / (R_IDEAL_GAS_EQUATION * T20C) * O2STANDARD, , , , list(sleeping_agent))
|
||||
air_contents.adjust_multi(
|
||||
GAS_SLEEPING, (3 * ONE_ATMOSPHERE) * 70 / (R_IDEAL_GAS_EQUATION * T20C) * N2STANDARD,
|
||||
GAS_OXYGEN, (3 * ONE_ATMOSPHERE) * 70 / (R_IDEAL_GAS_EQUATION * T20C) * O2STANDARD)
|
||||
|
||||
/*
|
||||
* Air
|
||||
@@ -58,7 +57,9 @@
|
||||
|
||||
/obj/item/weapon/tank/air/New()
|
||||
. = ..()
|
||||
air_contents.adjust((6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C) * O2STANDARD, , (6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C) * N2STANDARD)
|
||||
air_contents.adjust_multi(
|
||||
GAS_OXYGEN, (6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C) * O2STANDARD,
|
||||
GAS_NITROGEN, (6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C) * N2STANDARD)
|
||||
|
||||
/*
|
||||
* Plasma
|
||||
@@ -72,12 +73,11 @@
|
||||
|
||||
/obj/item/weapon/tank/plasma/New()
|
||||
. = ..()
|
||||
air_contents.adjust(, , , (3 * ONE_ATMOSPHERE) * 70 / (R_IDEAL_GAS_EQUATION * T20C))
|
||||
air_contents.adjust_gas(GAS_PLASMA, (3 * ONE_ATMOSPHERE) * 70 / (R_IDEAL_GAS_EQUATION * T20C))
|
||||
|
||||
/obj/item/weapon/tank/plasma/empty/New()
|
||||
..()
|
||||
air_contents.toxins = 0
|
||||
air_contents.update_values()
|
||||
air_contents.multiply(0)
|
||||
|
||||
/obj/item/weapon/tank/plasma/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
..()
|
||||
@@ -114,7 +114,7 @@
|
||||
|
||||
/obj/item/weapon/tank/emergency_oxygen/New()
|
||||
. = ..()
|
||||
air_contents.adjust((3 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C))
|
||||
air_contents.adjust_gas(GAS_OXYGEN, (3 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C))
|
||||
|
||||
/obj/item/weapon/tank/emergency_oxygen/engi
|
||||
name = "extended-capacity emergency oxygen tank"
|
||||
@@ -137,7 +137,7 @@
|
||||
|
||||
/obj/item/weapon/tank/emergency_nitrogen/New()
|
||||
. = ..()
|
||||
air_contents.adjust(, , (3 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C))
|
||||
air_contents.adjust_gas(GAS_NITROGEN, (3 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C))
|
||||
|
||||
/*
|
||||
* Nitrogen
|
||||
@@ -150,4 +150,4 @@
|
||||
|
||||
/obj/item/weapon/tank/nitrogen/New()
|
||||
. = ..()
|
||||
air_contents.adjust(, , (3 * ONE_ATMOSPHERE) * 70 / (R_IDEAL_GAS_EQUATION * T20C))
|
||||
air_contents.adjust_gas(GAS_NITROGEN, (3 * ONE_ATMOSPHERE) * 70 / (R_IDEAL_GAS_EQUATION * T20C))
|
||||
|
||||
@@ -215,16 +215,7 @@
|
||||
return 1
|
||||
|
||||
/obj/item/weapon/tank/proc/remove_air_volume(volume_to_return)
|
||||
if(!air_contents)
|
||||
return null
|
||||
|
||||
var/tank_pressure = air_contents.return_pressure()
|
||||
if(tank_pressure < distribute_pressure)
|
||||
distribute_pressure = tank_pressure
|
||||
|
||||
var/moles_needed = distribute_pressure*volume_to_return/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
|
||||
return remove_air(moles_needed)
|
||||
return air_contents?.remove_volume(volume_to_return)
|
||||
|
||||
/obj/item/weapon/tank/process()
|
||||
//Allow for reactions
|
||||
|
||||
@@ -304,9 +304,9 @@
|
||||
cabin_air = new /datum/gas_mixture()
|
||||
cabin_air.volume = CELL_VOLUME / 3
|
||||
cabin_air.temperature = T20C+20 //Nice and toasty to avoid Celthermia
|
||||
cabin_air.oxygen = MOLES_O2STANDARD
|
||||
cabin_air.nitrogen = MOLES_N2STANDARD
|
||||
cabin_air.update_values()
|
||||
cabin_air.adjust_multi(
|
||||
GAS_OXYGEN, MOLES_O2STANDARD,
|
||||
GAS_NITROGEN, MOLES_N2STANDARD)
|
||||
|
||||
/obj/structure/inflatable/shelter/examine(mob/user)
|
||||
..()
|
||||
|
||||
@@ -158,11 +158,7 @@
|
||||
/turf/simulated/floor/engine/n20/New()
|
||||
..()
|
||||
if(src.air)
|
||||
// EXACTLY the same code as fucking roomfillers. If this doesn't work, something's fucked.
|
||||
var/datum/gas/sleeping_agent/trace_gas = new
|
||||
air.trace_gases += trace_gas
|
||||
trace_gas.moles = 9*4000
|
||||
air.update_values()
|
||||
air.adjust_gas(GAS_SLEEPING, 9 * 4000) //NO goddamn idea what those numbers mean, but it's what they were before
|
||||
|
||||
/turf/simulated/floor/engine/nitrogen
|
||||
name = "nitrogen floor"
|
||||
|
||||
@@ -147,8 +147,8 @@
|
||||
target_tile.parent.suspend_group_processing()*/
|
||||
var/datum/gas_mixture/napalm = new
|
||||
var/toxinsToDeduce = 20
|
||||
napalm.toxins = toxinsToDeduce
|
||||
napalm.temperature = 400+T0C
|
||||
napalm.adjust_gas(GAS_PLASMA, toxinsToDeduce)
|
||||
target_tile.assume_air(napalm)
|
||||
spawn (0) target_tile.hotspot_expose(temperature, 400,surfaces=1)
|
||||
for(var/obj/structure/falsewall/plasma/F in range(3,src))//Hackish as fuck, but until fire_act works, there is nothing I can do -Sieve
|
||||
|
||||
@@ -463,58 +463,6 @@
|
||||
|
||||
turfdecals.len = 0
|
||||
|
||||
|
||||
//Commented out by SkyMarshal 5/10/13 - If you are patching up space, it should be vacuum.
|
||||
// If you are replacing a wall, you have increased the volume of the room without increasing the amount of gas in it.
|
||||
// As such, this will no longer be used.
|
||||
|
||||
//////Assimilate Air//////
|
||||
/*
|
||||
/turf/simulated/proc/Assimilate_Air()
|
||||
var/aoxy = 0//Holders to assimilate air from nearby turfs
|
||||
var/anitro = 0
|
||||
var/aco = 0
|
||||
var/atox = 0
|
||||
var/atemp = 0
|
||||
var/turf_count = 0
|
||||
|
||||
for(var/direction in cardinal)//Only use cardinals to cut down on lag
|
||||
var/turf/T = get_step(src,direction)
|
||||
if(istype(T,/turf/space))//Counted as no air
|
||||
turf_count++//Considered a valid turf for air calcs
|
||||
continue
|
||||
else if(istype(T,/turf/simulated/floor))
|
||||
var/turf/simulated/S = T
|
||||
if(S.air)//Add the air's contents to the holders
|
||||
aoxy += S.air.oxygen
|
||||
anitro += S.air.nitrogen
|
||||
aco += S.air.carbon_dioxide
|
||||
atox += S.air.toxins
|
||||
atemp += S.air.temperature
|
||||
turf_count ++
|
||||
air.oxygen = (aoxy/max(turf_count,1))//Averages contents of the turfs, ignoring walls and the like
|
||||
air.nitrogen = (anitro/max(turf_count,1))
|
||||
air.carbon_dioxide = (aco/max(turf_count,1))
|
||||
air.toxins = (atox/max(turf_count,1))
|
||||
air.temperature = (atemp/max(turf_count,1))//Trace gases can get bant
|
||||
air.update_values()
|
||||
|
||||
//cael - duplicate the averaged values across adjacent turfs to enforce a seamless atmos change
|
||||
for(var/direction in cardinal)//Only use cardinals to cut down on lag
|
||||
var/turf/T = get_step(src,direction)
|
||||
if(istype(T,/turf/space))//Counted as no air
|
||||
continue
|
||||
else if(istype(T,/turf/simulated/floor))
|
||||
var/turf/simulated/S = T
|
||||
if(S.air)//Add the air's contents to the holders
|
||||
S.air.oxygen = air.oxygen
|
||||
S.air.nitrogen = air.nitrogen
|
||||
S.air.carbon_dioxide = air.carbon_dioxide
|
||||
S.air.toxins = air.toxins
|
||||
S.air.temperature = air.temperature
|
||||
S.air.update_values()
|
||||
*/
|
||||
|
||||
/turf/proc/get_underlying_turf()
|
||||
var/area/A = loc
|
||||
if(A.base_turf_type)
|
||||
|
||||
@@ -102,14 +102,6 @@
|
||||
cell.charge = 15000
|
||||
cell.maxcharge = 15000
|
||||
|
||||
/*/obj/vehicle/proc/add_cabin() //In airtight.dm -Agouri
|
||||
cabin_air = new
|
||||
cabin_air.temperature = T20C
|
||||
cabin_air.volume = 200
|
||||
cabin_air.oxygen = O2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
|
||||
cabin_air.nitrogen = N2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
|
||||
return cabin_air*/
|
||||
|
||||
/obj/vehicle/proc/add_radio()
|
||||
radio = new(src)
|
||||
radio.name = "[src] radio"
|
||||
|
||||
@@ -160,11 +160,11 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
|
||||
|
||||
var/t = ""
|
||||
|
||||
t += {"Nitrogen : [env.nitrogen]
|
||||
Oxygen : [env.oxygen]
|
||||
Plasma : [env.toxins]
|
||||
CO2: [env.carbon_dioxide]
|
||||
Pressure: [env.return_pressure()]"}
|
||||
t += {"Nitrogen : [env[GAS_NITROGEN]]
|
||||
Oxygen : [env[GAS_OXYGEN]]
|
||||
Plasma : [env[GAS_PLASMA]]
|
||||
CO2: [env[GAS_CARBON]]
|
||||
Pressure: [env.pressure]"}
|
||||
usr.show_message(t, 1)
|
||||
feedback_add_details("admin_verb","ASL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
@@ -573,11 +573,11 @@ Pressure: [env.return_pressure()]"}
|
||||
if(Rad.anchored)
|
||||
if(!Rad.P)
|
||||
var/obj/item/weapon/tank/plasma/Plasma = new/obj/item/weapon/tank/plasma(Rad)
|
||||
Plasma.air_contents.toxins = 100 //Don't need to explain, space magic
|
||||
Plasma.air_contents[GAS_PLASMA] = 100 //Don't need to explain, space magic
|
||||
Plasma.air_contents.temperature = 73.15 //Perfect freezer cooling
|
||||
Plasma.air_contents.update_values()
|
||||
Rad.drain_ratio = 0
|
||||
Rad.P = Plasma
|
||||
Plasma.forceMove(Rad)
|
||||
|
||||
if(!Rad.active)
|
||||
Rad.toggle_power()
|
||||
|
||||
@@ -45,22 +45,6 @@
|
||||
set category = "Debug"
|
||||
set name = "Display Air Status"
|
||||
|
||||
/*(!isturf(target))
|
||||
return
|
||||
|
||||
var/datum/gas_mixture/GM = target.return_air()
|
||||
var/burning = 0
|
||||
if(istype(target, /turf/simulated))
|
||||
var/turf/simulated/T = target
|
||||
if(T.active_hotspot)
|
||||
burning = 1
|
||||
|
||||
to_chat(usr, "<span class='notice'>@[target.x],[target.y] ([GM.group_multiplier]): O:[GM.oxygen] T:[GM.toxins] N:[GM.nitrogen] C:[GM.carbon_dioxide] w [GM.temperature] Kelvin, [GM.return_pressure()] kPa [(burning)?("<span class='warning'>BURNING</span>"):(null)]</span>")
|
||||
for(var/datum/gas/trace_gas in GM.trace_gases)
|
||||
to_chat(usr, "[trace_gas.type]: [trace_gas.moles]")
|
||||
feedback_add_details("admin_verb","DAST") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
*/
|
||||
|
||||
/client/proc/_fix_delayers(var/dtype)
|
||||
var/largest_delay = 0
|
||||
var/mob/most_delayed_mob = null
|
||||
|
||||
@@ -879,37 +879,6 @@ Traitors and the like can also be revived with the previous role mostly intact.
|
||||
|
||||
feedback_add_details("admin_verb","CC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/* This proc is DEFERRED. Does not do anything.
|
||||
/client/proc/cmd_admin_remove_plasma()
|
||||
set category = "Debug"
|
||||
set name = "Stabilize Atmos."
|
||||
if(!holder)
|
||||
to_chat(src, "Only administrators may use this command.")
|
||||
return
|
||||
feedback_add_details("admin_verb","STATM") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
// DEFERRED
|
||||
spawn(0)
|
||||
for(var/turf/T in view())
|
||||
T.poison = 0
|
||||
T.oldpoison = 0
|
||||
T.tmppoison = 0
|
||||
T.oxygen = 755985
|
||||
T.oldoxy = 755985
|
||||
T.tmpoxy = 755985
|
||||
T.co2 = 14.8176
|
||||
T.oldco2 = 14.8176
|
||||
T.tmpco2 = 14.8176
|
||||
T.n2 = 2.844e+006
|
||||
T.on2 = 2.844e+006
|
||||
T.tn2 = 2.844e+006
|
||||
T.tsl_gas = 0
|
||||
T.osl_gas = 0
|
||||
T.sl_gas = 0
|
||||
T.temp = 293.15
|
||||
T.otemp = 293.15
|
||||
T.ttemp = 293.15
|
||||
*/
|
||||
|
||||
/client/proc/toggle_view_range()
|
||||
set category = "Special Verbs"
|
||||
set name = "Change View Range"
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
return
|
||||
|
||||
/obj/item/weapon/tank/proc/detonate() //This happens when a bomb is told to explode
|
||||
var/fuel_moles = air_contents.toxins + air_contents.oxygen/6
|
||||
var/fuel_moles = air_contents[GAS_PLASMA] + air_contents[GAS_OXYGEN]/6
|
||||
var/strength = 1
|
||||
|
||||
var/turf/ground_zero = get_turf(loc)
|
||||
|
||||
@@ -120,33 +120,14 @@
|
||||
return
|
||||
|
||||
// Handle gas consumption.
|
||||
if(seed.consume_gasses && seed.consume_gasses.len)
|
||||
if(seed.consume_gasses && seed.consume_gasses.len && environment)
|
||||
missing_gas = 0
|
||||
for(var/gas in seed.consume_gasses)
|
||||
if(environment)
|
||||
switch(gas)
|
||||
if("oxygen")
|
||||
if(environment.oxygen < seed.consume_gasses[gas])
|
||||
missing_gas++
|
||||
continue
|
||||
environment.adjust_gas(gas,-min(seed.consume_gasses[gas], environment.oxygen),1)
|
||||
if("plasma")
|
||||
if(environment.toxins < seed.consume_gasses[gas])
|
||||
missing_gas++
|
||||
continue
|
||||
environment.adjust_gas(gas,-min(seed.consume_gasses[gas], environment.toxins),1)
|
||||
if("nitrogen")
|
||||
if(environment.nitrogen < seed.consume_gasses[gas])
|
||||
missing_gas++
|
||||
continue
|
||||
environment.adjust_gas(gas,-min(seed.consume_gasses[gas], environment.nitrogen),1)
|
||||
if("carbon_dioxide")
|
||||
if(environment.carbon_dioxide < seed.consume_gasses[gas])
|
||||
missing_gas++
|
||||
continue
|
||||
environment.adjust_gas(gas,-min(seed.consume_gasses[gas], environment.carbon_dioxide),1)
|
||||
else
|
||||
if(environment[gas] < seed.consume_gasses[gas])
|
||||
missing_gas++
|
||||
continue
|
||||
environment.adjust_gas(gas, -(seed.consume_gasses[gas]), FALSE)
|
||||
environment.update_values()
|
||||
|
||||
if(missing_gas > 0)
|
||||
health -= missing_gas * HYDRO_SPEED_MULTIPLIER
|
||||
|
||||
@@ -718,29 +718,29 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
else
|
||||
to_chat(src, "<span class='warning'>Pressure: [round(pressure, 0.1)] kPa</span>")
|
||||
if(total_moles)
|
||||
var/o2_concentration = environment.oxygen / total_moles
|
||||
var/n2_concentration = environment.nitrogen / total_moles
|
||||
var/co2_concentration = environment.carbon_dioxide / total_moles
|
||||
var/plasma_concentration = environment.toxins / total_moles
|
||||
var/o2_concentration = environment[GAS_OXYGEN] / total_moles
|
||||
var/n2_concentration = environment[GAS_NITROGEN] / total_moles
|
||||
var/co2_concentration = environment[GAS_CARBON] / total_moles
|
||||
var/plasma_concentration = environment[GAS_PLASMA] / total_moles
|
||||
|
||||
var/unknown_concentration = 1 - (o2_concentration + n2_concentration + co2_concentration + plasma_concentration)
|
||||
if(abs(n2_concentration - N2STANDARD) < 20)
|
||||
to_chat(src, "<span class='notice'>Nitrogen: [round(n2_concentration * 100)]% ([round(environment.nitrogen / tiles, 0.01)] moles)</span>")
|
||||
to_chat(src, "<span class='notice'>Nitrogen: [round(n2_concentration * 100)]% ([round(environment.molar_density(GAS_NITROGEN) * CELL_VOLUME, 0.01)] moles)</span>")
|
||||
else
|
||||
to_chat(src, "<span class='warning'>Nitrogen: [round(n2_concentration * 100)]% ([round(environment.nitrogen / tiles, 0.01)] moles)</span>")
|
||||
to_chat(src, "<span class='warning'>Nitrogen: [round(n2_concentration * 100)]% ([round(environment.molar_density(GAS_NITROGEN) * CELL_VOLUME, 0.01)] moles)</span>")
|
||||
|
||||
if(abs(o2_concentration - O2STANDARD) < 2)
|
||||
to_chat(src, "<span class='notice'>Oxygen: [round(o2_concentration * 100)]% ([round(environment.oxygen / tiles, 0.01)] moles)</span>")
|
||||
to_chat(src, "<span class='notice'>Oxygen: [round(o2_concentration * 100)]% ([round(environment.molar_density(GAS_OXYGEN) * CELL_VOLUME, 0.01)] moles)</span>")
|
||||
else
|
||||
to_chat(src, "<span class='warning'>Oxygen: [round(o2_concentration * 100)]% ([round(environment.oxygen / tiles, 0.01)] moles)</span>")
|
||||
to_chat(src, "<span class='warning'>Oxygen: [round(o2_concentration * 100)]% ([round(environment.molar_density(GAS_OXYGEN) * CELL_VOLUME, 0.01)] moles)</span>")
|
||||
|
||||
if(co2_concentration > 0.01)
|
||||
to_chat(src, "<span class='warning'>CO2: [round(co2_concentration * 100)]% ([round(environment.carbon_dioxide / tiles, 0.01)] moles)</span>")
|
||||
to_chat(src, "<span class='warning'>CO2: [round(co2_concentration * 100)]% ([round(environment.molar_density(GAS_CARBON) * CELL_VOLUME, 0.01)] moles)</span>")
|
||||
else
|
||||
to_chat(src, "<span class='notice'>CO2: [round(co2_concentration * 100)]% ([round(environment.carbon_dioxide / tiles, 0.01)] moles)</span>")
|
||||
to_chat(src, "<span class='notice'>CO2: [round(co2_concentration * 100)]% ([round(environment.molar_density(GAS_CARBON) * CELL_VOLUME, 0.01)] moles)</span>")
|
||||
|
||||
if(plasma_concentration > 0.01)
|
||||
to_chat(src, "<span class='warning'>Plasma: [round(plasma_concentration * 100)]% ([round(environment.toxins / tiles, 0.01)] moles)</span>")
|
||||
to_chat(src, "<span class='warning'>Plasma: [round(plasma_concentration * 100)]% ([round(environment.molar_density(GAS_PLASMA) * CELL_VOLUME, 0.01)] moles)</span>")
|
||||
|
||||
if(unknown_concentration > 0.01)
|
||||
to_chat(src, "<span class='warning'>Unknown: [round(unknown_concentration * 100)]% ([round(unknown_concentration * total_moles / tiles, 0.01)] moles)</span>")
|
||||
|
||||
@@ -179,21 +179,22 @@
|
||||
breath.update_values()
|
||||
|
||||
//Partial pressure of the toxins in our breath
|
||||
var/Toxins_pp = (breath.toxins / breath.total_moles()) * breath.pressure
|
||||
var/Toxins_pp = breath.partial_pressure(GAS_PLASMA)
|
||||
|
||||
if(Toxins_pp) // Detect toxins in air
|
||||
|
||||
AdjustPlasma(breath.toxins * 250)
|
||||
AdjustPlasma(breath[GAS_PLASMA] * 250)
|
||||
toxins_alert = max(toxins_alert, 1)
|
||||
|
||||
toxins_used = breath.toxins
|
||||
toxins_used = breath[GAS_PLASMA]
|
||||
|
||||
else
|
||||
toxins_alert = 0
|
||||
|
||||
//Breathe in toxins and out oxygen
|
||||
breath.toxins -= toxins_used
|
||||
breath.oxygen += toxins_used
|
||||
breath.adjust_multi(
|
||||
GAS_PLASMA, -toxins_used,
|
||||
GAS_OXYGEN, toxins_used)
|
||||
|
||||
if(breath.temperature > (T0C+66) && !(M_RESIST_HEAT in mutations)) // Hot air hurts :(
|
||||
if(prob(20))
|
||||
|
||||
@@ -160,21 +160,22 @@
|
||||
breath.update_values()
|
||||
|
||||
//Partial pressure of the toxins in our breath
|
||||
var/Toxins_pp = (breath.toxins / breath.total_moles()) * breath.pressure
|
||||
var/Toxins_pp = breath.partial_pressure(GAS_PLASMA)
|
||||
|
||||
if(Toxins_pp) // Detect toxins in air
|
||||
|
||||
AdjustPlasma(breath.toxins * 250)
|
||||
AdjustPlasma(breath[GAS_PLASMA] * 250)
|
||||
toxins_alert = max(toxins_alert, 1)
|
||||
|
||||
toxins_used = breath.toxins
|
||||
toxins_used = breath[GAS_PLASMA]
|
||||
|
||||
else
|
||||
toxins_alert = 0
|
||||
|
||||
//Breathe in toxins and out oxygen
|
||||
breath.toxins -= toxins_used
|
||||
breath.oxygen += toxins_used
|
||||
breath.adjust_multi(
|
||||
GAS_PLASMA, -toxins_used,
|
||||
GAS_OXYGEN, toxins_used)
|
||||
|
||||
if(breath.temperature > (T0C+66) && !(M_RESIST_HEAT in mutations)) // Hot air hurts :(
|
||||
if(prob(20))
|
||||
|
||||
@@ -119,11 +119,11 @@
|
||||
breath.update_values()
|
||||
|
||||
//Partial pressure of the O2 in our breath
|
||||
var/O2_pp = (breath.oxygen / breath.total_moles()) * breath.pressure
|
||||
var/O2_pp = breath.partial_pressure(GAS_OXYGEN)
|
||||
// Same, but for the toxins
|
||||
var/Toxins_pp = (breath.toxins / breath.total_moles()) * breath.pressure
|
||||
var/Toxins_pp = breath.partial_pressure(GAS_PLASMA)
|
||||
// And CO2, lets say a PP of more than 10 will be bad (It's a little less really, but eh, being passed out all round aint no fun)
|
||||
var/CO2_pp = (breath.carbon_dioxide / breath.total_moles()) * breath.pressure
|
||||
var/CO2_pp = breath.partial_pressure(GAS_CARBON)
|
||||
|
||||
if(O2_pp < safe_oxygen_min) // Too little oxygen
|
||||
if(prob(20))
|
||||
@@ -132,21 +132,22 @@
|
||||
O2_pp = 0.01
|
||||
var/ratio = safe_oxygen_min/O2_pp
|
||||
adjustOxyLoss(min(5*ratio, 7)) // Don't fuck them up too fast (space only does 7 after all!)
|
||||
oxygen_used = breath.oxygen*ratio/6
|
||||
oxygen_used = breath[GAS_OXYGEN]*ratio/6
|
||||
oxygen_alert = max(oxygen_alert, 1)
|
||||
/*else if (O2_pp > safe_oxygen_max) // Too much oxygen (commented this out for now, I'll deal with pressure damage elsewhere I suppose)
|
||||
spawn(0) emote("cough")
|
||||
var/ratio = O2_pp/safe_oxygen_max
|
||||
oxyloss += 5*ratio
|
||||
oxygen_used = breath.oxygen*ratio/6
|
||||
oxygen_used = breath[GAS_OXYGEN]*ratio/6
|
||||
oxygen_alert = max(oxygen_alert, 1)*/
|
||||
else // We're in safe limits
|
||||
adjustOxyLoss(-5)
|
||||
oxygen_used = breath.oxygen/6
|
||||
oxygen_used = breath[GAS_OXYGEN]/6
|
||||
oxygen_alert = 0
|
||||
|
||||
breath.oxygen -= oxygen_used
|
||||
breath.carbon_dioxide += oxygen_used
|
||||
breath.adjust_multi(
|
||||
GAS_OXYGEN, -oxygen_used,
|
||||
GAS_CARBON, oxygen_used)
|
||||
|
||||
if(CO2_pp > safe_co2_max)
|
||||
if(!co2overloadtime) // If it's the first breath with too much CO2 in it, lets start a counter, then have them pass out after 12s or so.
|
||||
@@ -163,7 +164,7 @@
|
||||
co2overloadtime = 0
|
||||
|
||||
if(Toxins_pp > safe_toxins_max) // Too much toxins
|
||||
var/ratio = (breath.toxins/safe_toxins_max) * 10
|
||||
var/ratio = (breath[GAS_PLASMA]/safe_toxins_max) * 10
|
||||
//adjustToxLoss(Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE)) //Limit amount of damage toxin exposure can do per second
|
||||
if(ratio)
|
||||
if(reagents)
|
||||
@@ -172,16 +173,14 @@
|
||||
else
|
||||
toxins_alert = 0
|
||||
|
||||
if(breath.trace_gases.len) // If there's some other shit in the air lets deal with it here.
|
||||
for(var/datum/gas/sleeping_agent/SA in breath.trace_gases)
|
||||
var/SA_pp = (SA.moles / breath.total_moles()) * breath.pressure
|
||||
if(SA_pp > SA_para_min) // Enough to make us paralysed for a bit
|
||||
Paralyse(3) // 3 gives them one second to wake up and run away a bit!
|
||||
if(SA_pp > SA_sleep_min) // Enough to make us sleep as well
|
||||
sleeping = max(sleeping+2, 10)
|
||||
else if(SA_pp > 0.01) // There is sleeping gas in their lungs, but only a little, so give them a bit of a warning
|
||||
if(prob(20))
|
||||
spawn(0) emote(pick("giggle", "laugh"))
|
||||
var/SA_pp = breath.partial_pressure(GAS_SLEEPING)
|
||||
if(SA_pp > SA_para_min) // Enough to make us paralysed for a bit
|
||||
Paralyse(3) // 3 gives them one second to wake up and run away a bit!
|
||||
if(SA_pp > SA_sleep_min) // Enough to make us sleep as well
|
||||
sleeping = max(sleeping+2, 10)
|
||||
else if(SA_pp > 0.01) // There is sleeping gas in their lungs, but only a little, so give them a bit of a warning
|
||||
if(prob(20))
|
||||
spawn(0) emote(pick("giggle", "laugh"))
|
||||
|
||||
|
||||
if(breath.temperature > (T0C+66)) // Hot air hurts :(
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
//This was OP.
|
||||
//environment.adjust(tx = environment.total_moles()*BREATH_PERCENTAGE) //About one breath's worth. (I know we aren't breathing it out, but this should be about the right amount)
|
||||
if(environment)
|
||||
if(environment.oxygen && environment.total_moles() && (environment.oxygen / environment.total_moles()) >= OXYCONCEN_PLASMEN_IGNITION) //How's the concentration doing?
|
||||
if(environment.total_moles && ((environment[GAS_OXYGEN] / environment.total_moles) >= OXYCONCEN_PLASMEN_IGNITION)) //How's the concentration doing?
|
||||
if(!on_fire)
|
||||
to_chat(src, "<span class='warning'>Your body reacts with the atmosphere and bursts into flame!</span>")
|
||||
adjust_fire_stacks(0.5)
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
else
|
||||
pressure_alert = -1
|
||||
|
||||
if((environment.toxins / environment.volume * CELL_VOLUME) > MOLES_PLASMA_VISIBLE)
|
||||
if(environment.molar_density(GAS_PLASMA) > MOLES_PLASMA_VISIBLE / CELL_VOLUME)
|
||||
pl_effects()
|
||||
|
||||
// Helper proc to map body temperatures to its corresponding heat/cold damage value
|
||||
@@ -82,4 +82,4 @@
|
||||
else if (temperature >= species.heat_level_3)
|
||||
return HEAT_DAMAGE_LEVEL_3
|
||||
else
|
||||
return 0
|
||||
return 0
|
||||
|
||||
@@ -329,14 +329,13 @@
|
||||
var/SA_para_min = 0.5
|
||||
var/SA_sleep_min = 5
|
||||
var/oxygen_used = 0
|
||||
var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
|
||||
|
||||
//Partial pressure of the O2 in our breath
|
||||
var/O2_pp = (breath.oxygen/breath.total_moles())*breath_pressure
|
||||
var/O2_pp = breath.partial_pressure(GAS_OXYGEN)
|
||||
// Same, but for the toxins
|
||||
var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure
|
||||
var/Toxins_pp = breath.partial_pressure(GAS_PLASMA)
|
||||
// And CO2, lets say a PP of more than 10 will be bad (It's a little less really, but eh, being passed out all round aint no fun)
|
||||
var/CO2_pp = (breath.carbon_dioxide/breath.total_moles())*breath_pressure
|
||||
var/CO2_pp = breath.partial_pressure(GAS_CARBON)
|
||||
|
||||
if(O2_pp < safe_oxygen_min) // Too little oxygen
|
||||
if(prob(20))
|
||||
@@ -345,21 +344,22 @@
|
||||
O2_pp = 0.01
|
||||
var/ratio = safe_oxygen_min/O2_pp
|
||||
adjustOxyLoss(min(5*ratio, 7)) // Don't fuck them up too fast (space only does 7 after all!)
|
||||
oxygen_used = breath.oxygen*ratio/6
|
||||
oxygen_used = breath[GAS_OXYGEN]*ratio/6
|
||||
oxygen_alert = max(oxygen_alert, 1)
|
||||
/*else if (O2_pp > safe_oxygen_max) // Too much oxygen (commented this out for now, I'll deal with pressure damage elsewhere I suppose)
|
||||
spawn(0) emote("cough")
|
||||
var/ratio = O2_pp/safe_oxygen_max
|
||||
oxyloss += 5*ratio
|
||||
oxygen_used = breath.oxygen*ratio/6
|
||||
oxygen_used = breath[GAS_OXYGEN]*ratio/6
|
||||
oxygen_alert = max(oxygen_alert, 1)*/
|
||||
else // We're in safe limits
|
||||
adjustOxyLoss(-5)
|
||||
oxygen_used = breath.oxygen/6
|
||||
oxygen_used = breath[GAS_OXYGEN]/6
|
||||
oxygen_alert = 0
|
||||
|
||||
breath.oxygen -= oxygen_used
|
||||
breath.carbon_dioxide += oxygen_used
|
||||
breath.adjust_multi(
|
||||
GAS_OXYGEN, -oxygen_used,
|
||||
GAS_CARBON, oxygen_used)
|
||||
|
||||
if(CO2_pp > safe_co2_max)
|
||||
if(!co2overloadtime) // If it's the first breath with too much CO2 in it, lets start a counter, then have them pass out after 12s or so.
|
||||
@@ -376,12 +376,12 @@
|
||||
co2overloadtime = 0
|
||||
|
||||
if(Toxins_pp > safe_toxins_max) // Too much toxins
|
||||
var/ratio = (breath.toxins/safe_toxins_max) * 10
|
||||
var/ratio = (breath[GAS_PLASMA]/safe_toxins_max) * 10
|
||||
//adjustToxLoss(Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE)) //Limit amount of damage toxin exposure can do per second
|
||||
if(wear_mask)
|
||||
if(wear_mask.clothing_flags & BLOCK_GAS_SMOKE_EFFECT)
|
||||
if(breath.toxins > safe_toxins_mask)
|
||||
ratio = (breath.toxins/safe_toxins_mask) * 10
|
||||
if(breath[GAS_PLASMA] > safe_toxins_mask)
|
||||
ratio = (breath[GAS_PLASMA]/safe_toxins_mask) * 10
|
||||
else
|
||||
ratio = 0
|
||||
if(ratio)
|
||||
@@ -391,16 +391,14 @@
|
||||
else
|
||||
toxins_alert = 0
|
||||
|
||||
if(breath.trace_gases.len) // If there's some other shit in the air lets deal with it here.
|
||||
for(var/datum/gas/sleeping_agent/SA in breath.trace_gases)
|
||||
var/SA_pp = (SA.moles/breath.total_moles())*breath_pressure
|
||||
if(SA_pp > SA_para_min) // Enough to make us paralysed for a bit
|
||||
Paralyse(3) // 3 gives them one second to wake up and run away a bit!
|
||||
if(SA_pp > SA_sleep_min) // Enough to make us sleep as well
|
||||
sleeping = max(sleeping+2, 10)
|
||||
else if(SA_pp > 0.01) // There is sleeping gas in their lungs, but only a little, so give them a bit of a warning
|
||||
if(prob(20))
|
||||
spawn(0) emote(pick("giggle", "laugh"))
|
||||
var/SA_pp = breath.partial_pressure(GAS_SLEEPING)
|
||||
if(SA_pp > SA_para_min) // Enough to make us paralysed for a bit
|
||||
Paralyse(3) // 3 gives them one second to wake up and run away a bit!
|
||||
if(SA_pp > SA_sleep_min) // Enough to make us sleep as well
|
||||
sleeping = max(sleeping+2, 10)
|
||||
else if(SA_pp > 0.01) // There is sleeping gas in their lungs, but only a little, so give them a bit of a warning
|
||||
if(prob(20))
|
||||
spawn(0) emote(pick("giggle", "laugh"))
|
||||
|
||||
|
||||
if(breath.temperature > (T0C+66)) // Hot air hurts :(
|
||||
|
||||
@@ -596,10 +596,10 @@
|
||||
dat += "Air Pressure: [round(pressure,0.1)] kPa<br>"
|
||||
|
||||
if (total_moles)
|
||||
var/o2_level = environment.oxygen/total_moles
|
||||
var/n2_level = environment.nitrogen/total_moles
|
||||
var/co2_level = environment.carbon_dioxide/total_moles
|
||||
var/plasma_level = environment.toxins/total_moles
|
||||
var/o2_level = environment[GAS_OXYGEN]/total_moles
|
||||
var/n2_level = environment[GAS_NITROGEN]/total_moles
|
||||
var/co2_level = environment[GAS_CARBON]/total_moles
|
||||
var/plasma_level = environment[GAS_PLASMA]/total_moles
|
||||
var/unknown_level = 1-(o2_level+n2_level+co2_level+plasma_level)
|
||||
|
||||
dat += {"Nitrogen: [round(n2_level*100)]%<br>
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
if(!location)
|
||||
return
|
||||
var/datum/gas_mixture/environment = location.return_air()
|
||||
//testing("[type]/PROCESS() - plasma: [environment.toxins]")
|
||||
//testing("[type]/PROCESS() - plasma: [environment[GAS_PLASMA]]")
|
||||
var/meets_conditions=1
|
||||
for(var/gas_id in required_mols)
|
||||
if(environment.molar_density(gas_id) < required_mols[gas_id])
|
||||
|
||||
@@ -318,13 +318,9 @@
|
||||
|
||||
var/t = "<span class='notice'> Coordinates: [x],[y] \n</span>"
|
||||
|
||||
t += {"<span class='warning'> Temperature: [environment.temperature] \n</span>
|
||||
<span class='notice'> Nitrogen: [environment.nitrogen] \n</span>
|
||||
<span class='notice'> Oxygen: [environment.oxygen] \n</span>
|
||||
<span class='notice'> Plasma : [environment.toxins] \n</span>
|
||||
<span class='notice'> Carbon Dioxide: [environment.carbon_dioxide] \n</span>"}
|
||||
for(var/datum/gas/trace_gas in environment.trace_gases)
|
||||
to_chat(usr, "<span class='notice'> [trace_gas.type]: [trace_gas.moles] \n</span>")
|
||||
t += "<span class='warning'> Temperature: [environment.temperature] \n</span>"
|
||||
for(var/g in environment.gas)
|
||||
to_chat(usr, "<span class='notice'> [XGM.name[g]]: [environment.gas[g]] \n</span>")
|
||||
|
||||
usr.show_message(t, 1)
|
||||
|
||||
|
||||
@@ -9,21 +9,21 @@
|
||||
gasses = list()
|
||||
var/list/intake_settings=list(
|
||||
"oxygen" = list(
|
||||
new /datum/lung_gas/metabolizable("oxygen", min_pp=16, max_pp=280),
|
||||
new /datum/lung_gas/waste("carbon_dioxide", max_pp=10),
|
||||
new /datum/lung_gas/toxic("toxins", max_pp=5, max_pp_mask=0, reagent_id="plasma", reagent_mult=0.1),
|
||||
new /datum/lung_gas/sleep_agent("/datum/gas/sleeping_agent", trace_gas=1, min_giggle_pp=1, min_para_pp=5, min_sleep_pp=10),
|
||||
new /datum/lung_gas/metabolizable(GAS_OXYGEN, min_pp=16, max_pp=280),
|
||||
new /datum/lung_gas/waste(GAS_CARBON, max_pp=10),
|
||||
new /datum/lung_gas/toxic(GAS_PLASMA, max_pp=5, max_pp_mask=0, reagent_id="plasma", reagent_mult=0.1),
|
||||
new /datum/lung_gas/sleep_agent(GAS_SLEEPING, min_giggle_pp=1, min_para_pp=5, min_sleep_pp=10),
|
||||
),
|
||||
"nitrogen" = list(
|
||||
new /datum/lung_gas/metabolizable("nitrogen", min_pp=16, max_pp=280),
|
||||
new /datum/lung_gas/waste("carbon_dioxide", max_pp=10), // I guess? Ideally it'd be some sort of nitrogen compound. Maybe N2O?
|
||||
new /datum/lung_gas/toxic("oxygen", max_pp=0.5, max_pp_mask=0, reagent_id="oxygen", reagent_mult=0.1),
|
||||
new /datum/lung_gas/sleep_agent("/datum/gas/sleeping_agent", trace_gas=1, min_giggle_pp=1, min_para_pp=5, min_sleep_pp=10),
|
||||
new /datum/lung_gas/metabolizable(GAS_NITROGEN, min_pp=16, max_pp=280),
|
||||
new /datum/lung_gas/waste(GAS_CARBON, max_pp=10), // I guess? Ideally it'd be some sort of nitrogen compound. Maybe N2O?
|
||||
new /datum/lung_gas/toxic(GAS_OXYGEN, max_pp=0.5, max_pp_mask=0, reagent_id="oxygen", reagent_mult=0.1),
|
||||
new /datum/lung_gas/sleep_agent(GAS_SLEEPING, min_giggle_pp=1, min_para_pp=5, min_sleep_pp=10),
|
||||
),
|
||||
"plasma" = list(
|
||||
new /datum/lung_gas/metabolizable("toxins", min_pp=16, max_pp=280),
|
||||
new /datum/lung_gas/waste("oxygen", max_pp=10),
|
||||
new /datum/lung_gas/sleep_agent("/datum/gas/sleeping_agent", trace_gas=1, min_giggle_pp=1, min_para_pp=5, min_sleep_pp=10),
|
||||
new /datum/lung_gas/metabolizable(GAS_PLASMA, min_pp=16, max_pp=280),
|
||||
new /datum/lung_gas/waste(GAS_OXYGEN, max_pp=10),
|
||||
new /datum/lung_gas/sleep_agent(GAS_SLEEPING, min_giggle_pp=1, min_para_pp=5, min_sleep_pp=10),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
|
||||
// DEFAULTS FOR HUMAN LUNGS:
|
||||
var/list/datum/lung_gas/gasses = list(
|
||||
new /datum/lung_gas/metabolizable("oxygen", min_pp=16, max_pp=140),
|
||||
new /datum/lung_gas/waste("carbon_dioxide", max_pp=10),
|
||||
new /datum/lung_gas/toxic("toxins", max_pp=0.5, max_pp_mask=5, reagent_id=PLASMA, reagent_mult=0.1),
|
||||
new /datum/lung_gas/sleep_agent("/datum/gas/sleeping_agent", trace_gas=1, min_giggle_pp=0.15, min_para_pp=1, min_sleep_pp=5),
|
||||
new /datum/lung_gas/metabolizable(GAS_OXYGEN, min_pp=16, max_pp=140),
|
||||
new /datum/lung_gas/waste(GAS_CARBON, max_pp=10),
|
||||
new /datum/lung_gas/toxic(GAS_PLASMA, max_pp=0.5, max_pp_mask=5, reagent_id=PLASMA, reagent_mult=0.1),
|
||||
new /datum/lung_gas/sleep_agent(GAS_SLEEPING, min_giggle_pp=0.15, min_para_pp=1, min_sleep_pp=5),
|
||||
)
|
||||
|
||||
var/inhale_volume = BREATH_VOLUME
|
||||
@@ -113,10 +113,10 @@
|
||||
removed_type = /obj/item/organ/internal/lungs/vox
|
||||
|
||||
gasses = list(
|
||||
new /datum/lung_gas/metabolizable("nitrogen", min_pp=16, max_pp=140),
|
||||
new /datum/lung_gas/waste("carbon_dioxide", max_pp=10), // I guess? Ideally it'd be some sort of nitrogen compound. Maybe N2O?
|
||||
new /datum/lung_gas/metabolizable(GAS_NITROGEN, min_pp=16, max_pp=140),
|
||||
new /datum/lung_gas/waste(GAS_CARBON, max_pp=10), // I guess? Ideally it'd be some sort of nitrogen compound. Maybe N2O?
|
||||
new /datum/lung_gas/toxic(OXYGEN, max_pp=0.5, max_pp_mask=0, reagent_id=OXYGEN, reagent_mult=0.1),
|
||||
new /datum/lung_gas/sleep_agent("/datum/gas/sleeping_agent", trace_gas=1, min_giggle_pp=0.15, min_para_pp=1, min_sleep_pp=5),
|
||||
new /datum/lung_gas/sleep_agent(GAS_SLEEPING, min_giggle_pp=0.15, min_para_pp=1, min_sleep_pp=5),
|
||||
)
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
removed_type = /obj/item/organ/internal/lungs/plasmaman
|
||||
|
||||
gasses = list(
|
||||
new /datum/lung_gas/metabolizable("toxins", min_pp=16, max_pp=140),
|
||||
new /datum/lung_gas/waste("carbon_dioxide", max_pp=10),
|
||||
new /datum/lung_gas/sleep_agent("/datum/gas/sleeping_agent", trace_gas=1, min_giggle_pp=0.15, min_para_pp=1, min_sleep_pp=5),
|
||||
new /datum/lung_gas/metabolizable(GAS_PLASMA, min_pp=16, max_pp=140),
|
||||
new /datum/lung_gas/waste(GAS_CARBON, max_pp=10),
|
||||
new /datum/lung_gas/sleep_agent(GAS_SLEEPING, min_giggle_pp=0.15, min_para_pp=1, min_sleep_pp=5),
|
||||
)
|
||||
|
||||
@@ -6,58 +6,29 @@
|
||||
/datum/lung_gas
|
||||
var/datum/organ/internal/lungs/lungs = null
|
||||
var/id=""
|
||||
var/is_trace = 0
|
||||
var/datum/gas/gas = null
|
||||
var/datum/gas_mixture/breath = null
|
||||
|
||||
/datum/lung_gas/New(var/gas_id, var/trace_gas=0)
|
||||
/datum/lung_gas/New(var/gas_id) //If you came here looking for what the second arg is, it was removed and no longer matters
|
||||
src.id = gas_id
|
||||
src.is_trace = trace_gas
|
||||
|
||||
/datum/lung_gas/proc/get_pp()
|
||||
var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/lungs.inhale_volume
|
||||
if(!is_trace)
|
||||
return (breath.vars[id]/breath.total_moles())*breath_pressure
|
||||
else
|
||||
if(gas)
|
||||
return (gas.moles/breath.total_moles())*breath_pressure
|
||||
return 0
|
||||
return breath.partial_pressure(id)
|
||||
|
||||
/datum/lung_gas/proc/get_moles()
|
||||
if(!is_trace)
|
||||
return breath.vars[id]
|
||||
else
|
||||
if(gas)
|
||||
return gas.moles
|
||||
return 0
|
||||
return breath[id]
|
||||
|
||||
/datum/lung_gas/proc/add_exhaled(var/moles)
|
||||
lungs.exhale_moles += moles
|
||||
|
||||
/datum/lung_gas/proc/set_moles(var/moles)
|
||||
if(!is_trace)
|
||||
breath.vars[id]=moles
|
||||
else
|
||||
if(gas)
|
||||
gas.moles = moles
|
||||
breath[id] = moles
|
||||
|
||||
/datum/lung_gas/proc/add_moles(var/moles)
|
||||
if(!is_trace)
|
||||
breath.vars[id]+=moles
|
||||
else
|
||||
if(gas)
|
||||
gas.moles += moles
|
||||
breath[id] += moles
|
||||
|
||||
/datum/lung_gas/proc/set_context(var/datum/organ/internal/lungs/L, var/datum/gas_mixture/breath, var/mob/living/carbon/human/H)
|
||||
src.lungs=L
|
||||
src.breath=breath
|
||||
if(is_trace)
|
||||
// Find the trace gas we need to mess with
|
||||
if(breath.trace_gases.len) // If there's some other shit in the air lets deal with it here.
|
||||
for(var/datum/gas/G in breath.trace_gases)
|
||||
if("[G.type]" != id)
|
||||
continue
|
||||
gas = G
|
||||
src.lungs = L
|
||||
src.breath = breath
|
||||
|
||||
/datum/lung_gas/proc/handle_inhale()
|
||||
return
|
||||
@@ -76,8 +47,8 @@
|
||||
var/min_pp=0
|
||||
var/max_pp=999
|
||||
|
||||
/datum/lung_gas/metabolizable/New(var/gas_id, var/trace_gas=0, var/min_pp=0, var/max_pp=999)
|
||||
..(gas_id,trace_gas)
|
||||
/datum/lung_gas/metabolizable/New(var/gas_id, var/min_pp=0, var/max_pp=999)
|
||||
..(gas_id)
|
||||
src.min_pp = min_pp
|
||||
src.max_pp = max_pp
|
||||
|
||||
@@ -113,8 +84,8 @@
|
||||
var/max_pp=0 // Maximum atmospheric partial pressure before you start getting paralyzed
|
||||
// NOTE: If set to 0, will not give poisoning effects.
|
||||
|
||||
/datum/lung_gas/waste/New(var/gas_id, var/trace_gas=0, var/max_pp=0)
|
||||
..(gas_id,trace_gas)
|
||||
/datum/lung_gas/waste/New(var/gas_id, var/max_pp=0)
|
||||
..(gas_id)
|
||||
src.max_pp = max_pp
|
||||
|
||||
/datum/lung_gas/waste/handle_inhale()
|
||||
@@ -156,8 +127,8 @@
|
||||
var/reagent_id = PLASMA // What reagent to add
|
||||
var/reagent_mult = 10
|
||||
|
||||
/datum/lung_gas/toxic/New(var/gas_id, var/trace_gas=0, var/max_pp=0, var/max_pp_mask=0, var/reagent_id=PLASMA, var/reagent_mult=10)
|
||||
..(gas_id,trace_gas)
|
||||
/datum/lung_gas/toxic/New(var/gas_id, var/max_pp=0, var/max_pp_mask=0, var/reagent_id=PLASMA, var/reagent_mult=10)
|
||||
..(gas_id)
|
||||
src.max_pp = max_pp
|
||||
src.max_pp_mask = max_pp_mask
|
||||
src.reagent_id = reagent_id
|
||||
@@ -197,8 +168,8 @@
|
||||
var/min_para_pp = 1 // Paralysis
|
||||
var/min_sleep_pp = 5 // Sleep
|
||||
|
||||
/datum/lung_gas/sleep_agent/New(var/gas_id, var/trace_gas=0, var/min_giggle_pp=0, var/min_sleep_pp=0, var/min_para_pp=0)
|
||||
..(gas_id,trace_gas)
|
||||
/datum/lung_gas/sleep_agent/New(var/gas_id, var/min_giggle_pp=0, var/min_sleep_pp=0, var/min_para_pp=0)
|
||||
..(gas_id)
|
||||
src.min_para_pp=min_para_pp
|
||||
src.min_giggle_pp=min_giggle_pp
|
||||
src.min_para_pp=min_para_pp
|
||||
|
||||
@@ -10,24 +10,12 @@
|
||||
var/board_path = "/obj/item/weapon/circuitboard/pacman2"
|
||||
var/emagged = 0
|
||||
var/heat = 0
|
||||
/*
|
||||
/obj/machinery/power/port_gen/pacman2/process()
|
||||
if(P)
|
||||
if(P.air_contents.toxins <= 0)
|
||||
P.air_contents.toxins = 0
|
||||
eject()
|
||||
else
|
||||
P.air_contents.toxins -= 0.001
|
||||
return
|
||||
*/
|
||||
|
||||
/obj/machinery/power/port_gen/pacman2/HasFuel()
|
||||
if(P.air_contents.toxins >= 0.1)
|
||||
return 1
|
||||
return 0
|
||||
return (P.air_contents[GAS_PLASMA] >= 0.1)
|
||||
|
||||
/obj/machinery/power/port_gen/pacman2/UseFuel()
|
||||
P.air_contents.toxins -= 0.01
|
||||
P.air_contents.adjust_gas(GAS_PLASMA, -0.01)
|
||||
return
|
||||
|
||||
/obj/machinery/power/port_gen/pacman2/New()
|
||||
@@ -59,7 +47,7 @@
|
||||
if(crit_fail)
|
||||
to_chat(user, "<span class='warning'>The generator seems to have broken down.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='info'>The generator has [P.air_contents.toxins] units of fuel left, producing [power_gen] per cycle.</span>")
|
||||
to_chat(user, "<span class='info'>The generator has [P.air_contents[GAS_PLASMA]] units of fuel left, producing [power_gen] per cycle.</span>")
|
||||
|
||||
/obj/machinery/power/port_gen/pacman2/handleInactive()
|
||||
heat -= 2
|
||||
@@ -145,7 +133,7 @@
|
||||
else
|
||||
dat += text("Generator: <A href='?src=\ref[src];action=enable'>Off</A><br>")
|
||||
if(P)
|
||||
dat += text("Currently loaded plasma tank: [P.air_contents.toxins]<br>")
|
||||
dat += text("Currently loaded plasma tank: [P.air_contents[GAS_PLASMA]]<br>")
|
||||
else
|
||||
dat += text("No plasma tank currently loaded.<br>")
|
||||
dat += text("Power output: <A href='?src=\ref[src];action=lower_power'>-</A> [power_gen * power_output] <A href='?src=\ref[src];action=higher_power'>+</A><br>")
|
||||
|
||||
@@ -30,15 +30,13 @@ var/global/list/rad_collectors = list()
|
||||
|
||||
/obj/machinery/power/rad_collector/process()
|
||||
if (P)
|
||||
if (P.air_contents.toxins <= 0)
|
||||
if (P.air_contents[GAS_PLASMA] <= 0)
|
||||
investigation_log(I_SINGULO,"<font color='red'>out of fuel</font>.")
|
||||
P.air_contents.toxins = 0
|
||||
eject()
|
||||
else if(!active)
|
||||
return
|
||||
else
|
||||
P.air_contents.toxins -= (0.001 * drain_ratio)
|
||||
P.air_contents.update_values()
|
||||
P.air_contents.adjust_gas(GAS_PLASMA, -0.001 * drain_ratio)
|
||||
|
||||
/obj/machinery/power/rad_collector/attack_hand(mob/user as mob)
|
||||
if(anchored)
|
||||
@@ -46,7 +44,7 @@ var/global/list/rad_collectors = list()
|
||||
toggle_power()
|
||||
user.visible_message("<span class='notice'>[user] turns the [src] [active? "on":"off"].</span>", \
|
||||
"<span class='notice'>You turn the [src] [active? "on":"off"].</span>")
|
||||
investigation_log(I_SINGULO,"turned [active?"<font color='green'>on</font>":"<font color='red'>off</font>"] by [user.key]. [P?"Fuel: [round(P.air_contents.toxins/0.29)]%":"<font color='red'>It is empty</font>"].")
|
||||
investigation_log(I_SINGULO,"turned [active?"<font color='green'>on</font>":"<font color='red'>off</font>"] by [user.key]. [P?"Fuel: [round(P.air_contents[GAS_PLASMA]/0.29)]%":"<font color='red'>It is empty</font>"].")
|
||||
return
|
||||
else
|
||||
to_chat(user, "<span class='warning'>The controls are locked!</span>")
|
||||
@@ -133,7 +131,7 @@ var/global/list/rad_collectors = list()
|
||||
//Pulse_strength is multiplied by around 70 (less or more depending on the air tank setup) to get the amount of watts generated
|
||||
/obj/machinery/power/rad_collector/proc/receive_pulse(const/pulse_strength)
|
||||
if (P && active)
|
||||
var/power_produced = P.air_contents.toxins * pulse_strength * 3.5 // original was 20, nerfed to 2 now 3.5 should get you about 500kw
|
||||
var/power_produced = P.air_contents[GAS_PLASMA] * pulse_strength * 3.5 // original was 20, nerfed to 2 now 3.5 should get you about 500kw
|
||||
add_avail(power_produced)
|
||||
last_power = power_produced
|
||||
|
||||
@@ -174,16 +172,14 @@ var/global/list/rad_collectors = list()
|
||||
if(P)
|
||||
if(!active)
|
||||
return
|
||||
if(P.air_contents.toxins <= 0)
|
||||
if(P.air_contents[GAS_PLASMA] <= 0)
|
||||
connected_module.occupant_message("<span class='warning>Warning: Radiation collector array tank empty.</span>")
|
||||
P.air_contents.toxins = 0
|
||||
toggle_power()
|
||||
connected_module.update_equip_info()
|
||||
else
|
||||
P.air_contents.toxins -= (0.001 * drain_ratio)
|
||||
P.air_contents.update_values()
|
||||
P.air_contents.adjust_gas(GAS_PLASMA, -0.001 * drain_ratio)
|
||||
|
||||
/obj/machinery/power/rad_collector/mech/receive_pulse(const/pulse_strength)
|
||||
if(P && active)
|
||||
var/power_produced = (P.air_contents.toxins * pulse_strength * 3.5)/100 // original was 20, nerfed to 2 now 3.5 should get you about 500kw
|
||||
var/power_produced = (P.air_contents[GAS_PLASMA] * pulse_strength * 3.5)/100 // original was 20, nerfed to 2 now 3.5 should get you about 500kw
|
||||
connected_module.chassis.cell.charge = min(connected_module.chassis.cell.charge + power_produced, connected_module.chassis.cell.maxcharge)
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
var/pressure = tank_gas.return_pressure()
|
||||
var/total_moles = tank_gas.total_moles()
|
||||
if(total_moles)
|
||||
var/o2_concentration = tank_gas.oxygen/total_moles
|
||||
var/o2_concentration = tank_gas[GAS_OXYGEN]/total_moles
|
||||
if(o2_concentration > 0.01)
|
||||
B.has_O2_in_mix = 1
|
||||
else
|
||||
@@ -253,7 +253,6 @@
|
||||
..()
|
||||
ptank = new /obj/item/weapon/tank/plasma(src)
|
||||
var/datum/gas_mixture/gas_tank = ptank.air_contents
|
||||
gas_tank.toxins = 29.1
|
||||
gas_tank.update_values()
|
||||
gas_tank.adjust_gas(GAS_PLASMA, 29.1)
|
||||
update_icon()
|
||||
return
|
||||
return
|
||||
|
||||
@@ -610,21 +610,16 @@
|
||||
|
||||
/obj/item/projectile/bullet/fire_plume/proc/create_puff()
|
||||
if(gas_jet)
|
||||
if(gas_jet.total_moles())
|
||||
var/total_moles = gas_jet.total_moles()
|
||||
var/o2_concentration = gas_jet.oxygen/total_moles
|
||||
var/n2_concentration = gas_jet.nitrogen/total_moles
|
||||
var/co2_concentration = gas_jet.carbon_dioxide/total_moles
|
||||
var/plasma_concentration = gas_jet.toxins/total_moles
|
||||
var/n2o_concentration = null
|
||||
var/total_moles = gas_jet.total_moles
|
||||
if(total_moles)
|
||||
var/o2_concentration = gas_jet[GAS_OXYGEN] / total_moles
|
||||
var/n2_concentration = gas_jet[GAS_NITROGEN] / total_moles
|
||||
var/co2_concentration = gas_jet[GAS_CARBON] / total_moles
|
||||
var/plasma_concentration = gas_jet[GAS_PLASMA] / total_moles
|
||||
var/n2o_concentration = gas_jet[GAS_SLEEPING] / total_moles
|
||||
|
||||
var/datum/gas_mixture/gas_dispersal = gas_jet.remove(original_total_moles/10)
|
||||
|
||||
if(gas_jet.trace_gases.len)
|
||||
for(var/datum/gas/G in gas_jet.trace_gases)
|
||||
if(istype(G, /datum/gas/sleeping_agent))
|
||||
n2o_concentration = G.moles/total_moles
|
||||
|
||||
var/gas_type = null
|
||||
|
||||
if(o2_concentration > 0.5)
|
||||
@@ -644,9 +639,9 @@
|
||||
if(!gas_jet)
|
||||
return
|
||||
|
||||
if(gas_jet.total_moles())
|
||||
var/jet_total_moles = gas_jet.total_moles()
|
||||
var/toxin_concentration = gas_jet.toxins/jet_total_moles
|
||||
var/jet_total_moles = gas_jet.total_moles
|
||||
if(jet_total_moles)
|
||||
var/toxin_concentration = gas_jet[GAS_PLASMA] / jet_total_moles
|
||||
if(!(toxin_concentration > 0.01))
|
||||
create_puff()
|
||||
return
|
||||
@@ -656,9 +651,9 @@
|
||||
if(!has_O2_in_mix && T)
|
||||
var/turf/location = get_turf(src)
|
||||
var/datum/gas_mixture/turf_gases = location.return_air()
|
||||
var/turf_total_moles = turf_gases.total_moles()
|
||||
var/turf_total_moles = turf_gases.total_moles
|
||||
if(turf_total_moles)
|
||||
var/o2_concentration = turf_gases.oxygen/turf_total_moles
|
||||
var/o2_concentration = turf_gases[GAS_OXYGEN] / turf_total_moles
|
||||
if(!(o2_concentration > 0.01))
|
||||
create_puff()
|
||||
return
|
||||
|
||||
@@ -2268,28 +2268,6 @@
|
||||
holder.remove_reagent("inaprovaline", 2 * REM)
|
||||
M.adjustToxLoss(3 * REM)
|
||||
|
||||
/*
|
||||
/datum/reagent/plasma/reaction_obj(var/obj/O, var/volume)
|
||||
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
var/turf/T = get_turf(O)
|
||||
self.reaction_turf(T, volume)
|
||||
|
||||
/datum/reagent/plasma/reaction_turf(var/turf/simulated/T, var/volume)
|
||||
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
var/datum/gas_mixture/napalm = new
|
||||
var/datum/gas/volatile_fuel/fuel = new
|
||||
fuel.moles = 5
|
||||
napalm.trace_gases += fuel
|
||||
T.assume_air(napalm)
|
||||
|
||||
*/
|
||||
|
||||
/datum/reagent/leporazine
|
||||
name = "Leporazine"
|
||||
id = LEPORAZINE
|
||||
|
||||
@@ -548,10 +548,8 @@
|
||||
var/turf/location = get_turf(holder.my_atom.loc)
|
||||
|
||||
for(var/turf/simulated/floor/target_tile in range(0,location))
|
||||
var/datum/gas_mixture/napalm = new
|
||||
var/datum/gas/volatile_fuel/fuel = new
|
||||
fuel.moles = created_volume
|
||||
napalm.trace_gases += fuel
|
||||
var/datum/gas_mixture/napalm = new()
|
||||
napalm.adjust_gas(GAS_VOLATILE, created_volume, FALSE)
|
||||
napalm.temperature = 400+T0C
|
||||
napalm.update_values()
|
||||
target_tile.assume_air(napalm)
|
||||
@@ -676,7 +674,7 @@
|
||||
required_reagents = list(VAPORSALT = 1, OXYGEN = 1)
|
||||
|
||||
/datum/chemical_reaction/vaporize/oxygen/disperse(turf/T,datum/gas_mixture/G,var/vol)
|
||||
G.adjust(vol,0,0,0)
|
||||
G.adjust_gas(GAS_OXYGEN, vol)
|
||||
..()
|
||||
|
||||
/datum/chemical_reaction/vaporize/nitrogen
|
||||
@@ -685,7 +683,7 @@
|
||||
required_reagents = list(VAPORSALT = 1, NITROGEN = 1)
|
||||
|
||||
/datum/chemical_reaction/vaporize/nitrogen/disperse(turf/T,datum/gas_mixture/G,var/vol)
|
||||
G.adjust(0,0,vol,0)
|
||||
G.adjust_gas(GAS_NITROGEN, vol)
|
||||
..()
|
||||
|
||||
/datum/chemical_reaction/vaporize/plasma
|
||||
@@ -695,7 +693,7 @@
|
||||
required_reagents = list(VAPORSALT = 1, PLASMA = 1)
|
||||
|
||||
/datum/chemical_reaction/vaporize/plasma/disperse(turf/T,datum/gas_mixture/G,var/vol)
|
||||
G.adjust(0,0,0,vol)
|
||||
G.adjust_gas(GAS_PLASMA, vol)
|
||||
..()
|
||||
|
||||
/datum/chemical_reaction/solidification
|
||||
@@ -1585,8 +1583,8 @@
|
||||
for(var/turf/simulated/floor/target_tile in range(0, location))
|
||||
|
||||
var/datum/gas_mixture/napalm = new
|
||||
napalm.toxins = 25
|
||||
napalm.temperature = 1400
|
||||
napalm.adjust_gas(GAS_PLASMA, 25)
|
||||
target_tile.assume_air(napalm)
|
||||
spawn(0)
|
||||
target_tile.hotspot_expose(700, 400,surfaces = 1)
|
||||
|
||||
@@ -14,17 +14,12 @@
|
||||
/datum/artifact_effect/gassleeping/DoEffectTouch(var/mob/user)
|
||||
if(holder)
|
||||
var/datum/gas_mixture/env = holder.loc.return_air()
|
||||
if(env)
|
||||
var/datum/gas/sleeping_agent/trace_gas = new
|
||||
trace_gas.moles = rand(2,15)
|
||||
env.adjust(traces = list(trace_gas))
|
||||
env?.adjust_gas(GAS_SLEEPING, rand(2, 15))
|
||||
|
||||
|
||||
/datum/artifact_effect/gassleeping/DoEffectAura()
|
||||
if(holder)
|
||||
var/datum/gas_mixture/env = holder.loc.return_air()
|
||||
if(env && env.pressure < max_pressure)
|
||||
var/datum/gas/sleeping_agent/trace_gas = new
|
||||
trace_gas.moles = pick(0, 0, 0.1, rand())
|
||||
env.adjust(traces = list(trace_gas))
|
||||
env.adjust_gas(GAS_SLEEPING, pick(0, 0, 0.1, rand()))
|
||||
|
||||
|
||||
@@ -128,7 +128,9 @@
|
||||
reagents.remove_reagent(possible_fuel, consumption_rate)
|
||||
if(held_container)
|
||||
held_container.reagents.heating(thermal_energy_transfer, max_temperature)
|
||||
G.adjust(o2 = -o2_consumption, co2 = -co2_consumption)
|
||||
G.adjust_multi(
|
||||
GAS_OXYGEN, -o2_consumption,
|
||||
GAS_CARBON, -co2_consumption)
|
||||
if(prob(unsafety) && T)
|
||||
T.hotspot_expose(max_temperature, 5)
|
||||
break
|
||||
|
||||
@@ -245,7 +245,7 @@
|
||||
damage = max( damage + ( (removed.temperature - 800) / 150 ) , 0 )
|
||||
//Ok, 100% oxygen atmosphere = best reaction
|
||||
//Maxes out at 100% oxygen pressure
|
||||
oxygen = Clamp((removed.oxygen - removed.nitrogen*NITROGEN_RETARDATION_FACTOR) / MOLES_CELLSTANDARD, 0, 1) //0 unless O2>80%. At 99%, ~0.6
|
||||
oxygen = Clamp((removed[GAS_OXYGEN] - removed[GAS_NITROGEN] * NITROGEN_RETARDATION_FACTOR) / MOLES_CELLSTANDARD, 0, 1) //0 unless O2>80%. At 99%, ~0.6
|
||||
|
||||
var/temp_factor = 100
|
||||
|
||||
@@ -278,11 +278,9 @@
|
||||
removed.temperature = max(0, min(removed.temperature, 2500))
|
||||
|
||||
//Calculate how much gas to release
|
||||
removed.toxins += max(device_energy / PLASMA_RELEASE_MODIFIER, 0)
|
||||
|
||||
removed.oxygen += max((device_energy + removed.temperature - T0C) / OXYGEN_RELEASE_MODIFIER, 0)
|
||||
|
||||
removed.update_values()
|
||||
removed.adjust_multi(
|
||||
GAS_PLASMA, max(device_energy / PLASMA_RELEASE_MODIFIER, 0),
|
||||
GAS_OXYGEN, max((device_energy + removed.temperature - T0C) / OXYGEN_RELEASE_MODIFIER, 0))
|
||||
|
||||
env.merge(removed)
|
||||
|
||||
|
||||
@@ -1378,12 +1378,12 @@ datum/disease2/effect/lubefoot/deactivate(var/mob/living/carbon/mob)
|
||||
return
|
||||
var/datum/gas_mixture/GM = new
|
||||
if(prob(10))
|
||||
GM.toxins += 100
|
||||
GM.adjust_gas(GAS_PLASMA, 100)
|
||||
//GM.temperature = 1500+T0C //should be enough to start a fire
|
||||
to_chat(mob, "<span class='warning'>You exhale a large plume of toxic gas!</span>")
|
||||
else
|
||||
GM.toxins += 10
|
||||
GM.temperature = istype(T) ? T.air.temperature : T20C
|
||||
GM.adjust_gas(GAS_PLASMA, 100)
|
||||
to_chat(mob, "<span class = 'warning'> A toxic gas emanates from your pores!</span>")
|
||||
T.assume_air(GM)
|
||||
return
|
||||
|
||||
@@ -591,7 +591,7 @@
|
||||
|
||||
/obj/machinery/portable_atmospherics/canister/old/plasma/New(loc)
|
||||
..(loc)
|
||||
air_contents.adjust(tx = (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature))
|
||||
air_contents.adjust_gas(GAS_PLASMA, (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature))
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/portable_atmospherics/canister/old/oxygen
|
||||
@@ -602,7 +602,7 @@
|
||||
|
||||
/obj/machinery/portable_atmospherics/canister/old/oxygen/New(loc)
|
||||
..(loc)
|
||||
air_contents.adjust((maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature))
|
||||
air_contents.adjust_gas(GAS_OXYGEN, (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature))
|
||||
update_icon()
|
||||
|
||||
/mob/living/simple_animal/hostile/retaliate/malf_drone/vault
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "__DEFINES\disease2.dm"
|
||||
#include "__DEFINES\error_hander.dm"
|
||||
#include "__DEFINES\game.dm"
|
||||
#include "__DEFINES\gases.dm"
|
||||
#include "__DEFINES\global.dm"
|
||||
#include "__DEFINES\human.dm"
|
||||
#include "__DEFINES\hydroponics.dm"
|
||||
@@ -2400,6 +2401,7 @@
|
||||
#include "code\ZAS\NewSettings.dm"
|
||||
#include "code\ZAS\Plasma.dm"
|
||||
#include "code\ZAS\Turf.dm"
|
||||
#include "code\ZAS\XGM.dm"
|
||||
#include "code\ZAS\Zone.dm"
|
||||
#include "goon\code\datums\browserOutput.dm"
|
||||
#include "goon\code\obj\machinery\bot\chefbot.dm"
|
||||
|
||||
Reference in New Issue
Block a user