Files
tbd-station-14/Content.Shared/PDA/Ringer/RingerComponent.cs
Milon 6138fcdce9 Predict and cleanup RingerComponent (#35907)
* clean up most stuff

* move to shared

* works

* shuffle shit around

* oops! access

* fixes

* todo: everything

* SUFFERING

* curse you
2025-04-19 15:55:05 +02:00

58 lines
1.8 KiB
C#

using Robust.Shared.GameStates;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.PDA.Ringer;
[RegisterComponent, NetworkedComponent, Access(typeof(SharedRingerSystem))]
[AutoGenerateComponentState(true, fieldDeltas: true), AutoGenerateComponentPause]
public sealed partial class RingerComponent : Component
{
/// <summary>
/// The ringtone, represented as an array of notes.
/// </summary>
[DataField, AutoNetworkedField]
public Note[] Ringtone = new Note[SharedRingerSystem.RingtoneLength];
/// <summary>
/// The last time this ringer's ringtone was set.
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField, AutoNetworkedField]
public TimeSpan NextRingtoneSetTime;
/// <summary>
/// The time when the next note should play.
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField, AutoNetworkedField]
public TimeSpan? NextNoteTime;
/// <summary>
/// The cooldown before the ringtone can be changed again.
/// </summary>
[DataField]
public TimeSpan Cooldown = TimeSpan.FromMilliseconds(250);
/// <summary>
/// Keeps track of how many notes have elapsed if the ringer component is playing.
/// </summary>
[DataField, AutoNetworkedField]
public int NoteCount;
/// <summary>
/// How far the sound projects in metres.
/// </summary>
[DataField, AutoNetworkedField]
public float Range = 3f;
/// <summary>
/// The ringtone volume.
/// </summary>
[DataField, AutoNetworkedField]
public float Volume = -4f;
/// <summary>
/// Whether the ringer is currently playing its ringtone.
/// </summary>
[DataField, AutoNetworkedField]
public bool Active;
}