Revert "Solution Entities" (#23160)
Revert "Solution Entities (#21916)"
This reverts commit d75e743dd7.
This commit is contained in:
@@ -12,6 +12,7 @@ public sealed partial class DrainableSolutionComponent : Component
|
||||
/// <summary>
|
||||
/// Solution name that can be drained.
|
||||
/// </summary>
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public string Solution = "default";
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("solution")]
|
||||
public string Solution { get; set; } = "default";
|
||||
}
|
||||
|
||||
@@ -12,12 +12,14 @@ public sealed partial class DumpableSolutionComponent : Component
|
||||
/// <summary>
|
||||
/// Solution name that can be dumped into.
|
||||
/// </summary>
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public string Solution = "default";
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("solution")]
|
||||
public string Solution { get; set; } = "default";
|
||||
|
||||
/// <summary>
|
||||
/// Whether the solution can be dumped into infinitely.
|
||||
/// </summary>
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool Unlimited = false;
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("unlimited")]
|
||||
public bool Unlimited { get; set; } = false;
|
||||
}
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Chemistry.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Allows the entity with this component to be placed in a <c>SharedReagentDispenserComponent</c>.
|
||||
/// <para>Otherwise it's considered to be too large or the improper shape to fit.</para>
|
||||
/// <para>Allows us to have obscenely large containers that are harder to abuse in chem dispensers
|
||||
/// since they can't be placed directly in them.</para>
|
||||
/// <see cref="Dispenser.SharedReagentDispenserComponent"/>
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[NetworkedComponent] // only needed for white-lists. Client doesn't actually need Solution data;
|
||||
public sealed partial class FitsInDispenserComponent : Component
|
||||
namespace Content.Shared.Chemistry.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Solution name that will interact with ReagentDispenserComponent.
|
||||
/// Allows the entity with this component to be placed in a <c>SharedReagentDispenserComponent</c>.
|
||||
/// <para>Otherwise it's considered to be too large or the improper shape to fit.</para>
|
||||
/// <para>Allows us to have obscenely large containers that are harder to abuse in chem dispensers
|
||||
/// since they can't be placed directly in them.</para>
|
||||
/// <see cref="Dispenser.SharedReagentDispenserComponent"/>
|
||||
/// </summary>
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public string Solution = "default";
|
||||
[RegisterComponent]
|
||||
[NetworkedComponent] // only needed for white-lists. Client doesn't actually need Solution data;
|
||||
public sealed partial class FitsInDispenserComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Solution name that will interact with ReagentDispenserComponent.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("solution")]
|
||||
public string Solution { get; set; } = "default";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,12 +14,14 @@ public sealed partial class RefillableSolutionComponent : Component
|
||||
/// <summary>
|
||||
/// Solution name that can added to easily.
|
||||
/// </summary>
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public string Solution = "default";
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("solution")]
|
||||
public string Solution { get; set; } = "default";
|
||||
|
||||
/// <summary>
|
||||
/// The maximum amount that can be transferred to the solution at once
|
||||
/// </summary>
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public FixedPoint2? MaxRefill = null;
|
||||
[DataField("maxRefill")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public FixedPoint2? MaxRefill { get; set; } = null;
|
||||
}
|
||||
|
||||
@@ -13,12 +13,6 @@ public sealed partial class SmokeComponent : Component
|
||||
{
|
||||
public const string SolutionName = "solutionArea";
|
||||
|
||||
/// <summary>
|
||||
/// The solution on the entity with touch and ingestion reactions.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public Entity<SolutionComponent>? Solution = null;
|
||||
|
||||
/// <summary>
|
||||
/// The max amount of tiles this smoke cloud can spread to.
|
||||
/// </summary>
|
||||
|
||||
@@ -71,7 +71,6 @@ namespace Content.Shared.Chemistry.Components
|
||||
/// <summary>
|
||||
/// The name of this solution, if it is contained in some <see cref="SolutionContainerManagerComponent"/>
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public string? Name;
|
||||
|
||||
/// <summary>
|
||||
@@ -101,7 +100,7 @@ namespace Content.Shared.Chemistry.Components
|
||||
foreach (var (reagent, quantity) in Contents)
|
||||
{
|
||||
_heatCapacity += (float) quantity *
|
||||
protoMan.Index<ReagentPrototype>(reagent.Prototype).SpecificHeat;
|
||||
protoMan.Index<ReagentPrototype>(reagent.Prototype).SpecificHeat;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,12 +158,10 @@ namespace Content.Shared.Chemistry.Components
|
||||
|
||||
public Solution(Solution solution)
|
||||
{
|
||||
Contents = solution.Contents.ShallowClone();
|
||||
Volume = solution.Volume;
|
||||
MaxVolume = solution.MaxVolume;
|
||||
Temperature = solution.Temperature;
|
||||
_heatCapacity = solution._heatCapacity;
|
||||
_heatCapacityDirty = solution._heatCapacityDirty;
|
||||
Contents = solution.Contents.ShallowClone();
|
||||
ValidateSolution();
|
||||
}
|
||||
|
||||
@@ -177,7 +174,7 @@ namespace Content.Shared.Chemistry.Components
|
||||
public void ValidateSolution()
|
||||
{
|
||||
// sandbox forbids: [Conditional("DEBUG")]
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
// Correct volume
|
||||
DebugTools.Assert(Contents.Select(x => x.Quantity).Sum() == Volume);
|
||||
|
||||
@@ -195,7 +192,7 @@ namespace Content.Shared.Chemistry.Components
|
||||
UpdateHeatCapacity(null);
|
||||
DebugTools.Assert(MathHelper.CloseTo(_heatCapacity, cur));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void ISerializationHooks.AfterDeserialization()
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
using Content.Shared.Chemistry.Components.SolutionManager;
|
||||
using Content.Shared.Materials;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
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="SolutionContainerManagerComponent"/> 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="Content.Server.Temperature.Components.TemperatureComponent"/>. May require minor reworks to both.</para>
|
||||
/// </remarks>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
public sealed partial class SolutionComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>The reagents the entity is composed of and their temperature.</para>
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public Solution Solution = new();
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using Content.Shared.Chemistry.EntitySystems;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Chemistry.Components.SolutionManager;
|
||||
|
||||
/// <summary>
|
||||
/// Component used to relate a solution to its container.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// When containers are finally ECS'd have this attach to the container entity.
|
||||
/// The <see cref="Solution.MaxVolume"/> field should then be extracted out into this component.
|
||||
/// Solution entities would just become an apporpriately composed entity hanging out in the container.
|
||||
/// Will probably require entities in components being given a relation to associate themselves with their container.
|
||||
/// </remarks>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
[Access(typeof(SharedSolutionContainerSystem))]
|
||||
public sealed partial class ContainedSolutionComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The entity that the solution is contained in.
|
||||
/// </summary>
|
||||
[DataField(required: true), AutoNetworkedField]
|
||||
public EntityUid Container;
|
||||
|
||||
/// <summary>
|
||||
/// The name/key of the container the solution is located in.
|
||||
/// </summary>
|
||||
[DataField(required: true), AutoNetworkedField]
|
||||
public string ContainerName = default!;
|
||||
}
|
||||
@@ -9,6 +9,7 @@ public sealed partial class DrawableSolutionComponent : Component
|
||||
/// <summary>
|
||||
/// Solution name that can be removed with syringes.
|
||||
/// </summary>
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public string Solution = "default";
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("solution")]
|
||||
public string Solution { get; set; } = "default";
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
[RegisterComponent]
|
||||
public sealed partial class ExaminableSolutionComponent : Component
|
||||
{
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public string Solution = "default";
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("solution")]
|
||||
public string Solution { get; set; } = "default";
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ public sealed partial class InjectableSolutionComponent : Component
|
||||
/// <summary>
|
||||
/// Solution name which can be added with syringes.
|
||||
/// </summary>
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public string Solution = "default";
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("solution")]
|
||||
public string Solution { get; set; } = "default";
|
||||
}
|
||||
|
||||
@@ -1,36 +1,12 @@
|
||||
using Content.Shared.Chemistry.EntitySystems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Chemistry.Components.SolutionManager;
|
||||
|
||||
/// <summary>
|
||||
/// <para>A map of the solution entities contained within this entity.</para>
|
||||
/// <para>Every solution entity this maps should have a <see cref="SolutionComponent"/> to track its state and a <see cref="ContainedSolutionComponent"/> to track its container.</para>
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
[Access(typeof(SharedSolutionContainerSystem))]
|
||||
[RegisterComponent]
|
||||
[Access(typeof(SolutionContainerSystem))]
|
||||
public sealed partial class SolutionContainerManagerComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The default amount of space that will be allocated for solutions in solution containers.
|
||||
/// Most solution containers will only contain 1-2 solutions.
|
||||
/// </summary>
|
||||
public const int DefaultCapacity = 2;
|
||||
|
||||
/// <summary>
|
||||
/// The names of each solution container attached to this entity.
|
||||
/// Actually accessing them must be done via <see cref="ContainerManagerComponent"/>.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public HashSet<string> Containers = new(DefaultCapacity);
|
||||
|
||||
/// <summary>
|
||||
/// The set of solutions to load onto this entity during mapinit.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Should be null after mapinit.
|
||||
/// </remarks>
|
||||
[DataField(serverOnly: true)] // Needs to be serverOnly or these will get loaded on the client and never cleared. Can be reworked when entity spawning is predicted.
|
||||
public Dictionary<string, Solution>? Solutions = null;
|
||||
[DataField("solutions")]
|
||||
[Access(typeof(SolutionContainerSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
|
||||
public Dictionary<string, Solution> Solutions = new();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user