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.MedicalScanner;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Medical.Components
@@ -25,6 +26,18 @@ namespace Content.Server.Medical.Components
public CancellationTokenSource? CancelToken;
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>
/// The disease this will give people.
/// </summary>

View File

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

Binary file not shown.

View File

@@ -1,10 +1,11 @@
The following sounds were used from freesound:
herbertboland - heavyskirtmovement.wav - CC BY 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
foley-cloth-denim-rip-003.mp3 -
zapsplat_food_bottle_golden_syrup_cap_open_then_close.mp3
foley-cloth-denim-rip-003.mp3 -
zapsplat_food_bottle_golden_syrup_cap_open_then_close.mp3

View File

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

View File

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