Make Health Analysers UI continuously update (#22449)

This commit is contained in:
Rainfey
2024-02-06 13:20:09 +00:00
committed by GitHub
parent b34931bbde
commit 4129c77a5b
8 changed files with 257 additions and 105 deletions

View File

@@ -1,32 +1,54 @@
using Content.Server.UserInterface;
using Content.Shared.MedicalScanner;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.Medical.Components
namespace Content.Server.Medical.Components;
/// <summary>
/// After scanning, retrieves the target Uid to use with its related UI.
/// </summary>
[RegisterComponent]
[Access(typeof(HealthAnalyzerSystem))]
public sealed partial class HealthAnalyzerComponent : Component
{
/// <summary>
/// After scanning, retrieves the target Uid to use with its related UI.
/// When should the next update be sent for the patient
/// </summary>
[RegisterComponent]
public sealed partial class HealthAnalyzerComponent : Component
{
/// <summary>
/// How long it takes to scan someone.
/// </summary>
[DataField("scanDelay")]
public float ScanDelay = 0.8f;
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan NextUpdate = TimeSpan.Zero;
/// <summary>
/// Sound played on scanning begin
/// </summary>
[DataField("scanningBeginSound")]
public SoundSpecifier? ScanningBeginSound;
/// <summary>
/// The delay between patient health updates
/// </summary>
[DataField]
public TimeSpan UpdateInterval = TimeSpan.FromSeconds(1);
/// <summary>
/// Sound played on scanning end
/// </summary>
[DataField("scanningEndSound")]
public SoundSpecifier? ScanningEndSound;
}
/// <summary>
/// How long it takes to scan someone.
/// </summary>
[DataField]
public TimeSpan ScanDelay = TimeSpan.FromSeconds(0.8);
/// <summary>
/// Which entity has been scanned, for continuous updates
/// </summary>
[DataField]
public EntityUid? ScannedEntity;
/// <summary>
/// The maximum range in tiles at which the analyzer can receive continuous updates
/// </summary>
[DataField]
public float MaxScanRange = 2.5f;
/// <summary>
/// Sound played on scanning begin
/// </summary>
[DataField]
public SoundSpecifier? ScanningBeginSound;
/// <summary>
/// Sound played on scanning end
/// </summary>
[DataField]
public SoundSpecifier? ScanningEndSound;
}