1
0

FoamVisualsComponent.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using Robust.Client.Animations;
  2. using Robust.Client.Graphics;
  3. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
  4. namespace Content.Client.Chemistry.Visualizers;
  5. /// <summary>
  6. /// A component that makes foam play an animation when it dissolves.
  7. /// </summary>
  8. [RegisterComponent]
  9. [Access(typeof(FoamVisualizerSystem))]
  10. public sealed partial class FoamVisualsComponent : Component
  11. {
  12. /// <summary>
  13. /// The id of the animation used when the foam dissolves.
  14. /// </summary>
  15. public const string AnimationKey = "foamdissolve_animation";
  16. [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
  17. public TimeSpan StartTime;
  18. /// <summary>
  19. /// How long the foam visually dissolves for.
  20. /// </summary>
  21. [DataField]
  22. public float AnimationTime = 0.5f;
  23. /// <summary>
  24. /// The state of the entities base sprite RSI that is displayed when the foam dissolves.
  25. /// Cannot use <see cref="RSI.StateKey"/> because it does not have <see cref="DataDefinitionAttribute"/> and I am not making an engine PR at this time.
  26. /// </summary>
  27. [DataField]
  28. public string AnimationState = "foam-dissolve";
  29. /// <summary>
  30. /// The animation used while the foam dissolves.
  31. /// Generated by <see cref="FoamVisualizerSystem.OnComponentInit"/>.
  32. /// </summary>
  33. [ViewVariables(VVAccess.ReadOnly)]
  34. public Animation Animation = default!;
  35. }