* stuff i'll have to fix anyway when n2o gets merged

* everything except the finished reactions

* freon coolant reaction but with bad curve

* miasmic subsumation

* freon production

* nitrogen and diff temp scaling

* uhh meant to change that

* #

* hitting that frezon boof
This commit is contained in:
Kara
2022-07-27 02:55:28 -07:00
committed by GitHub
parent 86089f2213
commit 7a553781cc
24 changed files with 344 additions and 13 deletions

View File

@@ -18,13 +18,16 @@ namespace Content.Server.Atmos
public static GasMixture SpaceGas => new() {Volume = Atmospherics.CellVolume, Temperature = Atmospherics.TCMB, Immutable = true};
// This must always have a length that is a multiple of 4 for SIMD acceleration.
[DataField("moles")] [ViewVariables]
[DataField("moles")]
[ViewVariables(VVAccess.ReadWrite)]
public float[] Moles = new float[Atmospherics.AdjustedNumberOfGases];
[DataField("temperature")] [ViewVariables]
[DataField("temperature")]
[ViewVariables(VVAccess.ReadWrite)]
private float _temperature = Atmospherics.TCMB;
[DataField("immutable")] [ViewVariables]
[DataField("immutable")]
[ViewVariables]
public bool Immutable { get; private set; }
[ViewVariables]
@@ -62,7 +65,8 @@ namespace Content.Server.Atmos
}
}
[DataField("volume")] [ViewVariables]
[DataField("volume")]
[ViewVariables(VVAccess.ReadWrite)]
public float Volume { get; set; }
public GasMixture()

View File

@@ -3,6 +3,7 @@ using Content.Server.Atmos.Reactions;
namespace Content.Server.Atmos
{
[ImplicitDataDefinitionForInheritors]
public interface IGasReactionEffect
{
ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem);

View File

@@ -29,7 +29,8 @@ namespace Content.Server.Atmos.Portable
Gas.Tritium,
Gas.WaterVapor,
Gas.Miasma,
Gas.NitrousOxide
Gas.NitrousOxide,
Gas.Frezon
};
/// <summary>

View File

@@ -0,0 +1,58 @@
using Content.Server.Atmos.EntitySystems;
using Content.Shared.Atmos;
using JetBrains.Annotations;
namespace Content.Server.Atmos.Reactions;
/// <summary>
/// Takes in nitrogen and frezon and cools down the surrounding area.
/// </summary>
[UsedImplicitly]
public sealed class FrezonCoolantReaction : IGasReactionEffect
{
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem)
{
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
var temperature = mixture.Temperature;
var energyModifier = 1f;
var scale = (temperature - Atmospherics.FrezonCoolLowerTemperature) /
(Atmospherics.FrezonCoolMidTemperature - Atmospherics.FrezonCoolLowerTemperature);
if (scale > 1f)
{
// Scale energy but not frezon usage if we're in a very, very hot place
energyModifier = Math.Min(scale, Atmospherics.FrezonCoolMaximumEnergyModifier);
scale = 1f;
}
if (scale <= 0)
return ReactionResult.NoReaction;
var initialNit = mixture.GetMoles(Gas.Nitrogen);
var initialFrezon = mixture.GetMoles(Gas.Frezon);
var burnRate = initialFrezon * scale / Atmospherics.FrezonCoolRateModifier;
var energyReleased = 0f;
if (burnRate > Atmospherics.MinimumHeatCapacity)
{
var nitAmt = Math.Min(burnRate * Atmospherics.FrezonNitrogenCoolRatio, initialNit);
var frezonAmt = Math.Min(burnRate, initialFrezon);
mixture.AdjustMoles(Gas.Nitrogen, -nitAmt);
mixture.AdjustMoles(Gas.Frezon, -frezonAmt);
// TODO nitrous oxide
mixture.AdjustMoles(Gas.CarbonDioxide, nitAmt + frezonAmt);
energyReleased = burnRate * Atmospherics.FrezonCoolEnergyReleased * energyModifier;
}
if (energyReleased >= 0f)
return ReactionResult.NoReaction;
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture);
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity)
mixture.Temperature = (temperature * oldHeatCapacity + energyReleased) / newHeatCapacity;
return ReactionResult.Reacting;
}
}

View File

