diff --git a/code/ZAS/Fire.dm b/code/ZAS/Fire.dm index 67fc7b0b65..71a492fed0 100644 --- a/code/ZAS/Fire.dm +++ b/code/ZAS/Fire.dm @@ -318,7 +318,8 @@ If it gains pressure too slowly, it may leak or just rupture instead of explodin zone.remove_liquidfuel(used_liquid_fuel, !check_combustability()) //calculate the energy produced by the reaction and then set the new temperature of the mix - temperature = (starting_energy + vsc.fire_fuel_energy_release * (used_gas_fuel + used_liquid_fuel)) / heat_capacity() + if(heat_capacity() > 0) + temperature = min((starting_energy + vsc.fire_fuel_energy_release * (used_gas_fuel + used_liquid_fuel)) / heat_capacity(), MAX_ATMOS_TEMPERATURE) update_values() #ifdef FIREDBG diff --git a/code/__defines/atmos.dm b/code/__defines/atmos.dm index 6f5dc1d3b3..9bc132a296 100644 --- a/code/__defines/atmos.dm +++ b/code/__defines/atmos.dm @@ -98,3 +98,4 @@ // Used in various things like tanks and oxygen pumps. #define TANK_MAX_RELEASE_PRESSURE (3*ONE_ATMOSPHERE) #define TANK_DEFAULT_RELEASE_PRESSURE ONE_ATMOSPHERE +#define MAX_ATMOS_TEMPERATURE 1e7 //Without having a max temp, you can get .inf temps diff --git a/code/modules/xgm/xgm_gas_mixture.dm b/code/modules/xgm/xgm_gas_mixture.dm index eec461c5a7..37a8753940 100644 --- a/code/modules/xgm/xgm_gas_mixture.dm +++ b/code/modules/xgm/xgm_gas_mixture.dm @@ -144,7 +144,8 @@ 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. - temperature += thermal_energy/heat_capacity + if(heat_capacity > 0) + temperature = min(temperature + thermal_energy / heat_capacity, MAX_ATMOS_TEMPERATURE) return thermal_energy //Returns the thermal energy change required to get to a new temperature