From 8f2d65c44665802bac2630bdf028d8c98c9d9efc Mon Sep 17 00:00:00 2001 From: as334 Date: Sat, 12 Dec 2015 12:32:28 -0500 Subject: [PATCH 1/2] Adds a new gas reaction, plasmic fusion. --- code/__DEFINES/atmospherics.dm | 6 +++++- code/datums/gas_mixture.dm | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm index 75d1ab0b28c..0a8c4d55779 100644 --- a/code/__DEFINES/atmospherics.dm +++ b/code/__DEFINES/atmospherics.dm @@ -63,7 +63,11 @@ #define MIN_PLASMA_DAMAGE 1 #define MAX_PLASMA_DAMAGE 10 #define MOLES_PLASMA_VISIBLE 0.5 //Moles in a standard cell after which plasma is visible - + //Plasma fusion properties +#define PLASMA_BINDING_ENERGY 300000 +#define MAX_CARBON_EFFICENCY 8 +#define PLASMA_FUSED_COEFFICENT 0.08 +#define CARBON_CATALYST_COEFFICENT 0.01 // Pressure limits. #define HAZARD_HIGH_PRESSURE 550 //This determins at what pressure the ultra-high pressure red icon is displayed. (This one is set as a constant) #define WARNING_HIGH_PRESSURE 325 //This determins when the orange pressure icon is displayed (it is 0.7 * HAZARD_HIGH_PRESSURE) diff --git a/code/datums/gas_mixture.dm b/code/datums/gas_mixture.dm index de566dec464..2876472972b 100644 --- a/code/datums/gas_mixture.dm +++ b/code/datums/gas_mixture.dm @@ -120,6 +120,32 @@ What are the archived variables for? temperature -= (reaction_rate*20000)/heat_capacity() reacting = 1 + if(thermal_energy > PLASMA_BINDING_ENERGY) + if(toxins > MINIMUM_HEAT_CAPACITY && carbon_dioxide > MINIMUM_HEAT_CAPACITY) + //world << "pre [temperature, [toxins], [carbon_dioxide] + var/old_heat_capacity = heat_capacity() + var/carbon_efficency = min(toxins/carbon_dioxide,MAX_CARBON_EFFICENCY) + var/reaction_energy = thermal_energy() + var/moles_impurities = total_moles()-(plasma+carbon_dioxide) + + var/plasma_fused = (PLASMA_FUSED_COEFFICENT*carbon_effiency)*(temperature/PLASMA_BINDING_ENERGY) + var/carbon_catalyzed = (CARBON_CATALYST_COEFFICENT*carbon_efficency)*(temperature/PLASMA_BINDING_ENERGY) + var/oxygen_added+=carbon_catalyzed + var/nitrogen_added+=plasma_fused-oxygen_added + + reaction_energy += ((carbon_efficency*plasma)/((moles_impurities/carbon_efficency)+2)*10)+((plasma_fused/(moles_impurities/carbon_efficency))*PLASMA_BINDING_ENERGY) + plasma-=plasma_fused + carbon-=carbon_catalyzed + oxygen+=oxygen_added + nitrogen+=nitrogen_added + if(reaction_energy > 0) + reacting = 1 + var/new_heat_capacity = heat_capacity() + if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) + temperature = (temperature*old_heat_capacity + reaction_energy)/new_heat_capacity + //world << "post [temperature], [toxins], [carbon_dioxide] + + fuel_burnt = 0 if(temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST) From 80f4b0b1b0e441014df60751c01a31bf26c6378c Mon Sep 17 00:00:00 2001 From: as334 Date: Sat, 12 Dec 2015 15:07:42 -0500 Subject: [PATCH 2/2] Fixes my numerous errors(you saw nothing) --- code/datums/gas_mixture.dm | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/code/datums/gas_mixture.dm b/code/datums/gas_mixture.dm index 2876472972b..416fd0ded97 100644 --- a/code/datums/gas_mixture.dm +++ b/code/datums/gas_mixture.dm @@ -120,30 +120,29 @@ What are the archived variables for? temperature -= (reaction_rate*20000)/heat_capacity() reacting = 1 - if(thermal_energy > PLASMA_BINDING_ENERGY) - if(toxins > MINIMUM_HEAT_CAPACITY && carbon_dioxide > MINIMUM_HEAT_CAPACITY) - //world << "pre [temperature, [toxins], [carbon_dioxide] - var/old_heat_capacity = heat_capacity() - var/carbon_efficency = min(toxins/carbon_dioxide,MAX_CARBON_EFFICENCY) - var/reaction_energy = thermal_energy() - var/moles_impurities = total_moles()-(plasma+carbon_dioxide) + if(thermal_energy() > PLASMA_BINDING_ENERGY) + if(toxins > MINIMUM_HEAT_CAPACITY && carbon_dioxide > MINIMUM_HEAT_CAPACITY) + //world << "pre [temperature, [toxins], [carbon_dioxide] + var/old_heat_capacity = heat_capacity() + var/carbon_efficency = min(toxins/carbon_dioxide,MAX_CARBON_EFFICENCY) + var/reaction_energy = thermal_energy() + var/moles_impurities = total_moles()-(toxins+carbon_dioxide) + var/plasma_fused = (PLASMA_FUSED_COEFFICENT*carbon_efficency)*(temperature/PLASMA_BINDING_ENERGY) + var/carbon_catalyzed = (CARBON_CATALYST_COEFFICENT*carbon_efficency)*(temperature/PLASMA_BINDING_ENERGY) + var/oxygen_added = carbon_catalyzed + var/nitrogen_added = plasma_fused-oxygen_added - var/plasma_fused = (PLASMA_FUSED_COEFFICENT*carbon_effiency)*(temperature/PLASMA_BINDING_ENERGY) - var/carbon_catalyzed = (CARBON_CATALYST_COEFFICENT*carbon_efficency)*(temperature/PLASMA_BINDING_ENERGY) - var/oxygen_added+=carbon_catalyzed - var/nitrogen_added+=plasma_fused-oxygen_added - - reaction_energy += ((carbon_efficency*plasma)/((moles_impurities/carbon_efficency)+2)*10)+((plasma_fused/(moles_impurities/carbon_efficency))*PLASMA_BINDING_ENERGY) - plasma-=plasma_fused - carbon-=carbon_catalyzed - oxygen+=oxygen_added - nitrogen+=nitrogen_added + reaction_energy += ((carbon_efficency*toxins)/((moles_impurities/carbon_efficency)+2)*10)+((plasma_fused/(moles_impurities/carbon_efficency))*PLASMA_BINDING_ENERGY) + toxins-=plasma_fused + carbon_dioxide-=carbon_catalyzed + oxygen+=oxygen_added + nitrogen+=nitrogen_added if(reaction_energy > 0) reacting = 1 var/new_heat_capacity = heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) temperature = (temperature*old_heat_capacity + reaction_energy)/new_heat_capacity - //world << "post [temperature], [toxins], [carbon_dioxide] + //world << "post [temperature], [toxins], [carbon_dioxide]