@@ -0,0 +1,40 @@
using Content.Server.Atmos.EntitySystems;
using Content.Shared.Atmos;
using JetBrains.Annotations;
namespace Content.Server.Atmos.Reactions;
/// <summary>
/// Produces frezon from oxygen and tritium, with nitrogen as a catalyst that also acts as a stopper if too much is present.
/// Has a max temperature, but paradoxically gets more efficient the hotter it is.
/// </summary>
[UsedImplicitly]
public sealed class FrezonProductionReaction : IGasReactionEffect
{
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem)
{
var initialN2 = mixture.GetMoles(Gas.Nitrogen);
var initialOxy = mixture.GetMoles(Gas.Oxygen);
var initialTrit = mixture.GetMoles(Gas.Tritium);
var efficiency = mixture.Temperature / Atmospherics.FrezonProductionMaxEfficiencyTemperature;
var loss = 1 - efficiency;
// Less N2 is required the more efficient it is.
var minimumN2 = (initialOxy + initialTrit) / (Atmospherics.FrezonProductionNitrogenRatio * efficiency);
if (initialN2 < minimumN2)
return ReactionResult.NoReaction;
var oxyConversion = initialOxy / Atmospherics.FrezonProductionConversionRate;
var tritConversion = initialTrit / Atmospherics.FrezonProductionConversionRate;
var total = oxyConversion + tritConversion;
mixture.AdjustMoles(Gas.Oxygen, -oxyConversion);
mixture.AdjustMoles(Gas.Tritium, -tritConversion);
mixture.AdjustMoles(Gas.Frezon, total * efficiency);
mixture.AdjustMoles(Gas.Nitrogen, total * loss);
return ReactionResult.Reacting;
}
}

View File

@@ -0,0 +1,25 @@
using Content.Server.Atmos.EntitySystems;
using Content.Shared.Atmos;
using JetBrains.Annotations;
namespace Content.Server.Atmos.Reactions;
/// <summary>
/// Converts frezon into miasma when the two come into contact. Does not occur at very high temperatures.
/// </summary>
[UsedImplicitly]
public sealed class MiasmicSubsumationReaction : IGasReactionEffect
{
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem)
{
var initialMiasma = mixture.GetMoles(Gas.Miasma);
var initialFrezon = mixture.GetMoles(Gas.Frezon);
var convert = Math.Min(Math.Min(initialFrezon, initialMiasma), Atmospherics.MiasmicSubsumationMaxConversionRate);
mixture.AdjustMoles(Gas.Miasma, convert);
mixture.AdjustMoles(Gas.Frezon, -convert);
return ReactionResult.Reacting;
}
}

View File

@@ -15,10 +15,12 @@ namespace Content.Server.StationEvents.Events
public override string Prototype => "GasLeak";
private static readonly Gas[] LeakableGases = {
private static readonly Gas[] LeakableGases =
{
Gas.Miasma,
Gas.Plasma,
Gas.Tritium,
Gas.Frezon,
};
/// <summary>

View File

@@ -29,6 +29,7 @@ public sealed class GasArtifactComponent : Component
Gas.Tritium,
Gas.Miasma,
Gas.NitrousOxide,
Gas.Frezon
};
/// <summary>

View File

@@ -20,6 +20,7 @@ public sealed class ArtifactGasTriggerComponent : Component
Gas.CarbonDioxide,
Gas.Miasma,
Gas.NitrousOxide,
Gas.Frezon
};
/// <summary>

View File

@@ -168,7 +168,7 @@ namespace Content.Shared.Atmos
/// <summary>
/// Total number of gases. Increase this if you want to add more!
/// </summary>
public const int TotalNumberOfGases = 8;
public const int TotalNumberOfGases = 9;
/// <summary>
/// This is the actual length of the gases arrays in mixtures.
@@ -202,6 +202,36 @@ namespace Content.Shared.Atmos
public const float TritiumBurnOxyFactor = 100f;
public const float TritiumBurnTritFactor = 10f;
public const float FrezonCoolLowerTemperature = 23.15f;
/// <summary>
/// Frezon cools better at higher temperatures.
/// </summary>
public const float FrezonCoolMidTemperature = 373.15f;
public const float FrezonCoolMaximumEnergyModifier = 10f;
/// <summary>
/// Remove X mol of nitrogen for each mol of frezon.
/// </summary>
public const float FrezonNitrogenCoolRatio = 5;
public const float FrezonCoolEnergyReleased = -3000000f;
public const float FrezonCoolRateModifier = 20f;
public const float FrezonProductionMaxEfficiencyTemperature = 73.15f;
/// <summary>
/// 1 mol of N2 is required per X mol of tritium and oxygen.
/// </summary>
public const float FrezonProductionNitrogenRatio = 10f;
public const float FrezonProductionConversionRate = 50f;
/// <summary>
/// How many mol of frezon can be converted into miasma in one cycle.
/// </summary>
public const float MiasmicSubsumationMaxConversionRate = 5f;
/// <summary>
/// Determines at what pressure the ultra-high pressure red icon is displayed.
/// </summary>
@@ -286,6 +316,7 @@ namespace Content.Shared.Atmos
Tritium = 4,
WaterVapor = 5,
Miasma = 6,
NitrousOxide = 7
NitrousOxide = 7,
Frezon = 8
}
}

View File

