mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-06 01:00:16 +00:00
fix TravelerToSignalName
This commit is contained in:
parent
0cb8b48b71
commit
d0c116201b
@ -1,7 +1,6 @@
|
||||
using HarmonyLib;
|
||||
using QSB.Patches;
|
||||
using QSB.Utility;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
@ -112,7 +111,7 @@ namespace QSB.Animation.NPC.Patches
|
||||
internal static class TravelerAudioManagerExtensions
|
||||
{
|
||||
/// bad, but works great
|
||||
private static SignalName TravelerToSignalName(TravelerController traveler)
|
||||
private static SignalName? TravelerToSignalName(TravelerController traveler)
|
||||
{
|
||||
var name = traveler.name;
|
||||
|
||||
@ -151,12 +150,17 @@ namespace QSB.Animation.NPC.Patches
|
||||
return SignalName.Traveler_Prisoner;
|
||||
}
|
||||
|
||||
throw new ArgumentOutOfRangeException(nameof(name), name, null);
|
||||
return null;
|
||||
}
|
||||
|
||||
internal static void StopTravelerAudio(this TravelerAudioManager manager, TravelerController traveler)
|
||||
{
|
||||
var signalName = TravelerToSignalName(traveler);
|
||||
if (signalName == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var signal = manager._signals.First(x => x.GetName() == signalName);
|
||||
|
||||
signal.GetOWAudioSource().FadeOut(0.5f);
|
||||
@ -165,6 +169,11 @@ namespace QSB.Animation.NPC.Patches
|
||||
internal static void PlayTravelerAudio(this TravelerAudioManager manager, TravelerController traveler, float audioDelay)
|
||||
{
|
||||
var signalName = TravelerToSignalName(traveler);
|
||||
if (signalName == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var signal = manager._signals.First(x => x.GetName() == signalName);
|
||||
|
||||
manager._playAfterDelay = false;
|
||||
|
Loading…
Reference in New Issue
Block a user