Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Remove fusion from reactions, add hypertorus fusion machinery #54379

Merged
merged 86 commits into from Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
fca258e
hypertorus fusion machine
Ghilker Oct 13, 2020
b2286c5
ignore the MAP
Ghilker Oct 14, 2020
cdb58c2
quick fix
Ghilker Oct 14, 2020
1ca3001
more stuff and tgui
Ghilker Oct 14, 2020
8ad09ea
moar
Ghilker Oct 14, 2020
65e2d40
merge master + some fixes
Ghilker Oct 14, 2020
f87badf
tgui thing
Ghilker Oct 14, 2020
ad5fd73
more
Ghilker Oct 15, 2020
91a5ae7
tgui
Ghilker Oct 15, 2020
5a387bb
merge master
Ghilker Oct 15, 2020
d837d9c
merge master
Ghilker Oct 15, 2020
7c82550
i hope this fixes it
Ghilker Oct 15, 2020
924f414
GAS
Ghilker Oct 16, 2020
7a0a811
undef
Ghilker Oct 16, 2020
77514e4
more stuff, some fixes, debug map
Ghilker Oct 17, 2020
2d848a1
merge master
Ghilker Oct 17, 2020
d5f3d9e
f
Ghilker Oct 17, 2020
0cc6f37
Merge branch 'master' into fusing
Ghilker Oct 17, 2020
497f681
many docs
Ghilker Oct 18, 2020
50f6b43
forgot a parentheses
Ghilker Oct 18, 2020
9d8302a
tgui change request
Ghilker Oct 18, 2020
96ff22f
code improvements, better ui
Ghilker Oct 19, 2020
5ca44df
merge master
Ghilker Oct 19, 2020
bf2b531
improvements
Ghilker Oct 19, 2020
b0bd7ec
merge master
Ghilker Oct 19, 2020
bab21ea
better construction
Ghilker Oct 20, 2020
f5035c8
oops
Ghilker Oct 20, 2020
f71b56c
less clamping
Ghilker Oct 21, 2020
4caabc5
power consumption, damage, balancing, requested fixes, other stuff
Ghilker Oct 23, 2020
2779fa7
merge master
Ghilker Oct 23, 2020
8f7a875
this is better
Ghilker Oct 23, 2020
e87294a
bit of logging, sounds (all royalty free), alert, messages, radio
Ghilker Oct 24, 2020
afc9abe
fixes
Ghilker Oct 24, 2020
1a0bd1e
moving things around
Ghilker Oct 24, 2020
c72a279
weewooo
Ghilker Oct 25, 2020
ed9be21
merge master
Ghilker Oct 25, 2020
5d344e3
f
Ghilker Oct 25, 2020
dd6df5b
sound, tgui, more vars, more controls, better code(?)
Ghilker Oct 26, 2020
1ae672e
countdown, machine improvements
Ghilker Oct 26, 2020
b5f5680
Merge branch 'master' into fusing
Ghilker Oct 26, 2020
d3bab0e
better sprites, meltdown, fixes
Ghilker Oct 28, 2020
c2f431c
improvements
Ghilker Oct 29, 2020
b356efe
move hypertorus.dm to new and proper location
Ghilker Oct 29, 2020
3109ae5
better machines
Ghilker Oct 30, 2020
ff9d020
derp
Ghilker Oct 30, 2020
eb5a64e
revert map for TM
Ghilker Oct 30, 2020
eebca46
crawling in my skin
Ghilker Oct 30, 2020
a4201ba
AHHHHHHH
Ghilker Oct 30, 2020
8d2faf0
fixes and less material cost
Ghilker Oct 30, 2020
a33f256
Merge branch 'master' into fusing
Ghilker Oct 30, 2020
6180c67
properly revert i hope
Ghilker Oct 30, 2020
d9da10d
limiter to 1e9
Ghilker Nov 3, 2020
373da57
merge master
Ghilker Nov 3, 2020
0c3b358
1e8 cap
Ghilker Nov 3, 2020
d37d394
Merge branch 'master' into fusing
Ghilker Nov 3, 2020
283c1a5
AHHH
Ghilker Nov 4, 2020
e10435e
more interactions, balancing
Ghilker Nov 5, 2020
32249cf
balancing
Ghilker Nov 6, 2020
98024db
merge master
Ghilker Nov 6, 2020
8a770e5
should fix runtimes when rotating machines
Ghilker Nov 6, 2020
9b028b6
fix to current_damper power consumption increase
Ghilker Nov 6, 2020
b3637de
revert a change
Ghilker Nov 6, 2020
4660092
Merge branch 'master' into fusing
Ghilker Nov 7, 2020
7f0d87e
fix and balancing, a bit of cleanup
Ghilker Nov 7, 2020
4189ab1
balancing, documentation, fixes
Ghilker Nov 8, 2020
ae0d41c
map changes
Ghilker Nov 9, 2020
aa0aedf
fixes, Signals and some minor changes
Ghilker Nov 9, 2020
3e0f31f
readability
Ghilker Nov 9, 2020
967b9b8
map work, balancing gasmix, fixes
Ghilker Nov 10, 2020
1b76932
moved room in meta outside
Ghilker Nov 10, 2020
bc5e64e
map fix
Ghilker Nov 10, 2020
e98033d
pop
Ghilker Nov 10, 2020
41632b8
no icebox bad
Ghilker Nov 10, 2020
1311d59
cleanup, delta_time use on process
Ghilker Nov 10, 2020
f7a20e3
fix, balancing, some more work
Ghilker Nov 11, 2020
7c443fd
fixes
Ghilker Nov 11, 2020
54926d3
hidden space
Ghilker Nov 11, 2020
1c31d65
fix, sprites, more gas stuff
Ghilker Nov 12, 2020
57891ac
stuff
Ghilker Nov 13, 2020
0b43d79
merge master
Ghilker Nov 14, 2020
33a67a3
merge master
Ghilker Nov 16, 2020
3cda3d0
tgui changes
Ghilker Nov 16, 2020
240df08
merge master
Ghilker Nov 16, 2020
82d38b1
tgui
Ghilker Nov 17, 2020
e226ca7
runtimes fixes, balancing, tgui, removed reaction
Ghilker Nov 18, 2020
00f980e
merge master
Ghilker Nov 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions code/__DEFINES/logging.dm
Expand Up @@ -16,6 +16,7 @@
#define INVESTIGATE_EXONET "exonet"
#define INVESTIGATE_NANITES "nanites"
#define INVESTIGATE_PRESENTS "presents"
#define INVESTIGATE_HYPERTORUS "hypertorus"

