From cf7ef7c0176c3318276329ba1258eed3dd5cd75f Mon Sep 17 00:00:00 2001 From: Pickle-Coding <58013024+Pickle-Coding@users.noreply.github.com> Date: Thu, 21 Jul 2022 10:24:40 +0100 Subject: [PATCH] Proto-nitrate bz response gas reaction can now emit nuclear particles. (#67808) The proto-nitrate bz response gas reaction can now emit nuclear particles. One particle can be created per 5 moles of BZ spent in the reaction, up to 6 particles in a single reaction costing 60 moles of BZ. The intensity of the radiation pulses in the reaction have been reduced based on how many nuclear particles have been created. The direction is completely random and out of user control. This has the same requirements as emitting radiation pulses, so putting it in waste or distro won't work. Adds a fun yet dangerous interaction for atmospheric technicians to play around with. Proto-nitrate tritium response and BZ response felt too similar in what they do, so this should make the reactions feel less duplicated. While it might be possible to use this in a traitorous act, it shouldn't be a very effective choice as the reaction has extremely tight temperature range requirements, and a relatively high energy release compared to its heat capacity, making it only feasible at high efficiency in a controlled and stationary environment. --- code/__DEFINES/reactions.dm | 6 ++++++ code/modules/atmospherics/gasmixtures/reaction_factors.dm | 5 +++-- code/modules/atmospherics/gasmixtures/reactions.dm | 6 +++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/code/__DEFINES/reactions.dm b/code/__DEFINES/reactions.dm index 8d367cea1850d..fced42c7c56b8 100644 --- a/code/__DEFINES/reactions.dm +++ b/code/__DEFINES/reactions.dm @@ -259,3 +259,9 @@ #define PN_BZASE_RAD_RANGE_DIVISOR 1.5 /// A scaling factor for the threshold of the radiation pulses generated when proto-nitrate breaks down BZ. #define PN_BZASE_RAD_THRESHOLD_BASE 15 +/// A scaling factor for the nuclear particle production generated when proto-nitrate breaks down BZ. +#define PN_BZASE_NUCLEAR_PARTICLE_DIVISOR 5 +/// The maximum amount of nuclear particles that can be produced from proto-nitrate breaking down BZ. +#define PN_BZASE_NUCLEAR_PARTICLE_MAXIMUM 6 +/// How much radiation in consumed amount does a nuclear particle take from radiation when proto-nitrate breaks down BZ. +#define PN_BZASE_NUCLEAR_PARTICLE_RADIATION_ENERGY_CONVERSION 2.5 diff --git a/code/modules/atmospherics/gasmixtures/reaction_factors.dm b/code/modules/atmospherics/gasmixtures/reaction_factors.dm index eb65ea646371e..8722f11fee010 100644 --- a/code/modules/atmospherics/gasmixtures/reaction_factors.dm +++ b/code/modules/atmospherics/gasmixtures/reaction_factors.dm @@ -185,7 +185,7 @@ "Energy" = "[PN_HYDROGEN_CONVERSION_ENERGY] joules of energy is absorbed per reaction rate", ) -/datum/gas_reaction/proto_nitrate_tritium_response/init_factors() // Fixed reaction rate +/datum/gas_reaction/proto_nitrate_tritium_response/init_factors() factor = list( /datum/gas/tritium = "Tritium is consumed at 1 reaction rate.", /datum/gas/proto_nitrate = "Proto nitrate is consumed at 0.01 reaction rate.", @@ -194,7 +194,7 @@ "Radiation" = "This reaction emits radiation proportional to the reaction rate.", ) -/datum/gas_reaction/proto_nitrate_bz_response/init_factors() // Fixed reaction rate +/datum/gas_reaction/proto_nitrate_bz_response/init_factors() factor = list( /datum/gas/proto_nitrate = "[MINIMUM_MOLE_COUNT] moles of proto-nitrate needs to be present for the reaction to occur", /datum/gas/bz = "BZ is consumed at 1 reaction rate.", @@ -204,4 +204,5 @@ "Energy" = "[PN_BZASE_ENERGY] joules of energy is released per reaction rate", "Radiation" = "This reaction emits radiation proportional to the reaction rate.", "Hallucinations" = "This reaction can cause various carbon based lifeforms in the vicinity to hallucinate.", + "Nuclear Particles" = "This reaction emits extremely high energy nuclear particles, up to [PN_BZASE_NUCLEAR_PARTICLE_MAXIMUM] per reaction rate.", ) diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm index bd773f2671b1e..98c70d945b270 100644 --- a/code/modules/atmospherics/gasmixtures/reactions.dm +++ b/code/modules/atmospherics/gasmixtures/reactions.dm @@ -1152,7 +1152,11 @@ else if(isatom(holder)) location = holder if (location && energy_released > PN_BZASE_RAD_RELEASE_THRESHOLD * (air.volume / CELL_VOLUME) ** ATMOS_RADIATION_VOLUME_EXP) - radiation_pulse(location, max_range = min(sqrt(consumed_amount) / PN_BZASE_RAD_RANGE_DIVISOR, GAS_REACTION_MAXIMUM_RADIATION_PULSE_RANGE), threshold = PN_BZASE_RAD_THRESHOLD_BASE * INVERSE(PN_BZASE_RAD_THRESHOLD_BASE + consumed_amount)) + ///How many nuclear particles will fire in this reaction. + var/nuclear_particle_amount = min(round(consumed_amount / PN_BZASE_NUCLEAR_PARTICLE_DIVISOR), PN_BZASE_NUCLEAR_PARTICLE_MAXIMUM) + for(var/i in 1 to nuclear_particle_amount) + location.fire_nuclear_particle() + radiation_pulse(location, max_range = min(sqrt(consumed_amount - nuclear_particle_amount * PN_BZASE_NUCLEAR_PARTICLE_RADIATION_ENERGY_CONVERSION) / PN_BZASE_RAD_RANGE_DIVISOR, GAS_REACTION_MAXIMUM_RADIATION_PULSE_RANGE), threshold = PN_BZASE_RAD_THRESHOLD_BASE * INVERSE(PN_BZASE_RAD_THRESHOLD_BASE + consumed_amount - nuclear_particle_amount * PN_BZASE_NUCLEAR_PARTICLE_RADIATION_ENERGY_CONVERSION)) for(var/mob/living/carbon/L in location) L.hallucination += consumed_amount