diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm index e63315fa5cd..4d2af33eafe 100644 --- a/code/modules/atmospherics/gasmixtures/reactions.dm +++ b/code/modules/atmospherics/gasmixtures/reactions.dm @@ -140,7 +140,12 @@ var/temperature = air.temperature var/list/cached_results = air.reaction_results cached_results["fire"] = 0 - var/turf/open/location = isturf(holder) ? holder : null + var/turf/open/location + if(istype(holder,/datum/pipeline)) //Find the tile the reaction is occuring on, or a random part of the network if it's a pipenet. + var/datum/pipeline/pipenet = holder + location = get_turf(pick(pipenet.members)) + else + location = get_turf(holder) var/burned_fuel = 0 if(cached_gases[/datum/gas/oxygen][MOLES] < cached_gases[/datum/gas/tritium][MOLES] || MINIMUM_TRIT_OXYBURN_ENERGY > air.thermal_energy()) @@ -165,6 +170,8 @@ energy_released += (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel) cached_results["fire"] += burned_fuel * 10 + if(location && prob(10) && burned_fuel > TRITIUM_MINIMUM_RADIATION_ENERGY) + radiation_pulse(location, max_range = min(sqrt(energy_released / FIRE_HYDROGEN_ENERGY_RELEASED) / 1.5, 20), threshold = 15 * INVERSE(15 + energy_released / FIRE_HYDROGEN_ENERGY_RELEASED), chance = 50) if(energy_released > 0) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) @@ -821,15 +828,21 @@ location = get_turf(pick(pipenet.members)) else location = get_turf(holder) - var consumed_amount = min(5, cached_gases[/datum/gas/bz][MOLES], cached_gases[/datum/gas/proto_nitrate][MOLES]) + var consumed_amount = min(air.temperature / 2240 * cached_gases[/datum/gas/bz][MOLES] * cached_gases[/datum/gas/proto_nitrate][MOLES] / (cached_gases[/datum/gas/bz][MOLES] + cached_gases[/datum/gas/proto_nitrate][MOLES]), cached_gases[/datum/gas/bz][MOLES], cached_gases[/datum/gas/proto_nitrate][MOLES]) if(cached_gases[/datum/gas/bz][MOLES] - consumed_amount < 0) return NO_REACTION - if(cached_gases[/datum/gas/bz][MOLES] < 30) - cached_gases[/datum/gas/bz][MOLES] -= consumed_amount - else - for(var/mob/living/carbon/L in location) - L.hallucination += cached_gases[/datum/gas/bz][MOLES] * 0.7 - energy_released += 100 + + ASSERT_GAS(/datum/gas/nitrogen, air) + ASSERT_GAS(/datum/gas/helium, air) + ASSERT_GAS(/datum/gas/plasma, air) + cached_gases[/datum/gas/nitrogen][MOLES] += consumed_amount * 0.4 + cached_gases[/datum/gas/helium][MOLES] += consumed_amount * 1.6 + cached_gases[/datum/gas/plasma][MOLES] += consumed_amount * 0.8 + cached_gases[/datum/gas/bz][MOLES] -= consumed_amount + energy_released += consumed_amount * 60000 + radiation_pulse(location, max_range = min(sqrt(consumed_amount) / 1.5, 20), threshold = 15 * INVERSE(15 + consumed_amount), chance = 50) + for(var/mob/living/carbon/L in location) + L.hallucination += consumed_amount if(energy_released) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) @@ -854,17 +867,21 @@ var/old_heat_capacity = air.heat_capacity() var/list/cached_gases = air.gases var/temperature = air.temperature - var/turf/open/location = isturf(holder) ? holder : null - if(location == null) - return NO_REACTION - var produced_amount = min(5, cached_gases[/datum/gas/tritium][MOLES], cached_gases[/datum/gas/proto_nitrate][MOLES] * INVERSE(0.01)) + var/turf/open/location + if(istype(holder,/datum/pipeline)) //Find the tile the reaction is occuring on, or a random part of the network if it's a pipenet. + var/datum/pipeline/pipenet = holder + location = get_turf(pick(pipenet.members)) + else + location = get_turf(holder) + var produced_amount = min(air.temperature / 34 * (cached_gases[/datum/gas/tritium][MOLES] * cached_gases[/datum/gas/proto_nitrate][MOLES]) / (cached_gases[/datum/gas/tritium][MOLES] + 10 * cached_gases[/datum/gas/proto_nitrate][MOLES]), cached_gases[/datum/gas/tritium][MOLES], cached_gases[/datum/gas/proto_nitrate][MOLES] * INVERSE(0.01)) if(cached_gases[/datum/gas/tritium][MOLES] - produced_amount < 0 || cached_gases[/datum/gas/proto_nitrate][MOLES] - produced_amount * 0.01 < 0) return NO_REACTION ASSERT_GAS(/datum/gas/hydrogen, air) cached_gases[/datum/gas/tritium][MOLES] -= produced_amount cached_gases[/datum/gas/proto_nitrate][MOLES] -= produced_amount * 0.01 cached_gases[/datum/gas/hydrogen][MOLES] += produced_amount - energy_released += 50 + energy_released += produced_amount * 10000 + radiation_pulse(location, max_range = min(sqrt(produced_amount) / 1.5, 20), threshold = 15 * INVERSE(15 + produced_amount), chance = 50) if(energy_released) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)