Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 1325a4c

Browse files
Fixes fusion reactions not working in the atmospherics simulator computer (#21504)
* unit tests are cool and good * Update atmos_tests.dm
1 parent cd86d3f commit 1325a4c

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

code/modules/atmospherics/gasmixtures/reactions.dm

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,6 @@
316316
return fusion_react(air, holder)
317317

318318
/proc/fusion_react(datum/gas_mixture/air, datum/holder)
319-
var/turf/open/location = get_holder_turf(holder)
320-
if(!location)
321-
return NO_REACTION
322319
if(!air.analyzer_results)
323320
air.analyzer_results = new
324321
var/list/cached_scan_results = air.analyzer_results
@@ -366,6 +363,7 @@
366363
air.adjust_moles(GAS_NITRIUM, FUSION_TRITIUM_MOLES_USED*(reaction_energy*-FUSION_TRITIUM_CONVERSION_COEFFICIENT))
367364

368365
if(reaction_energy)
366+
var/turf/open/location = get_holder_turf(holder)
369367
if(location)
370368
var/particle_chance = ((PARTICLE_CHANCE_CONSTANT)/(reaction_energy-PARTICLE_CHANCE_CONSTANT)) + 1//Asymptopically approaches 100% as the energy of the reaction goes up.
371369
if(prob(PERCENT(particle_chance)))

code/modules/atmospherics/machinery/portable/canister.dm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,9 @@
582582
/obj/machinery/portable_atmospherics/canister/fusion_test/create_gas()
583583
air_contents.set_moles(GAS_TRITIUM, 10)
584584
air_contents.set_moles(GAS_PLASMA, 500)
585-
air_contents.set_moles(GAS_H2, 500)
585+
air_contents.set_moles(GAS_CO2, 500)
586586
air_contents.set_moles(GAS_NITROUS, 100)
587-
air_contents.set_temperature(10000)
587+
air_contents.set_temperature(FUSION_TEMPERATURE_THRESHOLD)
588588

589589
/// Canister 1 Kelvin below the fusion point. Contains far too much plasma. Only good for adding more fuel to ongoing fusion reactions.
590590
/obj/machinery/portable_atmospherics/canister/fusion_test_2
@@ -596,7 +596,7 @@
596596
air_contents.set_moles(GAS_PLASMA, 15000)
597597
air_contents.set_moles(GAS_CO2, 1500)
598598
air_contents.set_moles(GAS_NITROUS, 100)
599-
air_contents.set_temperature(9999)
599+
air_contents.set_temperature(FUSION_TEMPERATURE_THRESHOLD - 1)
600600

601601
/// Canister at the perfect conditions to start and continue fusion for a long time.
602602
/obj/machinery/portable_atmospherics/canister/fusion_test_3
@@ -620,7 +620,7 @@
620620
air_contents.set_moles(GAS_PLASMA, 4500)
621621
air_contents.set_moles(GAS_CO2, 1500)
622622
air_contents.set_moles(GAS_DILITHIUM, 2000)
623-
air_contents.set_temperature(10000)
623+
air_contents.set_temperature(FUSION_TEMPERATURE_THRESHOLD - 1)
624624

625625
/// A canister that is 1 Kelvin away from doing the stimball reaction.
626626
/obj/machinery/portable_atmospherics/canister/stimball_test

code/modules/unit_tests/_unit_tests.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
#define TRAIT_SOURCE_UNIT_TESTS "unit_tests"
7171

7272
#include "anchored_mobs.dm"
73+
#include "atmos_tests.dm"
7374
#include "baseturfs.dm"
7475
#include "component_tests.dm"
7576
#include "dcs_check_list_arguments.dm"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/datum/unit_test/fusion_reaction/Run()
2+
var/datum/gas_mixture/fusion_test_mix = new
3+
4+
fusion_test_mix.set_moles(GAS_TRITIUM, 1000)
5+
fusion_test_mix.set_moles(GAS_PLASMA, 4500)
6+
fusion_test_mix.set_moles(GAS_CO2, 1500)
7+
fusion_test_mix.set_moles(GAS_DILITHIUM, 2000)
8+
fusion_test_mix.set_temperature(FUSION_TEMPERATURE_THRESHOLD - 1)
9+
10+
if(fusion_test_mix.react() != REACTING)
11+
TEST_FAIL("Fusion reaction was unable to start!")
12+
qdel(fusion_test_mix)

0 commit comments

Comments
 (0)