// Logging types for log_message()
#define LOG_ATTACK (1 << 0)
Expand Down
7 changes: 7 additions & 0 deletions code/__DEFINES/machines.dm
Expand Up @@ -101,6 +101,13 @@
#define SUPERMATTER_EMERGENCY 5 // Integrity < 25%
#define SUPERMATTER_DELAMINATING 6 // Pretty obvious.

#define HYPERTORUS_INACTIVE 0 // No or minimal energy
#define HYPERTORUS_NOMINAL 1 // Normal operation
#define HYPERTORUS_WARNING 2 // Integrity damaged
#define HYPERTORUS_DANGER 3 // Integrity < 50%
#define HYPERTORUS_EMERGENCY 4 // Integrity < 25%
#define HYPERTORUS_MELTING 5 // Pretty obvious.

//Nuclear bomb stuff
#define NUKESTATE_INTACT 5
#define NUKESTATE_UNSCREWED 4
Expand Down
13 changes: 0 additions & 13 deletions code/__DEFINES/reactions.dm
Expand Up @@ -53,16 +53,3 @@
#define BZ_RESEARCH_MAX_AMOUNT 400
#define METAL_HYDROGEN_RESEARCH_MAX_AMOUNT 3000
#define STIMULUM_RESEARCH_AMOUNT 50
//Plasma fusion properties
#define FUSION_MOLE_THRESHOLD 250 //Mole count required (tritium/plasma) to start a fusion reaction
#define FUSION_TRITIUM_CONVERSION_COEFFICIENT (1e-10)
#define INSTABILITY_GAS_POWER_FACTOR 0.003
#define FUSION_TRITIUM_MOLES_USED 1
#define PLASMA_BINDING_ENERGY 20000000
#define TOROID_VOLUME_BREAKEVEN 1000
#define FUSION_TEMPERATURE_THRESHOLD 9000
#define PARTICLE_CHANCE_CONSTANT (-20000000)
#define FUSION_RAD_MAX 1500
#define FUSION_RAD_COEFFICIENT (-1000)
#define FUSION_INSTABILITY_ENDOTHERMALITY 2
#define FUSION_MAXIMUM_TEMPERATURE 1e8
9 changes: 9 additions & 0 deletions code/datums/looping_sounds/machinery_sounds.dm
Expand Up @@ -28,6 +28,15 @@

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/datum/looping_sound/hypertorus
mid_sounds = list('sound/machines/hypertorus/loops/hypertorus_nominal.ogg' = 1)
mid_length = 60
volume = 55
extra_range = 15
vary = TRUE

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/datum/looping_sound/generator
start_sound = 'sound/machines/generator/generator_start.ogg'
start_length = 4
Expand Down
50 changes: 50 additions & 0 deletions code/game/objects/items/circuitboards/machine_circuitboards.dm
Expand Up @@ -334,6 +334,56 @@
#undef PATH_FREEZER
#undef PATH_HEATER

