Sounds for stun baton

This commit is contained in:
zumorica
2020-05-14 16:13:25 +02:00
parent a22c1cb196
commit a8275b4fae
10 changed files with 30 additions and 21 deletions

View File

@@ -34,7 +34,8 @@ namespace Content.Server.Mobs
appearance.SetData(SharedSpeciesComponent.MobVisuals.RotationState, newState);
if (playSound)
PlaySoundCollection("bodyfall", AudioHelpers.WithVariation(0.25f));
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>()
.Play(AudioHelpers.GetRandomFileFromSoundCollection("bodyfall"), entity, AudioHelpers.WithVariation(0.25f));
if(dropItems)
DropAllItemsInHands(entity);
@@ -69,13 +70,5 @@ namespace Content.Server.Mobs
hands.Drop(heldItem.Owner);
}
}
private static void PlaySoundCollection(string name, AudioParams parameters = default)
{
var soundCollection = IoCManager.Resolve<IPrototypeManager>().Index<SoundCollectionPrototype>(name);
var file = IoCManager.Resolve<IRobustRandom>().Pick(soundCollection.PickFiles);
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>()
.Play(file, parameters);
}
}
}