Show / Hide Table of Contents

Class Solution

A solution of reagents.

Inheritance
System.Object
Solution
Implements
Robust.Shared.Serialization.ISerializationHooks
Namespace: Content.Shared.Chemistry.Components
Assembly: Content.Shared.dll
Syntax
public sealed class Solution : IEnumerable<ReagentQuantity>, ISerializationHooks

Constructors

| Improve this Doc View Source

Solution()

Constructs an empty solution (ex. an empty beaker).

Declaration
public Solution()
| Improve this Doc View Source

Solution(Solution)

Declaration
public Solution(Solution solution)
Parameters
Type Name Description
Solution solution
| Improve this Doc View Source

Solution(IEnumerable<ReagentQuantity>, Boolean)

Declaration
public Solution(IEnumerable<ReagentQuantity> reagents, bool setMaxVol = true)
Parameters
Type Name Description
IEnumerable<ReagentQuantity> reagents
System.Boolean setMaxVol
| Improve this Doc View Source

Solution(Int32)

Constructs an empty solution (ex. an empty beaker).

Declaration
public Solution(int capacity)
Parameters
Type Name Description
System.Int32 capacity
| Improve this Doc View Source

Solution(String, FixedPoint2, ReagentData)

Constructs a solution containing 100% of a reagent (ex. A beaker of pure water).

Declaration
public Solution(string prototype, FixedPoint2 quantity, ReagentData data = null)
Parameters
Type Name Description
System.String prototype

The prototype ID of the reagent to add.

FixedPoint2 quantity

The quantity in milli-units.

ReagentData data

Fields

| Improve this Doc View Source

Contents

Declaration
public List<ReagentQuantity> Contents
Field Value
Type Description
List<ReagentQuantity>
| Improve this Doc View Source

Name

The name of this solution, if it is contained in some

Declaration
public string? Name
Field Value
Type Description
System.Nullable<System.String>

Properties

| Improve this Doc View Source

AvailableVolume

Volume needed to fill this container.

Declaration
public FixedPoint2 AvailableVolume { get; }
Property Value
Type Description
FixedPoint2
| Improve this Doc View Source

CanMix

If reactions can occur via mixing.