/obj/item/circuitboard/machine/HFR_fuel_input
name = "HFR Fuel Input (Machine Board)"
icon_state = "engineering"
build_path = /obj/machinery/atmospherics/components/unary/hypertorus/fuel_input
req_components = list(
/obj/item/stack/sheet/metal = 5,
/obj/item/stack/sheet/plasteel = 5)

/obj/item/circuitboard/machine/HFR_waste_output
name = "HFR Waste Output (Machine Board)"
icon_state = "engineering"
build_path = /obj/machinery/atmospherics/components/unary/hypertorus/waste_output
req_components = list(
/obj/item/stack/sheet/metal = 5,
/obj/item/stack/sheet/plasteel = 5)

/obj/item/circuitboard/machine/HFR_moderator_input
name = "HFR Moderator Input (Machine Board)"
icon_state = "engineering"
build_path = /obj/machinery/atmospherics/components/unary/hypertorus/moderator_input
req_components = list(
/obj/item/stack/sheet/metal = 5,
/obj/item/stack/sheet/plasteel = 5)

/obj/item/circuitboard/machine/HFR_core
name = "HFR core (Machine Board)"
icon_state = "engineering"
build_path = /obj/machinery/atmospherics/components/binary/hypertorus/core
req_components = list(
/obj/item/stack/cable_coil = 10,
/obj/item/stack/sheet/glass = 10,
/obj/item/stack/sheet/plasteel = 10)

/obj/item/circuitboard/machine/HFR_corner
name = "HFR Corner (Machine Board)"
icon_state = "engineering"
build_path = /obj/machinery/hypertorus/corner
req_components = list(
/obj/item/stack/sheet/metal = 5,
/obj/item/stack/sheet/plasteel = 5)

/obj/item/circuitboard/machine/HFR_interface
name = "HFR Interface (Machine Board)"
icon_state = "engineering"
build_path = /obj/machinery/hypertorus/interface
req_components = list(
/obj/item/stack/cable_coil = 10,
/obj/item/stack/sheet/glass = 10,
/obj/item/stack/sheet/plasteel = 5)

//Generic

