Removes LoopingSoundComponent. (#4396)

I'm sorry.
This commit is contained in:
Vera Aguilera Puerto
2021-07-31 12:41:59 +02:00
committed by GitHub
parent f93bdcd226
commit dc18997bf8
50 changed files with 120 additions and 380 deletions

View File

@@ -1,7 +1,10 @@
using Content.Client.Light.Components;
using System;
using Content.Client.Light.Components;
using Content.Shared.Light.Component;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Player;
namespace Content.Client.Light.Visualizers
{
@@ -17,7 +20,7 @@ namespace Content.Client.Light.Visualizers
return;
}
if (component.TryGetData(ExpendableLightVisuals.State, out string lightBehaviourID))
if (component.TryGetData(ExpendableLightVisuals.Behavior, out string lightBehaviourID))
{
if (component.Owner.TryGetComponent<LightBehaviourComponent>(out var lightBehaviour))
{
@@ -33,6 +36,35 @@ namespace Content.Client.Light.Visualizers
}
}
}
void TryStopStream(IPlayingAudioStream? stream)
{
try
{
stream?.Stop();
}
catch (Exception _)
{
// TODO: HOLY SHIT EXPOSE SOME DISPOSED PROPERTY ON PLAYING STREAM OR SOMETHING.
}
}
if (component.TryGetData(ExpendableLightVisuals.State, out ExpendableLightState state)
&& component.Owner.TryGetComponent<ExpendableLightComponent>(out var expendableLight))
{
switch (state)
{
case ExpendableLightState.Lit:
TryStopStream(expendableLight.PlayingStream);
expendableLight.PlayingStream = SoundSystem.Play(Filter.Local(), expendableLight.LoopedSound,
expendableLight.Owner, SharedExpendableLightComponent.LoopedSoundParams.WithLoop(true));
break;
case ExpendableLightState.Dead:
TryStopStream(expendableLight.PlayingStream);
break;
}
}
}
}
}