refactor rehydration (#14707)
This commit is contained in:
@@ -1,18 +1,39 @@
|
||||
namespace Content.Server.Chemistry.Components
|
||||
using Content.Server.Chemistry.EntitySystems;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Server.Chemistry.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Basically, monkey cubes.
|
||||
/// But specifically, this component deletes the entity and spawns in a new entity when the entity is exposed to a certain amount of a given reagent.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(RehydratableSystem))]
|
||||
public sealed class RehydratableComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Basically, monkey cubes.
|
||||
/// But specifically, this component deletes the entity and spawns in a new entity when the entity is exposed to a given reagent.
|
||||
/// The reagent that must be present to count as hydrated.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class RehydratableComponent : Component
|
||||
{
|
||||
[DataField("catalyst")]
|
||||
internal string CatalystPrototype = "Water";
|
||||
[DataField("catalyst", customTypeSerializer: typeof(PrototypeIdSerializer<ReagentPrototype>)), ViewVariables(VVAccess.ReadWrite)]
|
||||
public string CatalystPrototype = "Water";
|
||||
|
||||
[DataField("target")]
|
||||
internal string? TargetPrototype = default!;
|
||||
/// <summary>
|
||||
/// The minimum amount of catalyst that must be present to be hydrated.
|
||||
/// </summary>
|
||||
[DataField("catalystMinimum"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public FixedPoint2 CatalystMinimum = FixedPoint2.Zero;
|
||||
|
||||
internal bool Expanding;
|
||||
}
|
||||
/// <summary>
|
||||
/// The entity to create when hydrated.
|
||||
/// </summary>
|
||||
[DataField("target", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>)), ViewVariables(VVAccess.ReadWrite)]
|
||||
public string? TargetPrototype = default!;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raised on the rehydrated entity with target being the new entity it became.
|
||||
/// </summary>
|
||||
[ByRefEvent]
|
||||
public readonly record struct GotRehydratedEvent(EntityUid Target);
|
||||
|
||||
Reference in New Issue
Block a user