/obj/item/circuitboard/machine/circuit_imprinter
Expand Down
4 changes: 4 additions & 0 deletions code/game/sound.dm
Expand Up @@ -226,4 +226,8 @@ distance_multiplier - Can be used to multiply the distance at which the sound is
soundin = pick('sound/machines/sm/accent/normal/1.ogg', 'sound/machines/sm/accent/normal/2.ogg', 'sound/machines/sm/accent/normal/3.ogg', 'sound/machines/sm/accent/normal/4.ogg', 'sound/machines/sm/accent/normal/5.ogg', 'sound/machines/sm/accent/normal/6.ogg', 'sound/machines/sm/accent/normal/7.ogg', 'sound/machines/sm/accent/normal/8.ogg', 'sound/machines/sm/accent/normal/9.ogg', 'sound/machines/sm/accent/normal/10.ogg', 'sound/machines/sm/accent/normal/11.ogg', 'sound/machines/sm/accent/normal/12.ogg', 'sound/machines/sm/accent/normal/13.ogg', 'sound/machines/sm/accent/normal/14.ogg', 'sound/machines/sm/accent/normal/15.ogg', 'sound/machines/sm/accent/normal/16.ogg', 'sound/machines/sm/accent/normal/17.ogg', 'sound/machines/sm/accent/normal/18.ogg', 'sound/machines/sm/accent/normal/19.ogg', 'sound/machines/sm/accent/normal/20.ogg', 'sound/machines/sm/accent/normal/21.ogg', 'sound/machines/sm/accent/normal/22.ogg', 'sound/machines/sm/accent/normal/23.ogg', 'sound/machines/sm/accent/normal/24.ogg', 'sound/machines/sm/accent/normal/25.ogg', 'sound/machines/sm/accent/normal/26.ogg', 'sound/machines/sm/accent/normal/27.ogg', 'sound/machines/sm/accent/normal/28.ogg', 'sound/machines/sm/accent/normal/29.ogg', 'sound/machines/sm/accent/normal/30.ogg', 'sound/machines/sm/accent/normal/31.ogg', 'sound/machines/sm/accent/normal/32.ogg', 'sound/machines/sm/accent/normal/33.ogg')
if("smdelam")
soundin = pick('sound/machines/sm/accent/delam/1.ogg', 'sound/machines/sm/accent/normal/2.ogg', 'sound/machines/sm/accent/normal/3.ogg', 'sound/machines/sm/accent/normal/4.ogg', 'sound/machines/sm/accent/normal/5.ogg', 'sound/machines/sm/accent/normal/6.ogg', 'sound/machines/sm/accent/normal/7.ogg', 'sound/machines/sm/accent/normal/8.ogg', 'sound/machines/sm/accent/normal/9.ogg', 'sound/machines/sm/accent/normal/10.ogg', 'sound/machines/sm/accent/normal/11.ogg', 'sound/machines/sm/accent/normal/12.ogg', 'sound/machines/sm/accent/normal/13.ogg', 'sound/machines/sm/accent/normal/14.ogg', 'sound/machines/sm/accent/normal/15.ogg', 'sound/machines/sm/accent/normal/16.ogg', 'sound/machines/sm/accent/normal/17.ogg', 'sound/machines/sm/accent/normal/18.ogg', 'sound/machines/sm/accent/normal/19.ogg', 'sound/machines/sm/accent/normal/20.ogg', 'sound/machines/sm/accent/normal/21.ogg', 'sound/machines/sm/accent/normal/22.ogg', 'sound/machines/sm/accent/normal/23.ogg', 'sound/machines/sm/accent/normal/24.ogg', 'sound/machines/sm/accent/normal/25.ogg', 'sound/machines/sm/accent/normal/26.ogg', 'sound/machines/sm/accent/normal/27.ogg', 'sound/machines/sm/accent/normal/28.ogg', 'sound/machines/sm/accent/normal/29.ogg', 'sound/machines/sm/accent/normal/30.ogg', 'sound/machines/sm/accent/normal/31.ogg', 'sound/machines/sm/accent/normal/32.ogg', 'sound/machines/sm/accent/normal/33.ogg')
if("hypertoruscalm")
soundin = pick('sound/machines/sm/accent/normal/1.ogg', 'sound/machines/sm/accent/normal/2.ogg', 'sound/machines/sm/accent/normal/3.ogg', 'sound/machines/sm/accent/normal/4.ogg', 'sound/machines/sm/accent/normal/5.ogg', 'sound/machines/sm/accent/normal/6.ogg', 'sound/machines/sm/accent/normal/7.ogg', 'sound/machines/sm/accent/normal/8.ogg', 'sound/machines/sm/accent/normal/9.ogg', 'sound/machines/sm/accent/normal/10.ogg', 'sound/machines/sm/accent/normal/11.ogg', 'sound/machines/sm/accent/normal/12.ogg', 'sound/machines/sm/accent/normal/13.ogg', 'sound/machines/sm/accent/normal/14.ogg', 'sound/machines/sm/accent/normal/15.ogg', 'sound/machines/sm/accent/normal/16.ogg', 'sound/machines/sm/accent/normal/17.ogg', 'sound/machines/sm/accent/normal/18.ogg', 'sound/machines/sm/accent/normal/19.ogg', 'sound/machines/sm/accent/normal/20.ogg', 'sound/machines/sm/accent/normal/21.ogg', 'sound/machines/sm/accent/normal/22.ogg', 'sound/machines/sm/accent/normal/23.ogg', 'sound/machines/sm/accent/normal/24.ogg', 'sound/machines/sm/accent/normal/25.ogg', 'sound/machines/sm/accent/normal/26.ogg', 'sound/machines/sm/accent/normal/27.ogg', 'sound/machines/sm/accent/normal/28.ogg', 'sound/machines/sm/accent/normal/29.ogg', 'sound/machines/sm/accent/normal/30.ogg', 'sound/machines/sm/accent/normal/31.ogg', 'sound/machines/sm/accent/normal/32.ogg', 'sound/machines/sm/accent/normal/33.ogg')
if("hypertorusmelting")
soundin = pick('sound/machines/sm/accent/delam/1.ogg', 'sound/machines/sm/accent/normal/2.ogg', 'sound/machines/sm/accent/normal/3.ogg', 'sound/machines/sm/accent/normal/4.ogg', 'sound/machines/sm/accent/normal/5.ogg', 'sound/machines/sm/accent/normal/6.ogg', 'sound/machines/sm/accent/normal/7.ogg', 'sound/machines/sm/accent/normal/8.ogg', 'sound/machines/sm/accent/normal/9.ogg', 'sound/machines/sm/accent/normal/10.ogg', 'sound/machines/sm/accent/normal/11.ogg', 'sound/machines/sm/accent/normal/12.ogg', 'sound/machines/sm/accent/normal/13.ogg', 'sound/machines/sm/accent/normal/14.ogg', 'sound/machines/sm/accent/normal/15.ogg', 'sound/machines/sm/accent/normal/16.ogg', 'sound/machines/sm/accent/normal/17.ogg', 'sound/machines/sm/accent/normal/18.ogg', 'sound/machines/sm/accent/normal/19.ogg', 'sound/machines/sm/accent/normal/20.ogg', 'sound/machines/sm/accent/normal/21.ogg', 'sound/machines/sm/accent/normal/22.ogg', 'sound/machines/sm/accent/normal/23.ogg', 'sound/machines/sm/accent/normal/24.ogg', 'sound/machines/sm/accent/normal/25.ogg', 'sound/machines/sm/accent/normal/26.ogg', 'sound/machines/sm/accent/normal/27.ogg', 'sound/machines/sm/accent/normal/28.ogg', 'sound/machines/sm/accent/normal/29.ogg', 'sound/machines/sm/accent/normal/30.ogg', 'sound/machines/sm/accent/normal/31.ogg', 'sound/machines/sm/accent/normal/32.ogg', 'sound/machines/sm/accent/normal/33.ogg')
Ghilker marked this conversation as resolved.
Show resolved Hide resolved
return soundin
2 changes: 1 addition & 1 deletion code/modules/admin/admin_investigate.dm
Expand Up @@ -10,7 +10,7 @@
if(!holder)
return

