using Robust.Shared.GameStates; using Content.Shared.Singularity.EntitySystems; using Robust.Shared.Audio; using Robust.Shared.Utility; namespace Content.Shared.Singularity.Components; /// /// A component that makes the associated entity accumulate energy when an associated event horizon consumes things. /// Energy management is server-side. /// [RegisterComponent, NetworkedComponent] public sealed partial class SingularityComponent : Component { /// /// The current level of the singularity. /// Used as a scaling factor for things like visual size, event horizon radius, gravity well radius, radiation output, etc. /// If you want to set this use (). /// [Access(friends: typeof(SharedSingularitySystem), Other = AccessPermissions.Read, Self = AccessPermissions.Read)] [DataField("level")] public byte Level = 1; /// /// The amount of radiation this singularity emits per its level. /// Has to be on shared in case someone attaches a RadiationPulseComponent to the singularity. /// If you want to set this use (). /// [Access(friends: typeof(SharedSingularitySystem), Other = AccessPermissions.Read, Self = AccessPermissions.Read)] [DataField("radsPerLevel")] [ViewVariables(VVAccess.ReadWrite)] public float RadsPerLevel = 2f; /// /// The amount of energy this singularity contains. /// [DataField("energy")] public float Energy = 180f; /// /// The rate at which this singularity loses energy over time. /// [DataField("energyLoss")] [ViewVariables(VVAccess.ReadWrite)] public float EnergyDrain; #region Audio /// /// The sound that this singularity produces by existing. /// [DataField("ambientSound")] [ViewVariables(VVAccess.ReadOnly)] public SoundSpecifier? AmbientSound = new SoundPathSpecifier( "/Audio/Effects/singularity_form.ogg", AudioParams.Default.WithVolume(5).WithLoop(true).WithMaxDistance(20f) ); /// /// The audio stream that plays the sound specified by on loop. /// [ViewVariables(VVAccess.ReadWrite)] public EntityUid? AmbientSoundStream = null; /// /// The sound that the singularity produces when it forms. /// [DataField("formationSound")] [ViewVariables(VVAccess.ReadOnly)] public SoundSpecifier? FormationSound = null; /// /// The sound that the singularity produces when it dissipates. /// [DataField("dissipationSound")] [ViewVariables(VVAccess.ReadWrite)] public SoundSpecifier? DissipationSound = new SoundPathSpecifier( "/Audio/Effects/singularity_collapse.ogg", AudioParams.Default ); #endregion Audio #region Update Timing /// /// The amount of time that should elapse between automated updates to this singularity. /// [DataField("updatePeriod")] [ViewVariables(VVAccess.ReadWrite)] public TimeSpan TargetUpdatePeriod = TimeSpan.FromSeconds(1.0); /// /// [ViewVariables(VVAccess.ReadOnly)] public TimeSpan NextUpdateTime = default!; /// /// The last time this singularity was updated. /// [ViewVariables(VVAccess.ReadOnly)] public TimeSpan LastUpdateTime = default!; #endregion Update Timing }