Adds a sound effect to health analyzers (#13425)

This commit is contained in:
nmajask
2023-01-12 01:38:39 -05:00
committed by GitHub
parent 9199bd649c
commit a0086b5184
6 changed files with 34 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ using Content.Server.UserInterface;
using Content.Shared.Disease; using Content.Shared.Disease;
using Content.Shared.MedicalScanner; using Content.Shared.MedicalScanner;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Medical.Components namespace Content.Server.Medical.Components
@@ -25,6 +26,18 @@ namespace Content.Server.Medical.Components
public CancellationTokenSource? CancelToken; public CancellationTokenSource? CancelToken;
public BoundUserInterface? UserInterface => Owner.GetUIOrNull(HealthAnalyzerUiKey.Key); public BoundUserInterface? UserInterface => Owner.GetUIOrNull(HealthAnalyzerUiKey.Key);
/// <summary>
/// Sound played on scanning begin
/// </summary>
[DataField("scanningBeginSound")]
public SoundSpecifier? ScanningBeginSound = null;
/// <summary>
/// Sound played on scanning end
/// </summary>
[DataField("scanningEndSound")]
public SoundSpecifier? ScanningEndSound = null;
/// <summary> /// <summary>
/// The disease this will give people. /// The disease this will give people.
/// </summary> /// </summary>

View File

@@ -7,6 +7,7 @@ using Content.Shared.Damage;
using Content.Shared.IdentityManagement; using Content.Shared.IdentityManagement;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using Content.Shared.MobState.Components; using Content.Shared.MobState.Components;
using Content.Shared.Audio;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Shared.Player; using Robust.Shared.Player;
using static Content.Shared.MedicalScanner.SharedHealthAnalyzerComponent; using static Content.Shared.MedicalScanner.SharedHealthAnalyzerComponent;
@@ -15,6 +16,7 @@ namespace Content.Server.Medical
{ {
public sealed class HealthAnalyzerSystem : EntitySystem public sealed class HealthAnalyzerSystem : EntitySystem
{ {
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly DiseaseSystem _disease = default!; [Dependency] private readonly DiseaseSystem _disease = default!;
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!; [Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!;
@@ -55,6 +57,9 @@ namespace Content.Server.Medical
return; return;
healthAnalyzer.CancelToken = new CancellationTokenSource(); healthAnalyzer.CancelToken = new CancellationTokenSource();
_audio.PlayPvs(healthAnalyzer.ScanningBeginSound, uid);
_doAfterSystem.DoAfter(new DoAfterEventArgs(args.User, healthAnalyzer.ScanDelay, healthAnalyzer.CancelToken.Token, target: args.Target) _doAfterSystem.DoAfter(new DoAfterEventArgs(args.User, healthAnalyzer.ScanDelay, healthAnalyzer.CancelToken.Token, target: args.Target)
{ {
BroadcastFinishedEvent = new TargetScanSuccessfulEvent(args.User, args.Target, healthAnalyzer), BroadcastFinishedEvent = new TargetScanSuccessfulEvent(args.User, args.Target, healthAnalyzer),
@@ -69,6 +74,9 @@ namespace Content.Server.Medical
private void OnTargetScanSuccessful(TargetScanSuccessfulEvent args) private void OnTargetScanSuccessful(TargetScanSuccessfulEvent args)
{ {
args.Component.CancelToken = null; args.Component.CancelToken = null;
_audio.PlayPvs(args.Component.ScanningEndSound, args.User);
UpdateScannedUser(args.Component.Owner, args.User, args.Target, args.Component); UpdateScannedUser(args.Component.Owner, args.User, args.Target, args.Component);
// Below is for the traitor item // Below is for the traitor item
// Piggybacking off another component's doafter is complete CBT so I gave up // Piggybacking off another component's doafter is complete CBT so I gave up

Binary file not shown.

View File

@@ -3,6 +3,7 @@ The following sounds were used from freesound:
herbertboland - heavyskirtmovement.wav - CC BY 3.0 herbertboland - heavyskirtmovement.wav - CC BY 3.0
vinrax - cloth-sounds.mp3 - CC BY-NC 3.0 vinrax - cloth-sounds.mp3 - CC BY-NC 3.0
lordvanye - skintouching.wav - CC0 1.0 lordvanye - skintouching.wav - CC0 1.0
FM Synthesis - healthscanner.ogg - CC BY 4.0
Additional sound effects from https://www.zapsplat.com Additional sound effects from https://www.zapsplat.com

View File

@@ -141,6 +141,8 @@
state: pda-internmed state: pda-internmed
- type: HealthAnalyzer - type: HealthAnalyzer
scanDelay: 1.4 scanDelay: 1.4
scanningEndSound:
path: "/Audio/Items/Medical/healthscanner.ogg"
- type: entity - type: entity
parent: BasePDA parent: BasePDA
@@ -493,6 +495,8 @@
state: pda-cmo state: pda-cmo
- type: HealthAnalyzer - type: HealthAnalyzer
scanDelay: 1 scanDelay: 1
scanningEndSound:
path: "/Audio/Items/Medical/healthscanner.ogg"
- type: entity - type: entity
parent: BasePDA parent: BasePDA
@@ -513,6 +517,8 @@
state: pda-medical state: pda-medical
- type: HealthAnalyzer - type: HealthAnalyzer
scanDelay: 1.2 scanDelay: 1.2
scanningEndSound:
path: "/Audio/Items/Medical/healthscanner.ogg"
- type: entity - type: entity
parent: BasePDA parent: BasePDA

View File

@@ -16,6 +16,8 @@
- key: enum.HealthAnalyzerUiKey.Key - key: enum.HealthAnalyzerUiKey.Key
type: HealthAnalyzerBoundUserInterface type: HealthAnalyzerBoundUserInterface
- type: HealthAnalyzer - type: HealthAnalyzer
scanningEndSound:
path: "/Audio/Items/Medical/healthscanner.ogg"
- type: Tag - type: Tag
tags: tags:
- DiscreteHealthAnalyzer - DiscreteHealthAnalyzer