var/list/investigates = list(INVESTIGATE_RESEARCH, INVESTIGATE_EXONET, INVESTIGATE_PORTAL, INVESTIGATE_SINGULO, INVESTIGATE_WIRES, INVESTIGATE_TELESCI, INVESTIGATE_GRAVITY, INVESTIGATE_RECORDS, INVESTIGATE_CARGO, INVESTIGATE_SUPERMATTER, INVESTIGATE_ATMOS, INVESTIGATE_EXPERIMENTOR, INVESTIGATE_BOTANY, INVESTIGATE_HALLUCINATIONS, INVESTIGATE_RADIATION, INVESTIGATE_NANITES, INVESTIGATE_PRESENTS)
var/list/investigates = list(INVESTIGATE_RESEARCH, INVESTIGATE_EXONET, INVESTIGATE_PORTAL, INVESTIGATE_SINGULO, INVESTIGATE_WIRES, INVESTIGATE_TELESCI, INVESTIGATE_GRAVITY, INVESTIGATE_RECORDS, INVESTIGATE_CARGO, INVESTIGATE_SUPERMATTER, INVESTIGATE_ATMOS, INVESTIGATE_EXPERIMENTOR, INVESTIGATE_BOTANY, INVESTIGATE_HALLUCINATIONS, INVESTIGATE_RADIATION, INVESTIGATE_NANITES, INVESTIGATE_PRESENTS, INVESTIGATE_HYPERTORUS)

var/list/logs_present = list("notes, memos, watchlist")
var/list/logs_missing = list("---")
Expand Down
6 changes: 6 additions & 0 deletions code/modules/atmospherics/gasmixtures/gas_mixture.dm
Expand Up @@ -81,6 +81,12 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
//PV = nRT

///joules per kelvin

Ghilker marked this conversation as resolved.
Show resolved Hide resolved
/datum/gas_mixture/proc/clear(list/tocheck)
var/list/cached_gases = gases
for(var/id in (tocheck || cached_gases))
cached_gases -= id
Ghilker marked this conversation as resolved.
Show resolved Hide resolved
Ghilker marked this conversation as resolved.
Show resolved Hide resolved

