1
0

RehydratableComponent.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using Content.Shared.Chemistry.EntitySystems;
  2. using Content.Shared.Chemistry.Reagent;
  3. using Content.Shared.FixedPoint;
  4. using Robust.Shared.Prototypes;
  5. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  6. namespace Content.Shared.Chemistry.Components;
  7. /// <summary>
  8. /// Basically, monkey cubes.
  9. /// 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.
  10. /// </summary>
  11. [RegisterComponent, Access(typeof(RehydratableSystem))]
  12. public sealed partial class RehydratableComponent : Component
  13. {
  14. /// <summary>
  15. /// The reagent that must be present to count as hydrated.
  16. /// </summary>
  17. [DataField("catalyst")]
  18. public ProtoId<ReagentPrototype> CatalystPrototype = "Water";
  19. /// <summary>
  20. /// The minimum amount of catalyst that must be present to be hydrated.
  21. /// </summary>
  22. [DataField]
  23. public FixedPoint2 CatalystMinimum = FixedPoint2.Zero;
  24. /// <summary>
  25. /// The entity to create when hydrated.
  26. /// </summary>
  27. [DataField(required: true)]
  28. public List<EntProtoId> PossibleSpawns = new();
  29. }
  30. /// <summary>
  31. /// Raised on the rehydrated entity with target being the new entity it became.
  32. /// </summary>
  33. [ByRefEvent]
  34. public readonly record struct GotRehydratedEvent(EntityUid Target);