@@ -21,7 +21,8 @@ namespace Content.Shared.Atmos.Piping.Unary.Components
Gas.Tritium,
Gas.WaterVapor,
Gas.Miasma,
Gas.NitrousOxide
Gas.NitrousOxide,
Gas.Frezon
};
// Presets for 'dumb' air alarm modes

View File

@@ -0,0 +1,2 @@
frezon-lungs-cold = Your lungs feel colder..
frezon-euphoric = You feel chilly, but euphoric..

View File

@@ -18,3 +18,6 @@ reagent-desc-miasma = Uh oh, stinky!
reagent-name-nitrous-oxide = nitrous oxide
reagent-desc-nitrous-oxide = You know how everything seems funnier when you're tired? Well...
reagent-name-frezon = frezon
reagent-desc-frezon = A highly effective coolant.. and hallucinogenic.

View File

@@ -77,3 +77,15 @@
molarMass: 44
color: 2887E8
reagent: NitrousOxide
- type: gas
id: 8
name: Frezon
specificHeat: 600 # Strongest by far
heatCapacityRatio: 1.33
molarMass: 50
gasOverlaySprite: /Textures/Effects/atmospherics.rsi
gasOverlayState: frezon
gasMolesVisible: 0.6
color: 3a758c
reagent: Frezon

View File

@@ -23,6 +23,54 @@
effects:
- !type:TritiumFireReaction {}
- type: gasReaction
id: FrezonCoolant
priority: 1
minimumTemperature: 23.15
minimumRequirements:
- 0 # oxygen
- 0.01 # nitrogen
- 0 # carbon dioxide
- 0 # plasma
- 0 # tritium
- 0 # vapor
- 0 # miasma
- 0.01 # frezon
effects:
- !type:FrezonCoolantReaction {}
- type: gasReaction
id: FrezonProduction
priority: 2
maximumTemperature: 73.15 # Cold tritium fire, basically.
minimumRequirements:
- 0.01 # oxygen
- 0.01 # nitrogen
- 0 # carbon dioxide
- 0 # plasma
- 0.01 # tritium
- 0 # vapor
- 0 # miasma
- 0 # frezon
effects:
- !type:FrezonProductionReaction {}
- type: gasReaction
id: MiasmicSubsumation
priority: 0
maximumTemperature: 5066.25
minimumRequirements:
- 0 # oxygen
- 0 # nitrogen
- 0 # carbon dioxide
- 0 # plasma
- 0 # tritium
- 0 # vapor
- 0.01 # miasma
- 0.01 # frezon
effects:
- !type:MiasmicSubsumationReaction {}
#- type: gasReaction
# id: WaterVaporPuddle
# priority: 1

View File

@@ -12,7 +12,7 @@
- shader: unshaded
map: ["enum.EffectLayers.Unshaded"]
sprite: Effects/atmospherics.rsi
state: freon_old
state: frezon_old
- type: EffectVisuals
- type: AnimationPlayer

View File

@@ -428,6 +428,44 @@
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: entity
parent: GasCanister
id: FrezonCanister
name: frezon canister
description: A coolant with light hallucinogenic properties. Proceed.
components:
- type: Sprite
layers:
- state: frezon
- type: GasCanister
gasMixture:
volume: 1000
moles:
- 0 # oxygen
- 0 # nitrogen
- 0 # CO2
- 0 # Plasma
- 0 # Tritium
- 0 # Water vapor
- 0 # Miasma
- 1871.71051 # Frezon
temperature: 293.15
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 300
behaviors:
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
- !type:SpawnEntitiesBehavior
spawn:
FrezonCanisterBroken:
min: 1
max: 1
- !type:DoActsBehavior
acts: [ "Destruction" ]
# Broke Entities
@@ -562,3 +600,12 @@
components:
- type: Sprite
state: redws-1
- type: entity
parent: GasCanisterBrokenBase
id: FrezonCanisterBroken
name: broken frezon canister
noSpawn: true
components:
- type: Sprite
state: frezon-1

View File

@@ -280,3 +280,57 @@
damage:
types:
Poison: 0.25
- type: reagent
id: Frezon
name: reagent-name-frezon
desc: reagent-desc-frezon
physicalDesc: reagent-physical-desc-gaseous
color: "#3a758c"
boilingPoint: -195.8
meltingPoint: -210.0
metabolisms:
Gas:
effects:
- !type:HealthChange
conditions:
- !type:ReagentThreshold
reagent: Frezon
min: 0.5
scaleByQuantity: true
ignoreResistances: true
damage:
types:
Cellular: 0.01
- !type:GenericStatusEffect
conditions:
- !type:ReagentThreshold
reagent: Frezon
min: 1
key: SeeingRainbows
component: SeeingRainbows
type: Add
time: 5
refresh: false
- !type:Drunk
conditions:
- !type:ReagentThreshold
reagent: Frezon
min: 1
- !type:PopupMessage
type: Local
messages: [ "frezon-lungs-cold" ]
probability: 0.1
conditions:
- !type:ReagentThreshold
reagent: Frezon
min: 0.5
- !type:PopupMessage
type: Local
visualType: Medium
messages: [ "frezon-euphoric" ]
probability: 0.1
conditions:
- !type:ReagentThreshold
reagent: Frezon
min: 1

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 599 B

