mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 10:01:40 +00:00
Re-adds and reworks fusion. (#37384)
add: Fusion is back add: Fusion now happens with large quantities of hot plasma and CO2, consuming all the plasma rapidly and producing large amounts of energy. Other gases can also effect the performance of the reaction. add: Fusion now produces radiation. Be careful around reactors. fix: fixes fusion dividing by zero and destroying everything code: Gas reactions now have access to where they are occurring fix: Prevents some other reactions from producing matter from nothing
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
#define META_GAS_OVERLAY 4
|
#define META_GAS_OVERLAY 4
|
||||||
#define META_GAS_DANGER 5
|
#define META_GAS_DANGER 5
|
||||||
#define META_GAS_ID 6
|
#define META_GAS_ID 6
|
||||||
|
#define META_GAS_FUSION_POWER 7
|
||||||
//ATMOS
|
//ATMOS
|
||||||
//stuff you should probably leave well alone!
|
//stuff you should probably leave well alone!
|
||||||
#define R_IDEAL_GAS_EQUATION 8.31 //kPa*L/(K*mol)
|
#define R_IDEAL_GAS_EQUATION 8.31 //kPa*L/(K*mol)
|
||||||
|
|||||||
@@ -241,9 +241,9 @@
|
|||||||
message_admins("Explosive tank rupture! Last key to touch the tank was [src.fingerprintslast].")
|
message_admins("Explosive tank rupture! Last key to touch the tank was [src.fingerprintslast].")
|
||||||
log_game("Explosive tank rupture! Last key to touch the tank was [src.fingerprintslast].")
|
log_game("Explosive tank rupture! Last key to touch the tank was [src.fingerprintslast].")
|
||||||
//Give the gas a chance to build up more pressure through reacting
|
//Give the gas a chance to build up more pressure through reacting
|
||||||
air_contents.react()
|
air_contents.react(src)
|
||||||
air_contents.react()
|
air_contents.react(src)
|
||||||
air_contents.react()
|
air_contents.react(src)
|
||||||
pressure = air_contents.return_pressure()
|
pressure = air_contents.return_pressure()
|
||||||
var/range = (pressure-TANK_FRAGMENT_PRESSURE)/TANK_FRAGMENT_SCALE
|
var/range = (pressure-TANK_FRAGMENT_PRESSURE)/TANK_FRAGMENT_SCALE
|
||||||
var/turf/epicenter = get_turf(loc)
|
var/turf/epicenter = get_turf(loc)
|
||||||
|
|||||||
@@ -87,7 +87,7 @@
|
|||||||
else
|
else
|
||||||
var/datum/gas_mixture/affected = location.air.remove_ratio(volume/location.air.volume)
|
var/datum/gas_mixture/affected = location.air.remove_ratio(volume/location.air.volume)
|
||||||
affected.temperature = temperature
|
affected.temperature = temperature
|
||||||
affected.react()
|
affected.react(src)
|
||||||
temperature = affected.temperature
|
temperature = affected.temperature
|
||||||
volume = affected.reaction_results["fire"]*FIRE_GROWTH_RATE
|
volume = affected.reaction_results["fire"]*FIRE_GROWTH_RATE
|
||||||
location.assume_air(affected)
|
location.assume_air(affected)
|
||||||
|
|||||||
@@ -410,7 +410,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
|
|||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
/datum/gas_mixture/react(turf/open/dump_location)
|
/datum/gas_mixture/react(datum/holder)
|
||||||
. = NO_REACTION
|
. = NO_REACTION
|
||||||
var/list/cached_gases = gases
|
var/list/cached_gases = gases
|
||||||
if(!cached_gases.len)
|
if(!cached_gases.len)
|
||||||
@@ -459,7 +459,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
|
|||||||
//at this point, all requirements for the reaction are satisfied. we can now react()
|
//at this point, all requirements for the reaction are satisfied. we can now react()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
. |= reaction.react(src, dump_location)
|
. |= reaction.react(src, holder)
|
||||||
if (. & STOP_REACTIONS)
|
if (. & STOP_REACTIONS)
|
||||||
break
|
break
|
||||||
if(.)
|
if(.)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ GLOBAL_LIST_INIT(hardcoded_gases, list(/datum/gas/oxygen, /datum/gas/nitrogen, /
|
|||||||
/proc/meta_gas_list()
|
/proc/meta_gas_list()
|
||||||
. = subtypesof(/datum/gas)
|
. = subtypesof(/datum/gas)
|
||||||
for(var/gas_path in .)
|
for(var/gas_path in .)
|
||||||
var/list/gas_info = new(6)
|
var/list/gas_info = new(7)
|
||||||
var/datum/gas/gas = gas_path
|
var/datum/gas/gas = gas_path
|
||||||
|
|
||||||
gas_info[META_GAS_SPECIFIC_HEAT] = initial(gas.specific_heat)
|
gas_info[META_GAS_SPECIFIC_HEAT] = initial(gas.specific_heat)
|
||||||
@@ -11,6 +11,7 @@ GLOBAL_LIST_INIT(hardcoded_gases, list(/datum/gas/oxygen, /datum/gas/nitrogen, /
|
|||||||
gas_info[META_GAS_MOLES_VISIBLE] = initial(gas.moles_visible)
|
gas_info[META_GAS_MOLES_VISIBLE] = initial(gas.moles_visible)
|
||||||
if(initial(gas.moles_visible) != null)
|
if(initial(gas.moles_visible) != null)
|
||||||
gas_info[META_GAS_OVERLAY] = new /obj/effect/overlay/gas(initial(gas.gas_overlay))
|
gas_info[META_GAS_OVERLAY] = new /obj/effect/overlay/gas(initial(gas.gas_overlay))
|
||||||
|
gas_info[META_GAS_FUSION_POWER] = initial(gas.dangerous)
|
||||||
gas_info[META_GAS_DANGER] = initial(gas.dangerous)
|
gas_info[META_GAS_DANGER] = initial(gas.dangerous)
|
||||||
gas_info[META_GAS_ID] = initial(gas.id)
|
gas_info[META_GAS_ID] = initial(gas.id)
|
||||||
.[gas_path] = gas_info
|
.[gas_path] = gas_info
|
||||||
@@ -40,7 +41,7 @@ GLOBAL_LIST_INIT(hardcoded_gases, list(/datum/gas/oxygen, /datum/gas/nitrogen, /
|
|||||||
var/gas_overlay = "" //icon_state in icons/effects/tile_effects.dmi
|
var/gas_overlay = "" //icon_state in icons/effects/tile_effects.dmi
|
||||||
var/moles_visible = null
|
var/moles_visible = null
|
||||||
var/dangerous = FALSE //currently used by canisters
|
var/dangerous = FALSE //currently used by canisters
|
||||||
|
var/fusion_power = 0 //How much the gas accelerates a fusion reaction
|
||||||
/datum/gas/oxygen
|
/datum/gas/oxygen
|
||||||
id = "o2"
|
id = "o2"
|
||||||
specific_heat = 20
|
specific_heat = 20
|
||||||
@@ -55,6 +56,7 @@ GLOBAL_LIST_INIT(hardcoded_gases, list(/datum/gas/oxygen, /datum/gas/nitrogen, /
|
|||||||
id = "co2"
|
id = "co2"
|
||||||
specific_heat = 30
|
specific_heat = 30
|
||||||
name = "Carbon Dioxide"
|
name = "Carbon Dioxide"
|
||||||
|
fusion_power = 2
|
||||||
|
|
||||||
/datum/gas/plasma
|
/datum/gas/plasma
|
||||||
id = "plasma"
|
id = "plasma"
|
||||||
@@ -86,6 +88,7 @@ GLOBAL_LIST_INIT(hardcoded_gases, list(/datum/gas/oxygen, /datum/gas/nitrogen, /
|
|||||||
gas_overlay = "nitrous_oxide"
|
gas_overlay = "nitrous_oxide"
|
||||||
moles_visible = 1
|
moles_visible = 1
|
||||||
dangerous = TRUE
|
dangerous = TRUE
|
||||||
|
fusion_power = 2
|
||||||
|
|
||||||
/datum/gas/nitryl
|
/datum/gas/nitryl
|
||||||
id = "no2"
|
id = "no2"
|
||||||
@@ -94,6 +97,7 @@ GLOBAL_LIST_INIT(hardcoded_gases, list(/datum/gas/oxygen, /datum/gas/nitrogen, /
|
|||||||
gas_overlay = "nitryl"
|
gas_overlay = "nitryl"
|
||||||
moles_visible = MOLES_GAS_VISIBLE
|
moles_visible = MOLES_GAS_VISIBLE
|
||||||
dangerous = TRUE
|
dangerous = TRUE
|
||||||
|
fusion_power = 1.5
|
||||||
|
|
||||||
/datum/gas/tritium
|
/datum/gas/tritium
|
||||||
id = "tritium"
|
id = "tritium"
|
||||||
@@ -102,23 +106,24 @@ GLOBAL_LIST_INIT(hardcoded_gases, list(/datum/gas/oxygen, /datum/gas/nitrogen, /
|
|||||||
gas_overlay = "tritium"
|
gas_overlay = "tritium"
|
||||||
moles_visible = MOLES_GAS_VISIBLE
|
moles_visible = MOLES_GAS_VISIBLE
|
||||||
dangerous = TRUE
|
dangerous = TRUE
|
||||||
|
fusion_power = 2
|
||||||
/datum/gas/bz
|
/datum/gas/bz
|
||||||
id = "bz"
|
id = "bz"
|
||||||
specific_heat = 20
|
specific_heat = 20
|
||||||
name = "BZ"
|
name = "BZ"
|
||||||
dangerous = TRUE
|
dangerous = TRUE
|
||||||
|
fusion_power = 2
|
||||||
/datum/gas/stimulum
|
/datum/gas/stimulum
|
||||||
id = "stim"
|
id = "stim"
|
||||||
specific_heat = 5
|
specific_heat = 5
|
||||||
name = "Stimulum"
|
name = "Stimulum"
|
||||||
|
fusion_power = 7
|
||||||
|
|
||||||
/datum/gas/pluoxium
|
/datum/gas/pluoxium
|
||||||
id = "pluox"
|
id = "pluox"
|
||||||
specific_heat = 80
|
specific_heat = 80
|
||||||
name = "Pluoxium"
|
name = "Pluoxium"
|
||||||
|
fusion_power = 10
|
||||||
/obj/effect/overlay/gas
|
/obj/effect/overlay/gas
|
||||||
icon = 'icons/effects/tile_effects.dmi'
|
icon = 'icons/effects/tile_effects.dmi'
|
||||||
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
priority = INFINITY
|
priority = INFINITY
|
||||||
name = "Hyper-Noblium Reaction Supression"
|
name = "Hyper-Noblium Reaction Supression"
|
||||||
id = "nobstop"
|
id = "nobstop"
|
||||||
|
|
||||||
/datum/gas_reaction/nobliumsupression/init_reqs()
|
/datum/gas_reaction/nobliumsupression/init_reqs()
|
||||||
min_requirements = list(/datum/gas/hypernoblium = REACTION_OPPRESSION_THRESHOLD)
|
min_requirements = list(/datum/gas/hypernoblium = REACTION_OPPRESSION_THRESHOLD)
|
||||||
|
|
||||||
@@ -81,7 +82,8 @@
|
|||||||
/datum/gas_reaction/water_vapor/init_reqs()
|
/datum/gas_reaction/water_vapor/init_reqs()
|
||||||
min_requirements = list(/datum/gas/water_vapor = MOLES_GAS_VISIBLE)
|
min_requirements = list(/datum/gas/water_vapor = MOLES_GAS_VISIBLE)
|
||||||
|
|
||||||
/datum/gas_reaction/water_vapor/react(datum/gas_mixture/air, turf/open/location)
|
/datum/gas_reaction/water_vapor/react(datum/gas_mixture/air, datum/holder)
|
||||||
|
var/turf/open/location = isturf(holder) ? holder : null
|
||||||
. = NO_REACTION
|
. = NO_REACTION
|
||||||
if (air.temperature <= WATER_VAPOR_FREEZE)
|
if (air.temperature <= WATER_VAPOR_FREEZE)
|
||||||
if(location && location.freon_gas_act())
|
if(location && location.freon_gas_act())
|
||||||
@@ -99,13 +101,14 @@
|
|||||||
/datum/gas_reaction/fire/init_reqs()
|
/datum/gas_reaction/fire/init_reqs()
|
||||||
min_requirements = list("TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST) //doesn't include plasma reqs b/c of other, rarer, burning gases.
|
min_requirements = list("TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST) //doesn't include plasma reqs b/c of other, rarer, burning gases.
|
||||||
|
|
||||||
/datum/gas_reaction/fire/react(datum/gas_mixture/air, turf/open/location)
|
/datum/gas_reaction/fire/react(datum/gas_mixture/air, datum/holder)
|
||||||
var/energy_released = 0
|
var/energy_released = 0
|
||||||
var/old_heat_capacity = air.heat_capacity()
|
var/old_heat_capacity = air.heat_capacity()
|
||||||
var/list/cached_gases = air.gases //this speeds things up because accessing datum vars is slow
|
var/list/cached_gases = air.gases //this speeds things up because accessing datum vars is slow
|
||||||
var/temperature = air.temperature
|
var/temperature = air.temperature
|
||||||
var/list/cached_results = air.reaction_results
|
var/list/cached_results = air.reaction_results
|
||||||
cached_results[id] = 0
|
cached_results[id] = 0
|
||||||
|
var/turf/open/location = isturf(holder) ? holder : null
|
||||||
|
|
||||||
//General volatile gas burn
|
//General volatile gas burn
|
||||||
if(cached_gases[/datum/gas/tritium] && cached_gases[/datum/gas/tritium][MOLES])
|
if(cached_gases[/datum/gas/tritium] && cached_gases[/datum/gas/tritium][MOLES])
|
||||||
@@ -184,55 +187,76 @@
|
|||||||
|
|
||||||
return cached_results[id] ? REACTING : NO_REACTION
|
return cached_results[id] ? REACTING : NO_REACTION
|
||||||
|
|
||||||
//fusion: a terrible idea that was fun but broken. Now reworked to be less broken and more interesting.
|
//fusion: a terrible idea that was fun but broken. Now reworked to be less broken and more interesting. Again.
|
||||||
/datum/gas_reaction/fusion
|
/datum/gas_reaction/fusion
|
||||||
exclude = TRUE
|
exclude = FALSE
|
||||||
priority = 2
|
priority = 2
|
||||||
name = "Plasmic Fusion"
|
name = "Plasmic Fusion"
|
||||||
id = "fusion"
|
id = "fusion"
|
||||||
|
|
||||||
|
|
||||||
/datum/gas_reaction/fusion/init_reqs()
|
/datum/gas_reaction/fusion/init_reqs()
|
||||||
min_requirements = list(
|
min_requirements = list(
|
||||||
"ENER" = PLASMA_BINDING_ENERGY * 10,
|
"ENER" = PLASMA_BINDING_ENERGY * 1000,
|
||||||
/datum/gas/plasma = MINIMUM_HEAT_CAPACITY,
|
/datum/gas/plasma = 50,
|
||||||
/datum/gas/tritium = MINIMUM_HEAT_CAPACITY
|
/datum/gas/carbon_dioxide = 1
|
||||||
)
|
)
|
||||||
|
|
||||||
/datum/gas_reaction/fusion/react(datum/gas_mixture/air, turf/open/location)
|
/datum/gas_reaction/fusion/react(datum/gas_mixture/air, datum/holder)
|
||||||
var/list/cached_gases = air.gases
|
var/list/cached_gases = air.gases
|
||||||
var/temperature = air.temperature
|
var/temperature = air.temperature
|
||||||
|
var/turf/open/location
|
||||||
if(((cached_gases[/datum/gas/plasma][MOLES]+cached_gases[/datum/gas/tritium][MOLES])/air.total_moles() < FUSION_PURITY_THRESHOLD) || air.return_pressure() < 10*ONE_ATMOSPHERE)
|
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.
|
||||||
//Fusion wont occur if the level of impurities is too high or if there is too little pressure.
|
var/datum/pipeline/fusion_pipenet = holder
|
||||||
return NO_REACTION
|
location = get_turf(pick(fusion_pipenet.members))
|
||||||
|
else
|
||||||
|
location = get_turf(holder)
|
||||||
|
|
||||||
var/old_heat_capacity = air.heat_capacity()
|
var/old_heat_capacity = air.heat_capacity()
|
||||||
var/catalyst_efficency = max(min(cached_gases[/datum/gas/plasma][MOLES]/cached_gases[/datum/gas/tritium][MOLES],MAX_CATALYST_EFFICENCY)-(temperature/FUSION_HEAT_DROPOFF),1)
|
var/reaction_energy
|
||||||
var/reaction_energy = THERMAL_ENERGY(air)
|
var/mediation = 100*(air.heat_capacity()-(cached_gases[/datum/gas/plasma][MOLES]*cached_gases[/datum/gas/plasma][GAS_META][META_GAS_SPECIFIC_HEAT]))/(air.total_moles()-cached_gases[/datum/gas/plasma][MOLES]) //This is the average heat capacity of the mixture,not including plasma.
|
||||||
var/moles_impurities = max(air.total_moles()-(cached_gases[/datum/gas/plasma][MOLES]+cached_gases[/datum/gas/tritium][MOLES]),1) //This makes it assume a minimum of 1 mol impurities so the reaction energy doesn't divide by 0
|
var/gas_power = 0
|
||||||
|
for (var/id in cached_gases)
|
||||||
|
gas_power += cached_gases[id][GAS_META][META_GAS_FUSION_POWER]*cached_gases[id][MOLES]
|
||||||
|
var/plasma_fused = 0
|
||||||
|
var/power_ratio = min(gas_power/mediation,100)//100 is a lot, we really don't want to go over this.
|
||||||
|
if (power_ratio > 10) //Super-fusion. Fuses everything into one big atom which then turns to tritium instantly. Very dangerous, but super cool.
|
||||||
|
var/gases_fused = air.total_moles()
|
||||||
|
reaction_energy += gases_fused*PLASMA_BINDING_ENERGY*(gas_power/(mediation*100))
|
||||||
|
for (var/id in cached_gases)
|
||||||
|
cached_gases[id][MOLES] = 0
|
||||||
|
air.assert_gas(/datum/gas/tritium)
|
||||||
|
cached_gases[/datum/gas/tritium][MOLES] += gases_fused
|
||||||
|
if (prob(power_ratio)) //You really don't want this to happen
|
||||||
|
empulse(location, power_ratio*0.5, power_ratio)
|
||||||
|
radiation_pulse(location, power_ratio*2000)
|
||||||
|
explosion(location,0,1,power_ratio*0.5,power_ratio,TRUE,TRUE)//Bypasses cap. Doesn't blow large hole in station, but produces moderate devestation for long ranges. Be careful with this.
|
||||||
|
|
||||||
var/plasma_fused = min((PLASMA_FUSED_COEFFICENT*catalyst_efficency)*(temperature/PLASMA_BINDING_ENERGY)/10,cached_gases[/datum/gas/plasma][MOLES]) //Preserve matter
|
else if (power_ratio > 1) //Mediation is overpowered, fusion reaction starts to break down.
|
||||||
var/tritium_catalyzed = min((CATALYST_COEFFICENT*catalyst_efficency)*(temperature/PLASMA_BINDING_ENERGY)/40,cached_gases[/datum/gas/tritium][MOLES]) //Ditto
|
plasma_fused = cached_gases[/datum/gas/plasma][MOLES]
|
||||||
var/oxygen_added = tritium_catalyzed
|
reaction_energy += plasma_fused*PLASMA_BINDING_ENERGY
|
||||||
var/waste_added = max((plasma_fused-oxygen_added)-((air.total_moles()*air.heat_capacity())/PLASMA_BINDING_ENERGY),0)
|
cached_gases[/datum/gas/plasma][MOLES] -= plasma_fused
|
||||||
reaction_energy = max(reaction_energy+((catalyst_efficency*cached_gases[/datum/gas/plasma][MOLES])/((moles_impurities/catalyst_efficency)+2)*10)+((plasma_fused/(moles_impurities/catalyst_efficency))*PLASMA_BINDING_ENERGY),0)
|
cached_gases[/datum/gas/carbon_dioxide][MOLES] = 0
|
||||||
|
air.assert_gases(/datum/gas/bz,/datum/gas/nitrous_oxide)
|
||||||
air.assert_gases(/datum/gas/oxygen, /datum/gas/carbon_dioxide, /datum/gas/water_vapor, /datum/gas/nitrous_oxide, /datum/gas/nitryl)
|
cached_gases[/datum/gas/bz][MOLES] += gas_power*0.05
|
||||||
//Fusion produces an absurd amount of waste products now, requiring active filtration.
|
cached_gases[/datum/gas/nitrous_oxide][MOLES] += gas_power*0.05
|
||||||
cached_gases[/datum/gas/plasma][MOLES] = max(cached_gases[/datum/gas/plasma][MOLES] - plasma_fused,0)
|
if (location)
|
||||||
cached_gases[/datum/gas/tritium][MOLES] = max(cached_gases[/datum/gas/tritium][MOLES] - tritium_catalyzed,0)
|
empulse(location, mediation*0.002, mediation*0.004)
|
||||||
cached_gases[/datum/gas/oxygen][MOLES] += oxygen_added
|
radiation_pulse(location, power_ratio*(reaction_energy)/(0.3*PLASMA_BINDING_ENERGY))
|
||||||
cached_gases[/datum/gas/water_vapor][MOLES] += waste_added
|
else
|
||||||
cached_gases[/datum/gas/nitrous_oxide][MOLES] += waste_added
|
reaction_energy += cached_gases[/datum/gas/plasma][MOLES]*PLASMA_BINDING_ENERGY*(gas_power/mediation)
|
||||||
cached_gases[/datum/gas/nitryl][MOLES] += waste_added
|
air.assert_gas(/datum/gas/oxygen)
|
||||||
cached_gases[/datum/gas/carbon_dioxide][MOLES] += waste_added
|
cached_gases[/datum/gas/oxygen][MOLES] += gas_power + cached_gases[/datum/gas/plasma][MOLES]
|
||||||
if (location)
|
cached_gases[/datum/gas/plasma][MOLES] = 0
|
||||||
radiation_pulse(location, reaction_energy/(PLASMA_BINDING_ENERGY*MAX_CATALYST_EFFICENCY))
|
for (var/gas in cached_gases)
|
||||||
|
if (cached_gases[gas][GAS_META][META_GAS_FUSION_POWER])
|
||||||
|
cached_gases[gas][MOLES] = 0
|
||||||
|
if (location)
|
||||||
|
radiation_pulse(location, (reaction_energy)/(0.3*PLASMA_BINDING_ENERGY))
|
||||||
if(reaction_energy > 0)
|
if(reaction_energy > 0)
|
||||||
var/new_heat_capacity = air.heat_capacity()
|
var/new_heat_capacity = air.heat_capacity()
|
||||||
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
|
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
|
||||||
air.temperature = max(((temperature*old_heat_capacity + reaction_energy)/new_heat_capacity),TCMB)
|
air.temperature = max(((temperature*old_heat_capacity + reaction_energy)/new_heat_capacity),TCMB)
|
||||||
//Prevents whatever mechanism is causing it to hit negative temperatures.
|
|
||||||
return REACTING
|
return REACTING
|
||||||
|
|
||||||
/datum/gas_reaction/nitrylformation //The formation of nitryl. Endothermic. Requires N2O as a catalyst.
|
/datum/gas_reaction/nitrylformation //The formation of nitryl. Endothermic. Requires N2O as a catalyst.
|
||||||
@@ -256,7 +280,8 @@
|
|||||||
var/heat_efficency = min(temperature/(FIRE_MINIMUM_TEMPERATURE_TO_EXIST*100),cached_gases[/datum/gas/oxygen][MOLES],cached_gases[/datum/gas/nitrogen][MOLES])
|
var/heat_efficency = min(temperature/(FIRE_MINIMUM_TEMPERATURE_TO_EXIST*100),cached_gases[/datum/gas/oxygen][MOLES],cached_gases[/datum/gas/nitrogen][MOLES])
|
||||||
var/energy_used = heat_efficency*NITRYL_FORMATION_ENERGY
|
var/energy_used = heat_efficency*NITRYL_FORMATION_ENERGY
|
||||||
ASSERT_GAS(/datum/gas/nitryl,air)
|
ASSERT_GAS(/datum/gas/nitryl,air)
|
||||||
|
if ((cached_gases[/datum/gas/oxygen][MOLES] - heat_efficency < 0 )|| (cached_gases[/datum/gas/nitrogen][MOLES] - heat_efficency < 0)) //Shouldn't produce gas from nothing.
|
||||||
|
return NO_REACTION
|
||||||
cached_gases[/datum/gas/oxygen][MOLES] -= heat_efficency
|
cached_gases[/datum/gas/oxygen][MOLES] -= heat_efficency
|
||||||
cached_gases[/datum/gas/nitrogen][MOLES] -= heat_efficency
|
cached_gases[/datum/gas/nitrogen][MOLES] -= heat_efficency
|
||||||
cached_gases[/datum/gas/nitryl][MOLES] += heat_efficency*2
|
cached_gases[/datum/gas/nitryl][MOLES] += heat_efficency*2
|
||||||
@@ -287,11 +312,12 @@
|
|||||||
var/old_heat_capacity = air.heat_capacity()
|
var/old_heat_capacity = air.heat_capacity()
|
||||||
var/reaction_efficency = min(1/((pressure/(0.1*ONE_ATMOSPHERE))*(max(cached_gases[/datum/gas/plasma][MOLES]/cached_gases[/datum/gas/tritium][MOLES],1))),cached_gases[/datum/gas/tritium][MOLES],cached_gases[/datum/gas/plasma][MOLES]/2)
|
var/reaction_efficency = min(1/((pressure/(0.1*ONE_ATMOSPHERE))*(max(cached_gases[/datum/gas/plasma][MOLES]/cached_gases[/datum/gas/tritium][MOLES],1))),cached_gases[/datum/gas/tritium][MOLES],cached_gases[/datum/gas/plasma][MOLES]/2)
|
||||||
var/energy_released = 2*reaction_efficency*FIRE_CARBON_ENERGY_RELEASED
|
var/energy_released = 2*reaction_efficency*FIRE_CARBON_ENERGY_RELEASED
|
||||||
|
if ((cached_gases[/datum/gas/tritium][MOLES] - reaction_efficency < 0 )|| (cached_gases[/datum/gas/plasma][MOLES] - (2*reaction_efficency) < 0)) //Shouldn't produce gas from nothing.
|
||||||
|
return NO_REACTION
|
||||||
ASSERT_GAS(/datum/gas/bz,air)
|
ASSERT_GAS(/datum/gas/bz,air)
|
||||||
cached_gases[/datum/gas/bz][MOLES]+= reaction_efficency
|
cached_gases[/datum/gas/bz][MOLES] += reaction_efficency
|
||||||
cached_gases[/datum/gas/tritium][MOLES] = max(cached_gases[/datum/gas/tritium][MOLES]- reaction_efficency,0)
|
cached_gases[/datum/gas/tritium][MOLES] -= reaction_efficency
|
||||||
cached_gases[/datum/gas/plasma][MOLES] = max(cached_gases[/datum/gas/plasma][MOLES] - (2*reaction_efficency),0)
|
cached_gases[/datum/gas/plasma][MOLES] -= 2*reaction_efficency
|
||||||
|
|
||||||
|
|
||||||
if(energy_released > 0)
|
if(energy_released > 0)
|
||||||
@@ -320,10 +346,12 @@
|
|||||||
var/stim_energy_change = heat_scale + STIMULUM_FIRST_RISE*(heat_scale**2) - STIMULUM_FIRST_DROP*(heat_scale**3) + STIMULUM_SECOND_RISE*(heat_scale**4) - STIMULUM_ABSOLUTE_DROP*(heat_scale**5)
|
var/stim_energy_change = heat_scale + STIMULUM_FIRST_RISE*(heat_scale**2) - STIMULUM_FIRST_DROP*(heat_scale**3) + STIMULUM_SECOND_RISE*(heat_scale**4) - STIMULUM_ABSOLUTE_DROP*(heat_scale**5)
|
||||||
|
|
||||||
ASSERT_GAS(/datum/gas/stimulum,air)
|
ASSERT_GAS(/datum/gas/stimulum,air)
|
||||||
|
if ((cached_gases[/datum/gas/tritium][MOLES] - heat_scale < 0 )|| (cached_gases[/datum/gas/plasma][MOLES] - heat_scale < 0) || (cached_gases[/datum/gas/nitryl][MOLES] - heat_scale < 0)) //Shouldn't produce gas from nothing.
|
||||||
|
return NO_REACTION
|
||||||
cached_gases[/datum/gas/stimulum][MOLES]+= heat_scale/10
|
cached_gases[/datum/gas/stimulum][MOLES]+= heat_scale/10
|
||||||
cached_gases[/datum/gas/tritium][MOLES] = max(cached_gases[/datum/gas/tritium][MOLES]- heat_scale,0)
|
cached_gases[/datum/gas/tritium][MOLES] -= heat_scale
|
||||||
cached_gases[/datum/gas/plasma][MOLES] = max(cached_gases[/datum/gas/plasma][MOLES]- heat_scale,0)
|
cached_gases[/datum/gas/plasma][MOLES] -= heat_scale
|
||||||
cached_gases[/datum/gas/nitryl][MOLES] = max(cached_gases[/datum/gas/nitryl][MOLES]- heat_scale,0)
|
cached_gases[/datum/gas/nitryl][MOLES] -= heat_scale
|
||||||
|
|
||||||
if(stim_energy_change)
|
if(stim_energy_change)
|
||||||
var/new_heat_capacity = air.heat_capacity()
|
var/new_heat_capacity = air.heat_capacity()
|
||||||
@@ -348,6 +376,8 @@
|
|||||||
var/old_heat_capacity = air.heat_capacity()
|
var/old_heat_capacity = air.heat_capacity()
|
||||||
var/nob_formed = min((cached_gases[/datum/gas/nitrogen][MOLES]+cached_gases[/datum/gas/tritium][MOLES])/100,cached_gases[/datum/gas/tritium][MOLES]/10,cached_gases[/datum/gas/nitrogen][MOLES]/20)
|
var/nob_formed = min((cached_gases[/datum/gas/nitrogen][MOLES]+cached_gases[/datum/gas/tritium][MOLES])/100,cached_gases[/datum/gas/tritium][MOLES]/10,cached_gases[/datum/gas/nitrogen][MOLES]/20)
|
||||||
var/energy_taken = nob_formed*(NOBLIUM_FORMATION_ENERGY/(max(cached_gases[/datum/gas/bz][MOLES],1)))
|
var/energy_taken = nob_formed*(NOBLIUM_FORMATION_ENERGY/(max(cached_gases[/datum/gas/bz][MOLES],1)))
|
||||||
|
if ((cached_gases[/datum/gas/tritium][MOLES] - 10*nob_formed < 0) || (cached_gases[/datum/gas/nitrogen][MOLES] - 20*nob_formed < 0))
|
||||||
|
return NO_REACTION
|
||||||
cached_gases[/datum/gas/tritium][MOLES] = max(cached_gases[/datum/gas/tritium][MOLES]- 10*nob_formed,0)
|
cached_gases[/datum/gas/tritium][MOLES] = max(cached_gases[/datum/gas/tritium][MOLES]- 10*nob_formed,0)
|
||||||
cached_gases[/datum/gas/nitrogen][MOLES] = max(cached_gases[/datum/gas/nitrogen][MOLES]- 20*nob_formed,0)
|
cached_gases[/datum/gas/nitrogen][MOLES] = max(cached_gases[/datum/gas/nitrogen][MOLES]- 20*nob_formed,0)
|
||||||
cached_gases[/datum/gas/hypernoblium][MOLES]+= nob_formed
|
cached_gases[/datum/gas/hypernoblium][MOLES]+= nob_formed
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
if(update)
|
if(update)
|
||||||
update = FALSE
|
update = FALSE
|
||||||
reconcile_air()
|
reconcile_air()
|
||||||
update = air.react()
|
update = air.react(src)
|
||||||
|
|
||||||
/datum/pipeline/proc/build_pipeline(obj/machinery/atmospherics/base)
|
/datum/pipeline/proc/build_pipeline(obj/machinery/atmospherics/base)
|
||||||
var/volume = 0
|
var/volume = 0
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
/obj/machinery/portable_atmospherics/process_atmos()
|
/obj/machinery/portable_atmospherics/process_atmos()
|
||||||
if(!connected_port) // Pipe network handles reactions if connected.
|
if(!connected_port) // Pipe network handles reactions if connected.
|
||||||
air_contents.react()
|
air_contents.react(src)
|
||||||
else
|
else
|
||||||
update_icon()
|
update_icon()
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
temp.merge(bomb.tank_one.air_contents.remove_ratio(1))
|
temp.merge(bomb.tank_one.air_contents.remove_ratio(1))
|
||||||
temp.merge(bomb.tank_two.air_contents.remove_ratio(2))
|
temp.merge(bomb.tank_two.air_contents.remove_ratio(2))
|
||||||
for(var/i in 1 to 6)
|
for(var/i in 1 to 6)
|
||||||
temp.react()
|
temp.react(src)
|
||||||
var/pressure = temp.return_pressure()
|
var/pressure = temp.return_pressure()
|
||||||
qdel(temp)
|
qdel(temp)
|
||||||
if(pressure < TANK_FRAGMENT_PRESSURE)
|
if(pressure < TANK_FRAGMENT_PRESSURE)
|
||||||
|
|||||||
@@ -438,7 +438,7 @@
|
|||||||
if(hotspot)
|
if(hotspot)
|
||||||
var/datum/gas_mixture/lowertemp = T.remove_air(T.air.total_moles())
|
var/datum/gas_mixture/lowertemp = T.remove_air(T.air.total_moles())
|
||||||
lowertemp.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0)
|
lowertemp.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0)
|
||||||
lowertemp.react()
|
lowertemp.react(src)
|
||||||
T.assume_air(lowertemp)
|
T.assume_air(lowertemp)
|
||||||
qdel(hotspot)
|
qdel(hotspot)
|
||||||
|
|
||||||
|
|||||||
@@ -146,7 +146,7 @@
|
|||||||
if(T.air)
|
if(T.air)
|
||||||
var/datum/gas_mixture/G = T.air
|
var/datum/gas_mixture/G = T.air
|
||||||
G.temperature = max(min(G.temperature-(CT*1000),G.temperature/CT),0)
|
G.temperature = max(min(G.temperature-(CT*1000),G.temperature/CT),0)
|
||||||
G.react()
|
G.react(src)
|
||||||
qdel(hotspot)
|
qdel(hotspot)
|
||||||
var/obj/effect/acid/A = (locate(/obj/effect/acid) in T)
|
var/obj/effect/acid/A = (locate(/obj/effect/acid) in T)
|
||||||
if(A)
|
if(A)
|
||||||
|
|||||||
@@ -273,7 +273,7 @@
|
|||||||
var/datum/gas_mixture/G = T.air
|
var/datum/gas_mixture/G = T.air
|
||||||
if(G.temperature > T20C)
|
if(G.temperature > T20C)
|
||||||
G.temperature = max(G.temperature/2,T20C)
|
G.temperature = max(G.temperature/2,T20C)
|
||||||
G.react()
|
G.react(src)
|
||||||
qdel(hotspot)
|
qdel(hotspot)
|
||||||
|
|
||||||
/datum/reagent/firefighting_foam/reaction_obj(obj/O, reac_volume)
|
/datum/reagent/firefighting_foam/reaction_obj(obj/O, reac_volume)
|
||||||
|
|||||||
Reference in New Issue
Block a user