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 2f7c2d6adda..ef87379b4ce 100644 --- a/code/datums/gas_mixture.dm +++ b/code/datums/gas_mixture.dm @@ -120,6 +120,31 @@ 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()-(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 + + 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] + + fuel_burnt = 0 if(temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)