Fix AudioSystem nullability checks for engine PR (#32233)

This commit is contained in:
Leon Friedrich
2024-09-18 11:43:30 +10:00
committed by Spatison
parent de98315595
commit 302baba768
10 changed files with 17 additions and 41 deletions

View File

@@ -44,11 +44,11 @@ public sealed class WeatherSystem : SharedWeatherSystem
return;
}
if (!Timing.IsFirstTimePredicted || weatherProto.Sound == null
|| weather.Stream is not null) // Don't ever generate more than one weather sound.
if (!Timing.IsFirstTimePredicted || weatherProto.Sound == null)
return;
weather.Stream ??= _audio.PlayGlobal(weatherProto.Sound, Filter.Local(), true)?.Entity;
if (!TryComp(weather.Stream, out AudioComponent? comp))
return;