mirror of
https://github.com/Facepunch/sbox-public.git
synced 2025-12-23 22:48:07 -05:00
Fix SoundscapeTrigger Error if source or SoundFile is not valid (#3489)
* Fix SoundscapeTrigger error if source or SoundFile is not valid
This commit is contained in:
@@ -317,6 +317,12 @@ public class SoundscapeTrigger : Component
|
||||
|
||||
public override void Frame( in Transform head )
|
||||
{
|
||||
if ( source?.SoundFile?.IsValid() == false )
|
||||
{
|
||||
Finished = true;
|
||||
return;
|
||||
}
|
||||
|
||||
var targetVolume = sourceVolume * internalVolume * Volume;
|
||||
if ( Finished ) targetVolume = 0.0f;
|
||||
|
||||
@@ -374,6 +380,12 @@ public class SoundscapeTrigger : Component
|
||||
if ( timeUntilNextShot > 0 )
|
||||
return;
|
||||
|
||||
if ( source?.SoundFile?.IsValid() == false )
|
||||
{
|
||||
Finished = true;
|
||||
return;
|
||||
}
|
||||
|
||||
timeUntilNextShot = source.RepeatTime.GetValue();
|
||||
|
||||
handle?.Stop( 0.1f );
|
||||
|
||||
Reference in New Issue
Block a user