diff --git a/Content.Server/Atmos/GasMixture.cs b/Content.Server/Atmos/GasMixture.cs index 9c1721b01f..66ccde9db1 100644 --- a/Content.Server/Atmos/GasMixture.cs +++ b/Content.Server/Atmos/GasMixture.cs @@ -495,7 +495,8 @@ namespace Content.Server.Atmos foreach (var prototype in _atmosphereSystem.GasReactions) { if (energy < prototype.MinimumEnergyRequirement || - temperature < prototype.MinimumTemperatureRequirement) + temperature < prototype.MinimumTemperatureRequirement || + temperature > prototype.MaximumTemperatureRequirement) continue; var doReaction = true; diff --git a/Content.Server/Atmos/Reactions/GasReactionPrototype.cs b/Content.Server/Atmos/Reactions/GasReactionPrototype.cs index 08ed811799..f3dfa74898 100644 --- a/Content.Server/Atmos/Reactions/GasReactionPrototype.cs +++ b/Content.Server/Atmos/Reactions/GasReactionPrototype.cs @@ -36,6 +36,12 @@ namespace Content.Server.Atmos.Reactions [DataField("minimumRequirements")] public float[] MinimumRequirements { get; private set; } = new float[Atmospherics.TotalNumberOfGases]; + /// + /// Maximum temperature requirement. + /// + [DataField("maximumTemperature")] + public float MaximumTemperatureRequirement { get; private set; } + /// /// Minimum temperature requirement. /// diff --git a/Content.Server/Atmos/Reactions/TritiumFireReaction.cs b/Content.Server/Atmos/Reactions/TritiumFireReaction.cs index a605480726..e8a1a798e9 100644 --- a/Content.Server/Atmos/Reactions/TritiumFireReaction.cs +++ b/Content.Server/Atmos/Reactions/TritiumFireReaction.cs @@ -42,7 +42,7 @@ namespace Content.Server.Atmos.Reactions if (burnedFuel > 0) { energyReleased += (Atmospherics.FireHydrogenEnergyReleased * burnedFuel); - + // TODO ATMOS Radiation pulse here! // Conservation of mass is important. diff --git a/Content.Server/Atmos/Reactions/WaterVaporReaction.cs b/Content.Server/Atmos/Reactions/WaterVaporReaction.cs new file mode 100644 index 0000000000..e85ebdc8f2 --- /dev/null +++ b/Content.Server/Atmos/Reactions/WaterVaporReaction.cs @@ -0,0 +1,44 @@ +#nullable enable +using Content.Server.GameObjects.Components.Fluids; +using Content.Server.Interfaces; +using Content.Shared.Chemistry; +using Content.Shared.Maps; +using JetBrains.Annotations; +using Robust.Server.GameObjects; +using Robust.Shared.Serialization; +using Robust.Shared.Serialization.Manager.Attributes; + +namespace Content.Server.Atmos.Reactions +{ + [UsedImplicitly] + public class WaterVaporReaction : IGasReactionEffect + { + [field: DataField("reagent")] public string? Reagent { get; } = null; + + [field: DataField("gas")] public int GasId { get; } = 0; + + [field: DataField("molesPerUnit")] public float MolesPerUnit { get; } = 1; + + [field: DataField("puddlePrototype")] public string? PuddlePrototype { get; } = "PuddleSmear"; + + public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, GridTileLookupSystem gridTileLookup) + { + // If any of the prototypes is invalid, we do nothing. + if (string.IsNullOrEmpty(Reagent) || string.IsNullOrEmpty(PuddlePrototype)) return ReactionResult.NoReaction; + + // If we're not reacting on a tile, do nothing. + if (holder is not TileAtmosphere tile) return ReactionResult.NoReaction; + + // If we don't have enough moles of the specified gas, do nothing. + if (mixture.GetMoles(GasId) < MolesPerUnit) return ReactionResult.NoReaction; + + // Remove the moles from the mixture... + mixture.AdjustMoles(GasId, -MolesPerUnit); + + var tileRef = tile.GridIndices.GetTileRef(tile.GridIndex); + tileRef.SpillAt(new Solution(Reagent, ReagentUnit.New(MolesPerUnit)), PuddlePrototype, sound: false); + + return ReactionResult.Reacting; + } + } +} diff --git a/Resources/Prototypes/Atmospherics/reactions.yml b/Resources/Prototypes/Atmospherics/reactions.yml index 765a75fff6..f5aca16420 100644 --- a/Resources/Prototypes/Atmospherics/reactions.yml +++ b/Resources/Prototypes/Atmospherics/reactions.yml @@ -22,3 +22,19 @@ - 0.01 # tritium effects: - !type:TritiumFireReaction {} + +- type: gasReaction + id: WaterVaporPuddle + priority: 1 + maximumTemperature: 373.13 # Boiling point of water. + minimumRequirements: # In this case, same as minimum mole count. + - 0 # oxygen + - 0 # nitrogen + - 0 # carbon dioxide + - 0 # plasma + - 0 # tritium + - 1 # water vapor + effects: + - !type:WaterVaporReaction + gasId: 5 + reagent: chem.Water