replacing sound (collection) names with SoundSpecifier - part 1

This commit is contained in:
Galactic Chimp
2021-07-10 17:35:33 +02:00
parent 4500b66f28
commit ce3c59e0e6
131 changed files with 934 additions and 587 deletions

View File

@@ -2,6 +2,7 @@
using System;
using Content.Shared.Acts;
using Content.Shared.Audio;
using Content.Shared.Sound;
using Content.Shared.Throwing;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
@@ -71,6 +72,9 @@ namespace Content.Server.Light.Components
private int _powerUse = 40;
public int PowerUse => _powerUse;
[DataField("breakSound")]
private SoundSpecifier _breakSound = new SoundCollectionSpecifier("GlassBreak");
/// <summary>
/// The current state of the light bulb. Invokes the OnLightBulbStateChange event when set.
/// It also updates the bulb's sprite accordingly.
@@ -129,10 +133,8 @@ namespace Content.Server.Light.Components
public void PlayBreakSound()
{
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>("GlassBreak");
var file = _random.Pick(soundCollection.PickFiles);
SoundSystem.Play(Filter.Pvs(Owner), file, Owner);
if(_breakSound.TryGetSound(out var breakSound))
SoundSystem.Play(Filter.Pvs(Owner), breakSound, Owner);
}
}
}