Radiation pulse ECS (#10641)

This commit is contained in:
Alex Evgrashin
2022-08-31 12:24:21 +02:00
committed by GitHub
parent ccb240ccca
commit cad6c760ad
18 changed files with 146 additions and 258 deletions

View File

@@ -54,6 +54,7 @@ namespace Content.Server.Sound
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<EmitSoundOnSpawnComponent, ComponentInit>(HandleEmitSpawnOnInit);
SubscribeLocalEvent<EmitSoundOnLandComponent, LandEvent>(HandleEmitSoundOnLand);
SubscribeLocalEvent<EmitSoundOnUseComponent, UseInHandEvent>(HandleEmitSoundOnUseInHand);
SubscribeLocalEvent<EmitSoundOnThrowComponent, ThrownEvent>(HandleEmitSoundOnThrown);
@@ -64,6 +65,11 @@ namespace Content.Server.Sound
SubscribeLocalEvent<EmitSoundOnDropComponent, DroppedEvent>(HandleEmitSoundOnDrop);
}
private void HandleEmitSpawnOnInit(EntityUid uid, EmitSoundOnSpawnComponent component, ComponentInit args)
{
TryEmitSound(component);
}
private void HandleEmitSoundOnTrigger(EntityUid uid, EmitSoundOnTriggerComponent component, TriggerEvent args)
{
TryEmitSound(component);
@@ -122,6 +128,8 @@ namespace Content.Server.Sound
private void TryEmitSound(BaseEmitSoundComponent component)
{
if (component.Sound == null)
return;
_audioSystem.PlayPvs(component.Sound, component.Owner, component.Sound.Params.AddVolume(-2f));
}
}