Skip to content

Commit 16de120

Browse files
added reaction
1 parent f6eef85 commit 16de120

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

code/ZAS/XGM_reactions.dm

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,35 @@
7575
// Arbitrary number to reduce temperature by a significant amount.
7676
var/const/base_temp_loss_per_one_reaction = -240000
7777
mixture.add_thermal_energy( cooling_coefficient * reaction_coefficient * base_temp_loss_per_one_reaction, 0.1)
78+
79+
80+
/datum/gas_reaction/n2o_thermal_decomposition
81+
name = "N2O decomposition"
82+
83+
/datum/gas_reaction/n2o_thermal_decomposition/reaction_is_possible(datum/gas_mixture/mixture)
84+
return mixture.temperature>=300+T0C && mixture[GAS_SLEEPING]>0
85+
86+
87+
/datum/gas_reaction/n2o_thermal_decomposition/reaction_amounts_requested( datum/gas_mixture/mixture )
88+
var/to_return=list()
89+
var/cratio=(mixture.temperature-300-T0C)/900
90+
cratio*= 1- (1/((mixture.pressure/ONE_ATMOSPHERE)+1)) //higher pressures make more reactions happen
91+
cratio=max(0,cratio)**0.5
92+
cratio=min(0.95,cratio)
93+
to_return[GAS_SLEEPING]=mixture[GAS_SLEEPING]*cratio
94+
return to_return
95+
96+
97+
/datum/gas_reaction/n2o_thermal_decomposition/perform_reaction( datum/gas_mixture/mixture, reactant_amounts )
98+
if(!reactant_amounts)
99+
return
100+
var/const/decomposition_energy=82050 //82.05 Kj/mol
101+
var/moles_n2o=reactant_amounts[GAS_SLEEPING]
102+
103+
mixture[GAS_OXYGEN]+=reactant_amounts[GAS_SLEEPING]*0.5
104+
mixture[GAS_NITROGEN]+=moles_n2o
105+
mixture[GAS_SLEEPING]=max(0,mixture[GAS_SLEEPING]-moles_n2o)
106+
107+
mixture.add_thermal_energy(moles_n2o*decomposition_energy)
108+
109+
mixture.update_values()

0 commit comments

Comments
 (0)