Add Eris' keyboard sounds to R&D Console. (#427)

* Add Eris' keyboard sounds to R&D Console.

* woah buddy thats not c# standard

* fix weirdly capitalized keyboard method

* thats silly
This commit is contained in:
Ephememory
2019-11-10 18:46:27 -05:00
committed by Pieter-Jan Briers
parent e5150d3714
commit 0d30bc2676
6 changed files with 31 additions and 1 deletions

View File

@@ -1,14 +1,19 @@
using Content.Server.GameObjects.EntitySystems;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.Audio;
using Content.Shared.GameObjects.Components.Research;
using Content.Shared.Research;
using Robust.Server.GameObjects.Components.UserInterface;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.GameObjects;
using Robust.Server.Interfaces.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Random;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
namespace Content.Server.GameObjects.Components.Research
{
@@ -16,8 +21,16 @@ namespace Content.Server.GameObjects.Components.Research
[ComponentReference(typeof(IActivate))]
public class ResearchConsoleComponent : SharedResearchConsoleComponent, IActivate
{
#pragma warning disable 649
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
[Dependency] private readonly IPrototypeManager _prototypeManager;
[Dependency] private readonly IRobustRandom _random;
#pragma warning restore 649
private BoundUserInterface _userInterface;
private ResearchClientComponent _client;
private const string _soundCollectionName = "keyboard";
public override void Initialize()
{
base.Initialize();
@@ -88,7 +101,16 @@ namespace Content.Server.GameObjects.Components.Research
return;
OpenUserInterface(actor.playerSession);
PlayKeyboardSound();
return;
}
private void PlayKeyboardSound()
{
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>(_soundCollectionName);
var file = _random.Pick(soundCollection.PickFiles);
var audioSystem = _entitySystemManager.GetEntitySystem<AudioSystem>();
audioSystem.Play(file);
}
}
}