SingularityComponent.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using Robust.Shared.GameStates;
  2. using Content.Shared.Singularity.EntitySystems;
  3. using Robust.Shared.Audio;
  4. using Robust.Shared.Utility;
  5. namespace Content.Shared.Singularity.Components;
  6. /// <summary>
  7. /// A component that makes the associated entity accumulate energy when an associated event horizon consumes things.
  8. /// Energy management is server-side.
  9. /// </summary>
  10. [RegisterComponent, NetworkedComponent]
  11. public sealed partial class SingularityComponent : Component
  12. {
  13. /// <summary>
  14. /// The current level of the singularity.
  15. /// Used as a scaling factor for things like visual size, event horizon radius, gravity well radius, radiation output, etc.
  16. /// If you want to set this use <see cref="SharedSingularitySystem.SetLevel"/>().
  17. /// </summary>
  18. [Access(friends: typeof(SharedSingularitySystem), Other = AccessPermissions.Read, Self = AccessPermissions.Read)]
  19. [DataField("level")]
  20. public byte Level = 1;
  21. /// <summary>
  22. /// The amount of radiation this singularity emits per its level.
  23. /// Has to be on shared in case someone attaches a RadiationPulseComponent to the singularity.
  24. /// If you want to set this use <see cref="SharedSingularitySystem.SetRadsPerLevel"/>().
  25. /// </summary>
  26. [Access(friends: typeof(SharedSingularitySystem), Other = AccessPermissions.Read, Self = AccessPermissions.Read)]
  27. [DataField("radsPerLevel")]
  28. [ViewVariables(VVAccess.ReadWrite)]
  29. public float RadsPerLevel = 2f;
  30. /// <summary>
  31. /// The amount of energy this singularity contains.
  32. /// </summary>
  33. [DataField("energy")]
  34. public float Energy = 180f;
  35. /// <summary>
  36. /// The rate at which this singularity loses energy over time.
  37. /// </summary>
  38. [DataField("energyLoss")]
  39. [ViewVariables(VVAccess.ReadWrite)]
  40. public float EnergyDrain;
  41. #region Audio
  42. /// <summary>
  43. /// The sound that this singularity produces by existing.
  44. /// </summary>
  45. [DataField("ambientSound")]
  46. [ViewVariables(VVAccess.ReadOnly)]
  47. public SoundSpecifier? AmbientSound = new SoundPathSpecifier(
  48. "/Audio/Effects/singularity_form.ogg",
  49. AudioParams.Default.WithVolume(5).WithLoop(true).WithMaxDistance(20f)
  50. );
  51. /// <summary>
  52. /// The audio stream that plays the sound specified by <see cref="AmbientSound"/> on loop.
  53. /// </summary>
  54. [ViewVariables(VVAccess.ReadWrite)]
  55. public EntityUid? AmbientSoundStream = null;
  56. /// <summary>
  57. /// The sound that the singularity produces when it forms.
  58. /// </summary>
  59. [DataField("formationSound")]
  60. [ViewVariables(VVAccess.ReadOnly)]
  61. public SoundSpecifier? FormationSound = null;
  62. /// <summary>
  63. /// The sound that the singularity produces when it dissipates.
  64. /// </summary>
  65. [DataField("dissipationSound")]
  66. [ViewVariables(VVAccess.ReadWrite)]
  67. public SoundSpecifier? DissipationSound = new SoundPathSpecifier(
  68. "/Audio/Effects/singularity_collapse.ogg",
  69. AudioParams.Default
  70. );
  71. #endregion Audio
  72. }