CatStation/Content.Shared/Chemistry/Components/SolutionComponent.cs
Princess Cheeseballs 1bcb6499b4
Fix some prediction and solution duplication issues with the solutions refactor. (#43728)
* fix prediction and solution duplication issues

* lock down

* wait I fogrot other systems need to read this id I'm stupid

* fix

* actually throw

* better comment and obsoletion

* master merge + fix popup text

* netowkring fix

* better debug assert

* back to basics

* dumbb

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
2026-05-02 15:56:31 +00:00

44 lines
1.9 KiB
C#

using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Materials;
using Content.Shared.Temperature.Components;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Chemistry.Components;
/// <summary>
/// <para>Holds the composition of an entity made from reagents and its reagent temperature.</para>
/// <para>If the entity is used to represent a collection of reagents inside of a container such as a beaker, syringe, bloodstream, food, or similar the entity is tracked by a <see cref="SolutionManagerComponent"/> on the container and has a <see cref="ContainedSolutionComponent"/> tracking which container it's in.</para>
/// </summary>
/// <remarks>
/// <para>Once reagents and materials have been merged this component should be depricated in favor of using a combination of <see cref="PhysicalCompositionComponent"/> and <see cref="TemperatureComponent"/>. May require minor reworks to both.</para>
/// </remarks>
[RegisterComponent, NetworkedComponent]
public sealed partial class SolutionComponent : Component
{
public const string DefaultSolutionId = "solution";
/// <summary>
/// The name of this solution. This value should *never* change once the solution is initialized.
/// </summary>
[DataField]
[Access(typeof(SharedSolutionContainerSystem))]
public string Id = DefaultSolutionId;
/// <summary>
/// <para>The reagents the entity is composed of and their temperature.</para>
/// </summary>
[DataField, AlwaysPushInheritance]
public Solution Solution = new();
}
/// <remarks>
/// We manually network the component state as it raises one less event and therefore is better performance wise.
/// </remarks>
[Serializable, NetSerializable]
public sealed class SolutionComponentState(string id, Solution solution) : ComponentState
{
public string Id = id;
public Solution Solution = solution;
}