Declaration
public bool CanMix { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

CanReact

If reactions will be checked for when adding reagents to the container.

Declaration
public bool CanReact { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

FillFraction

Declaration
public float FillFraction { get; }
Property Value
Type Description
System.Single
| Improve this Doc View Source

Item[ReagentId]

Declaration
public ReagentQuantity this[ReagentId id] { get; }
Parameters
Type Name Description
ReagentId id
Property Value
Type Description
ReagentQuantity
| Improve this Doc View Source

MaxVolume

Maximum volume this solution supports.

Declaration
public FixedPoint2 MaxVolume { get; set; }
Property Value
Type Description
FixedPoint2
Remarks

A value of zero means the maximum will automatically be set equal to the current volume during initialization. Note that most solution methods ignore max volume altogether, but various solution systems use this.

| Improve this Doc View Source

Temperature

The temperature of the reagents in the solution.

Declaration
public float Temperature { get; set; }
Property Value
Type Description
System.Single
| Improve this Doc View Source

Volume

The calculated total volume of all reagents in the solution (ex. Total volume of liquid in beaker).

Declaration
public FixedPoint2 Volume { get; set; }
Property Value
Type Description
FixedPoint2

Methods

| Improve this Doc View Source

AddReagent(ReagentId, FixedPoint2, Boolean)

Adds a given quantity of a reagent directly into the solution.

Declaration
public void AddReagent(ReagentId id, FixedPoint2 quantity, bool dirtyHeatCap = true)
Parameters
Type Name Description
ReagentId id

The reagent to add.

FixedPoint2 quantity

The quantity in milli-units.

System.Boolean dirtyHeatCap
| Improve this Doc View Source

AddReagent(ReagentPrototype, ReagentId, FixedPoint2)

Adds a given quantity of a reagent directly into the solution.

Declaration
public void AddReagent(ReagentPrototype proto, ReagentId reagentId, FixedPoint2 quantity)
Parameters
Type Name Description
ReagentPrototype proto
ReagentId reagentId

The reagent to add.

FixedPoint2 quantity

The quantity in milli-units.

| Improve this Doc View Source

AddReagent(ReagentPrototype, FixedPoint2, Single, IPrototypeManager, ReagentData)

Adds a given quantity of a reagent directly into the solution.

Declaration
public void AddReagent(ReagentPrototype proto, FixedPoint2 quantity, float temperature, IPrototypeManager protoMan, ReagentData data = null)
Parameters
Type Name Description
ReagentPrototype proto

The prototype of the reagent to add.

FixedPoint2 quantity

The quantity in milli-units.

System.Single temperature
Robust.Shared.Prototypes.IPrototypeManager protoMan
ReagentData data
| Improve this Doc View Source

AddReagent(ReagentQuantity)

Declaration
public void AddReagent(ReagentQuantity reagentQuantity)
Parameters
Type Name Description
ReagentQuantity reagentQuantity
| Improve this Doc View Source

AddReagent(String, FixedPoint2, Boolean)

Adds a given quantity of a reagent directly into the solution.

Declaration
public void AddReagent(string prototype, FixedPoint2 quantity, bool dirtyHeatCap = true)
Parameters
Type Name Description
System.String prototype

The prototype ID of the reagent to add.

FixedPoint2 quantity

The quantity in milli-units.

System.Boolean dirtyHeatCap
| Improve this Doc View Source

AddSolution(Solution, IPrototypeManager)

Declaration
public void AddSolution(Solution otherSolution, IPrototypeManager protoMan)
Parameters
Type Name Description
Solution otherSolution
Robust.Shared.Prototypes.IPrototypeManager protoMan
| Improve this Doc View Source

CanAddSolution(Solution)

Checks if a solution can fit into the container.

Declaration
public bool CanAddSolution(Solution solution)
Parameters
Type Name Description
Solution solution
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Clone()

Declaration
public Solution Clone()
Returns
Type Description
Solution
| Improve this Doc View Source

ContainsPrototype(String)

Declaration
public bool ContainsPrototype(string prototype)
Parameters
Type Name Description
System.String prototype
Returns
Type Description
System.Boolean
| Improve this Doc View Source

ContainsReagent(ReagentId)

Declaration
public bool ContainsReagent(ReagentId id)
Parameters
Type Name Description
ReagentId id
Returns
Type Description
System.Boolean
| Improve this Doc View Source

ContainsReagent(String, ReagentData)

Declaration
public bool ContainsReagent(string reagentId, ReagentData data)
Parameters
Type Name Description
System.String reagentId
ReagentData data
Returns
Type Description
System.Boolean
| Improve this Doc View Source

GetColor(IPrototypeManager)

Declaration
public Color GetColor(IPrototypeManager protoMan)
Parameters
Type Name Description
Robust.Shared.Prototypes.IPrototypeManager protoMan
Returns
Type Description
Color
| Improve this Doc View Source

GetColorWithout(IPrototypeManager, String[])

Declaration
public Color GetColorWithout(IPrototypeManager protoMan, params string[] without)
Parameters
Type Name Description
Robust.Shared.Prototypes.IPrototypeManager protoMan
System.String[] without
Returns
Type Description
Color
| Improve this Doc View Source

GetEnumerator()

Declaration
public IEnumerator<ReagentQuantity> GetEnumerator()
Returns
Type Description
IEnumerator<ReagentQuantity>
| Improve this Doc View Source

GetHeatCapacity(IPrototypeManager)

Declaration
public float GetHeatCapacity(IPrototypeManager protoMan)
Parameters
Type Name Description
Robust.Shared.Prototypes.IPrototypeManager protoMan
Returns
Type Description
System.Single
| Improve this Doc View Source

GetPrimaryReagentId()

Declaration
public ReagentId? GetPrimaryReagentId()
Returns
Type Description
System.Nullable<ReagentId>
| Improve this Doc View Source

GetReagent(ReagentId)

Declaration
public ReagentQuantity GetReagent(ReagentId id)
Parameters
Type Name Description
ReagentId id
Returns
Type Description
ReagentQuantity
| Improve this Doc View Source

GetReagentPrototypes(IPrototypeManager)

Declaration
public Dictionary<ReagentPrototype, FixedPoint2> GetReagentPrototypes(IPrototypeManager protoMan)
Parameters
Type Name Description
Robust.Shared.Prototypes.IPrototypeManager protoMan
Returns
Type Description
Dictionary<ReagentPrototype, FixedPoint2>
| Improve this Doc View Source

GetReagentQuantity(ReagentId)

Get the volume/quantity of a single reagent in the solution.

Declaration
public FixedPoint2 GetReagentQuantity(ReagentId id)
Parameters
Type Name Description
ReagentId id
Returns
Type Description
FixedPoint2
| Improve this Doc View Source

GetThermalEnergy(IPrototypeManager)

Declaration
public float GetThermalEnergy(IPrototypeManager protoMan)
Parameters
Type Name Description
Robust.Shared.Prototypes.IPrototypeManager protoMan
Returns
Type Description
System.Single
| Improve this Doc View Source

GetTotalPrototypeQuantity(String)

Gets the total volume of all reagents in the solution with the given prototype Id. If you only want the volume of a single reagent, use GetReagentQuantity(ReagentId)

Declaration
public FixedPoint2 GetTotalPrototypeQuantity(string prototype)
Parameters
Type Name Description
System.String prototype
Returns
Type Description
FixedPoint2
| Improve this Doc View Source

RemoveAllSolution()

Declaration
public void RemoveAllSolution()
| Improve this Doc View Source

RemoveReagent(ReagentId, FixedPoint2)

Attempts to remove an amount of reagent from the solution.

Declaration
public FixedPoint2 RemoveReagent(ReagentId reagentId, FixedPoint2 quantity)
Parameters
Type Name Description
ReagentId reagentId

The reagent to be removed.

FixedPoint2 quantity

The amount of reagent to remove.

Returns
Type Description
FixedPoint2

How much reagent was actually removed. Zero if the reagent is not present on the solution.

| Improve this Doc View Source

RemoveReagent(ReagentQuantity)

Attempts to remove an amount of reagent from the solution.

Declaration
public FixedPoint2 RemoveReagent(ReagentQuantity toRemove)
Parameters
Type Name Description
ReagentQuantity toRemove

The reagent to be removed.

Returns
Type Description
FixedPoint2

How much reagent was actually removed. Zero if the reagent is not present on the solution.

| Improve this Doc View Source

RemoveReagent(String, FixedPoint2, ReagentData)

Attempts to remove an amount of reagent from the solution.

Declaration
public FixedPoint2 RemoveReagent(string prototype, FixedPoint2 quantity, ReagentData data = null)
Parameters
Type Name Description
System.String prototype

The prototype of the reagent to be removed.

FixedPoint2 quantity

The amount of reagent to remove.

ReagentData data
Returns
Type Description
FixedPoint2

How much reagent was actually removed. Zero if the reagent is not present on the solution.

| Improve this Doc View Source

RemoveSolution(FixedPoint2)

Variant of SplitSolution(FixedPoint2) that doesn't return a new solution containing the removed reagents.

Declaration
public void RemoveSolution(FixedPoint2 toTake)
Parameters
Type Name Description
FixedPoint2 toTake

The quantity of this solution to remove

| Improve this Doc View Source

ScaleSolution(Int32)

Scales the amount of solution by some integer quantity.

Declaration
public void ScaleSolution(int scale)
Parameters
Type Name Description
System.Int32 scale

The scalar to modify the solution by.

| Improve this Doc View Source

ScaleSolution(Single)

Scales the amount of solution.

Declaration
public void ScaleSolution(float scale)
Parameters
Type Name Description
System.Single scale

The scalar to modify the solution by.

| Improve this Doc View Source

SetContents(IEnumerable<ReagentQuantity>, Boolean)

Declaration
public void SetContents(IEnumerable<ReagentQuantity> reagents, bool setMaxVol = false)
Parameters
Type Name Description
IEnumerable<ReagentQuantity> reagents
System.Boolean setMaxVol
| Improve this Doc View Source

SplitSolution(FixedPoint2)

Declaration
public Solution SplitSolution(FixedPoint2 toTake)
Parameters
Type Name Description
FixedPoint2 toTake
Returns
Type Description
Solution
| Improve this Doc View Source

SplitSolutionWithout(FixedPoint2, String[])

Splits a solution without the specified reagent prototypes.

Declaration
public Solution SplitSolutionWithout(FixedPoint2 toTake, params string[] excludedPrototypes)
Parameters
Type Name Description
FixedPoint2 toTake
System.String[] excludedPrototypes
Returns
Type Description
Solution
| Improve this Doc View Source

TryGetReagent(ReagentId, out ReagentQuantity)

Declaration
public bool TryGetReagent(ReagentId id, out ReagentQuantity quantity)
Parameters
Type Name Description
ReagentId id
ReagentQuantity quantity
Returns
Type Description
System.Boolean
| Improve this Doc View Source

TryGetReagentQuantity(ReagentId, out FixedPoint2)

Declaration
public bool TryGetReagentQuantity(ReagentId id, out FixedPoint2 volume)
Parameters
Type Name Description
ReagentId id
FixedPoint2 volume
Returns
Type Description
System.Boolean
| Improve this Doc View Source

UpdateHeatCapacity(IPrototypeManager)

Declaration
public void UpdateHeatCapacity(IPrototypeManager protoMan)
Parameters
Type Name Description
Robust.Shared.Prototypes.IPrototypeManager protoMan
| Improve this Doc View Source

ValidateSolution()

Declaration
public void ValidateSolution()

Explicit Interface Implementations

| Improve this Doc View Source

ISerializationHooks.AfterDeserialization()

Declaration
void ISerializationHooks.AfterDeserialization()

Implements

Robust.Shared.Serialization.ISerializationHooks
  • Improve this Doc
  • View Source
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