/datum/gas_mixture/proc/heat_capacity(data = MOLES)
var/list/cached_gases = gases
. = 0
Expand Down
21 changes: 19 additions & 2 deletions code/modules/atmospherics/gasmixtures/gas_types.dm
Expand Up @@ -92,6 +92,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
gas_overlay = "freon"
moles_visible = MOLES_GAS_VISIBLE
dangerous = TRUE
fusion_power = 10
rarity = 50

/datum/gas/nitrous_oxide
Expand All @@ -111,7 +112,6 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
gas_overlay = "nitryl"
moles_visible = MOLES_GAS_VISIBLE
dangerous = TRUE
fusion_power = 16
Ghilker marked this conversation as resolved.
Show resolved Hide resolved
rarity = 100

/datum/gas/tritium
Expand All @@ -121,7 +121,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
gas_overlay = "tritium"
moles_visible = MOLES_GAS_VISIBLE
dangerous = TRUE
fusion_power = 1
fusion_power = 5
Ghilker marked this conversation as resolved.
Show resolved Hide resolved
rarity = 300

/datum/gas/bz
Expand Down Expand Up @@ -168,6 +168,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
specific_heat = 15
name = "Hydrogen"
dangerous = TRUE
fusion_power = 2
Ghilker marked this conversation as resolved.
Show resolved Hide resolved
rarity = 600

/datum/gas/healium
Expand Down Expand Up @@ -206,6 +207,22 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
moles_visible = MOLES_GAS_VISIBLE
rarity = 300

/datum/gas/helium
id = "helium"
specific_heat = 15
name = "Helium"
dangerous = FALSE
fusion_power = 7
rarity = 50

/datum/gas/antinoblium
id = "antinoblium"
specific_heat = 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1? are you sure?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and no, need more testing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any new thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think i'll leave it as is now, since this specific_heat has purpose inside the HFR (easier to heat up gas, more energy, etc)
also i was thinking of not adding much more functions to both the He and Antinob in this PR, since i was already planning other PRs to work with this one that will add functions and purposes to these gases.

name = "Antinoblium"
dangerous = TRUE
fusion_power = 20
rarity = 1

/obj/effect/overlay/gas
icon = 'icons/effects/atmospherics.dmi'
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
Expand Down
85 changes: 0 additions & 85 deletions code/modules/atmospherics/gasmixtures/reactions.dm
Expand Up @@ -380,91 +380,6 @@ nobiliumsuppression = INFINITY

return cached_results["fire"] ? REACTING : NO_REACTION

//fusion: a terrible idea that was fun but broken. Now reworked to be less broken and more interesting. Again (and again, and again). Again!
//Fusion Rework Counter: Please increment this if you make a major overhaul to this system again.
//6 reworks

/datum/gas_reaction/fusion
exclude = FALSE
priority = 19
name = "Plasmic Fusion"
id = "fusion"

/datum/gas_reaction/fusion/init_reqs()
min_requirements = list(
"TEMP" = FUSION_TEMPERATURE_THRESHOLD,
/datum/gas/tritium = FUSION_TRITIUM_MOLES_USED,
/datum/gas/plasma = FUSION_MOLE_THRESHOLD,
/datum/gas/hydrogen = FUSION_MOLE_THRESHOLD)

/datum/gas_reaction/fusion/react(datum/gas_mixture/air, datum/holder)
var/list/cached_gases = air.gases
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/fusion_pipenet = holder
location = get_turf(pick(fusion_pipenet.members))
else
location = get_turf(holder)
if(!air.analyzer_results)
air.analyzer_results = new
var/list/cached_scan_results = air.analyzer_results
var/old_heat_capacity = air.heat_capacity()
var/reaction_energy = 0 //Reaction energy can be negative or positive, for both exothermic and endothermic reactions.
var/initial_plasma = cached_gases[/datum/gas/plasma][MOLES]
var/initial_hydrogen = cached_gases[/datum/gas/hydrogen][MOLES]
var/scale_factor = (air.volume)/(PI) //We scale it down by volume/Pi because for fusion conditions, moles roughly = 2*volume, but we want it to be based off something constant between reactions.
var/toroidal_size = (2 * PI) //The size of the phase space hypertorus
var/gas_power = 0
for (var/gas_id in cached_gases)
gas_power += (cached_gases[gas_id][GAS_META][META_GAS_FUSION_POWER] * cached_gases[gas_id][MOLES])
var/instability = MODULUS((gas_power * INSTABILITY_GAS_POWER_FACTOR)**2, toroidal_size) //Instability effects how chaotic the behavior of the reaction is
cached_scan_results[id] = instability//used for analyzer feedback

