All computers play the keyboard sound + small research client cleanup (#7312)

This commit is contained in:
Rane
2022-04-08 17:17:05 -04:00
committed by GitHub
parent 6e91538baf
commit 427f7378c3
7 changed files with 22 additions and 26 deletions

View File

@@ -2,6 +2,7 @@ using Content.Server.Explosion.EntitySystems;
using Content.Server.Interaction.Components;
using Content.Server.Sound.Components;
using Content.Server.Throwing;
using Content.Server.UserInterface;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
using Content.Shared.Throwing;
@@ -29,6 +30,7 @@ namespace Content.Server.Sound
SubscribeLocalEvent<EmitSoundOnThrowComponent, ThrownEvent>(HandleEmitSoundOnThrown);
SubscribeLocalEvent<EmitSoundOnActivateComponent, ActivateInWorldEvent>(HandleEmitSoundOnActivateInWorld);
SubscribeLocalEvent<EmitSoundOnTriggerComponent, TriggerEvent>(HandleEmitSoundOnTrigger);
SubscribeLocalEvent<EmitSoundOnUIOpenComponent, AfterActivatableUIOpenEvent>(HandleEmitSoundOnUIOpen);
}
private void HandleEmitSoundOnTrigger(EntityUid uid, EmitSoundOnTriggerComponent component, TriggerEvent args)
@@ -64,6 +66,11 @@ namespace Content.Server.Sound
arg.Handled = true;
}
private void HandleEmitSoundOnUIOpen(EntityUid eUI, BaseEmitSoundComponent component, AfterActivatableUIOpenEvent arg)
{
TryEmitSound(component);
}
private void TryEmitSound(BaseEmitSoundComponent component)
{
var audioParams = component.AudioParams.WithPitchScale((float) _random.NextGaussian(1, component.PitchVariation));