Electrocution noises (#8061)

* Adds spark noises when an entity gets electrocuted by something

* oops

* double oops

* Update Content.Server/Electrocution/Components/ElectrifiedComponent.cs

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Flipp Syder
2022-05-09 18:40:15 -07:00
committed by GitHub
parent f2c4ece639
commit 8257635811
2 changed files with 22 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ using Content.Shared.StatusEffect;
using Content.Shared.Stunnable;
using Content.Shared.Tag;
using Content.Shared.Weapons.Melee;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
@@ -388,6 +389,7 @@ namespace Content.Server.Electrocution
{
_popupSystem.PopupEntity(Loc.GetString("electrocuted-component-mob-shocked-by-source-popup-others",
("mob", uid), ("source", (sourceUid.Value))), uid, filter);
PlayElectrocutionSound(uid, sourceUid.Value);
}
else
{
@@ -440,5 +442,15 @@ namespace Content.Server.Electrocution
SetInsulatedSiemensCoefficient(uid, _random.Pick(randomInsulation.List), insulated);
}
private void PlayElectrocutionSound(EntityUid targetUid, EntityUid sourceUid, ElectrifiedComponent? electrified = null)
{
if (!Resolve(sourceUid, ref electrified) || !electrified.PlaySoundOnShock)
{
return;
}
SoundSystem.Play(Filter.Pvs(targetUid), electrified.ShockNoises.GetSound(), targetUid, AudioParams.Default.WithVolume(electrified.ShockVolume));
}
}
}