var/plasma = (initial_plasma-FUSION_MOLE_THRESHOLD)/(scale_factor) //We have to scale the amounts of hydrogen and plasma down a significant amount in order to show the chaotic dynamics we want
var/hydrogen = (initial_hydrogen-FUSION_MOLE_THRESHOLD)/(scale_factor) //We also subtract out the threshold amount to make it harder for fusion to burn itself out.

//The reaction is a specific form of the Kicked Rotator system, which displays chaotic behavior and can be used to model particle interactions.
plasma = MODULUS(plasma - (instability * sin(TODEGREES(hydrogen))), toroidal_size)
hydrogen = MODULUS(hydrogen - plasma, toroidal_size)


cached_gases[/datum/gas/plasma][MOLES] = plasma * scale_factor + FUSION_MOLE_THRESHOLD //Scales the gases back up
cached_gases[/datum/gas/hydrogen][MOLES] = hydrogen * scale_factor + FUSION_MOLE_THRESHOLD
var/delta_plasma = initial_plasma - cached_gases[/datum/gas/plasma][MOLES]

reaction_energy += delta_plasma * PLASMA_BINDING_ENERGY //Energy is gained or lost corresponding to the creation or destruction of mass.
if(instability < FUSION_INSTABILITY_ENDOTHERMALITY)
reaction_energy = max(reaction_energy, 0) //Stable reactions don't end up endothermic.
else if (reaction_energy < 0)
reaction_energy *= (instability-FUSION_INSTABILITY_ENDOTHERMALITY)**0.5

if(air.thermal_energy() + reaction_energy < 0) //No using energy that doesn't exist.
cached_gases[/datum/gas/plasma][MOLES] = initial_plasma
cached_gases[/datum/gas/hydrogen][MOLES] = initial_hydrogen
return NO_REACTION
cached_gases[/datum/gas/tritium][MOLES] -= FUSION_TRITIUM_MOLES_USED
//The decay of the tritium and the reaction's energy produces waste gases, different ones depending on whether the reaction is endo or exothermic
if(reaction_energy > 0)
air.assert_gases(/datum/gas/carbon_dioxide, /datum/gas/water_vapor)
cached_gases[/datum/gas/carbon_dioxide][MOLES] += FUSION_TRITIUM_MOLES_USED * (reaction_energy * FUSION_TRITIUM_CONVERSION_COEFFICIENT)
cached_gases[/datum/gas/water_vapor][MOLES] += (FUSION_TRITIUM_MOLES_USED * (reaction_energy * FUSION_TRITIUM_CONVERSION_COEFFICIENT)) * 0.25
else
air.assert_gases(/datum/gas/carbon_dioxide)
cached_gases[/datum/gas/carbon_dioxide][MOLES] += FUSION_TRITIUM_MOLES_USED * (reaction_energy * -FUSION_TRITIUM_CONVERSION_COEFFICIENT)

if(reaction_energy)
if(location)
var/particle_chance = ((PARTICLE_CHANCE_CONSTANT) / (reaction_energy - PARTICLE_CHANCE_CONSTANT)) + 1//Asymptopically approaches 100% as the energy of the reaction goes up.
if(prob(PERCENT(particle_chance)))
location.fire_nuclear_particle()
var/rad_power = max((FUSION_RAD_COEFFICIENT / instability) + FUSION_RAD_MAX, 0)
radiation_pulse(location,rad_power)

var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY && (air.temperature <= FUSION_MAXIMUM_TEMPERATURE || reaction_energy <= 0)) //If above FUSION_MAXIMUM_TEMPERATURE, will only adjust temperature for endothermic reactions.
air.temperature = clamp(((air.temperature * old_heat_capacity + reaction_energy) / new_heat_capacity), TCMB, INFINITY)
return REACTING

/datum/gas_reaction/nitrousformation //formationn of n2o, esothermic, requires bz as catalyst
priority = 3
name = "Nitrous Oxide formation"
Expand Down