Files
Delta-v/Content.Server/Medical/CrewMonitoring/CrewMonitoringConsoleComponent.cs
T
Quanteey ca4db5d946 Make crew monitors beep when someone dies / crits (#2930)
* Make the crew monitors beep when someone dies or crits

* Cleanup

* Fix a comment that was not updated earlier.

Signed-off-by: Quanteey <61941975+Quanteey@users.noreply.github.com>

* Switch frame time tracking to using timespans

* use timestamps of next alert instead of frame time tracking

* Fix outdated docs

---------

Signed-off-by: Quanteey <61941975+Quanteey@users.noreply.github.com>
2025-02-11 08:40:36 +00:00

53 lines
1.8 KiB
C#

using Content.Shared.Medical.SuitSensor;
using Robust.Shared.Audio; // DeltaV
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; // DeltaV
namespace Content.Server.Medical.CrewMonitoring;
[RegisterComponent, AutoGenerateComponentPause] // DeltaV - add AutoGenerateComponentPause
[Access(typeof(CrewMonitoringConsoleSystem))]
public sealed partial class CrewMonitoringConsoleComponent : Component
{
/// <summary>
/// List of all currently connected sensors to this console.
/// </summary>
public Dictionary<string, SuitSensorStatus> ConnectedSensors = new();
/// <summary>
/// After what time sensor consider to be lost.
/// </summary>
[DataField("sensorTimeout"), ViewVariables(VVAccess.ReadWrite)]
public float SensorTimeout = 10f;
// DeltaV - start of alert system code
/// <summary>
/// Should the component beep if someone goes critical or dies
/// </summary>
[DataField]
public bool AlertsEnabled = true;
/// <summary>
/// Track sensors that have triggered the crew member critical alert.
/// </summary>
public HashSet<string> AlertedSensors = [];
/// <summary>
/// Timestamp of the next possible alert (alert cooldown)
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField]
public TimeSpan NextAlert;
/// <summary>
/// Time between alerts
/// </summary>
[DataField]
public TimeSpan AlertCooldown = TimeSpan.FromSeconds(15);
/// <summary>
/// Alert sound that is played when a crew member goes into critical / dies.
/// </summary>
[DataField]
public SoundSpecifier AlertSound = new SoundPathSpecifier("/Audio/_DV/Medical/CrewMonitoring/crew_alert.ogg");
// DeltaV - end of alert system code
}