After

Width:  |  Height:  |  Size: 599 B

View File

@@ -1 +1 @@
{"version": 1, "size": {"x": 32, "y": 32}, "license": "CC-BY-SA-3.0", "copyright": "Taken from https://github.com/tgstation/tgstation at 04e43d8c1d5097fdb697addd4395fb849dd341bd", "states": [{"name": "chem_gas_old", "delays": [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1]]}, {"name": "freon", "delays": [[0.2, 0.2, 0.2, 0.3, 0.3, 0.2, 0.2, 0.2]]}, {"name": "freon_old", "delays": [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1]]}, {"name": "fusion_gas", "delays": [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1]]}, {"name": "miasma", "delays": [[0.2, 0.2, 0.2, 0.3, 0.3, 0.2, 0.2, 0.2]]}, {"name": "miasma_old", "delays": [[0.22999999999999998, 0.22999999999999998, 0.22999999999999998, 0.22999999999999998, 0.22999999999999998, 0.22999999999999998]]}, {"name": "nitrous_oxide", "delays": [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]]}, {"name": "nitrous_oxide_old", "delays": [[0.2, 0.2, 0.2]]}, {"name": "nitryl", "delays": [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]]}, {"name": "nitryl_old", "delays": [[0.1, 0.1, 0.1, 0.1]]}, {"name": "plasma", "delays": [[0.1, 0.1, 0.1]]}, {"name": "plasma_old", "delays": [[0.2, 0.2, 0.2]]}, {"name": "tritium", "delays": [[0.1, 0.1, 0.1, 0.1, 0.1]]}, {"name": "tritium_old", "delays": [[0.1, 0.1, 0.1, 0.1, 0.1]]}, {"name": "water_vapor", "delays": [[0.2, 0.2, 0.2, 0.3, 0.3, 0.2, 0.2, 0.2]]}, {"name": "water_vapor_old", "delays": [[0.2, 0.2, 0.2, 0.2, 0.2, 0.2]]}]}
{"version": 1, "size": {"x": 32, "y": 32}, "license": "CC-BY-SA-3.0", "copyright": "Taken from https://github.com/tgstation/tgstation at 04e43d8c1d5097fdb697addd4395fb849dd341bd", "states": [{"name": "chem_gas_old", "delays": [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1]]}, {"name": "frezon", "delays": [[0.2, 0.2, 0.2, 0.3, 0.3, 0.2, 0.2, 0.2]]}, {"name": "frezon_old", "delays": [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1]]}, {"name": "fusion_gas", "delays": [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1]]}, {"name": "miasma", "delays": [[0.2, 0.2, 0.2, 0.3, 0.3, 0.2, 0.2, 0.2]]}, {"name": "miasma_old", "delays": [[0.22999999999999998, 0.22999999999999998, 0.22999999999999998, 0.22999999999999998, 0.22999999999999998, 0.22999999999999998]]}, {"name": "nitrous_oxide", "delays": [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]]}, {"name": "nitrous_oxide_old", "delays": [[0.2, 0.2, 0.2]]}, {"name": "nitryl", "delays": [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]]}, {"name": "nitryl_old", "delays": [[0.1, 0.1, 0.1, 0.1]]}, {"name": "plasma", "delays": [[0.1, 0.1, 0.1]]}, {"name": "plasma_old", "delays": [[0.2, 0.2, 0.2]]}, {"name": "tritium", "delays": [[0.1, 0.1, 0.1, 0.1, 0.1]]}, {"name": "tritium_old", "delays": [[0.1, 0.1, 0.1, 0.1, 0.1]]}, {"name": "water_vapor", "delays": [[0.2, 0.2, 0.2, 0.3, 0.3, 0.2, 0.2, 0.2]]}, {"name": "water_vapor_old", "delays": [[0.2, 0.2, 0.2, 0.2, 0.2, 0.2]]}]}

View File

Before

Width:  |  Height:  |  Size: 513 B

After

Width:  |  Height:  |  Size: 513 B

View File

Before

Width:  |  Height:  |  Size: 486 B

After

Width:  |  Height:  |  Size: 486 B

View File

@@ -95,10 +95,10 @@
"name": "darkblue-1"
},
{
"name": "freon"
"name": "frezon"
},
{
"name": "freon-1"
"name": "frezon-1"
},
{
"name": "water_vapor"