mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-20 06:39:55 +00:00
make travel music play when anyone is flying the ship
This commit is contained in:
parent
936a277758
commit
d1f40ef140
@ -41,4 +41,27 @@ public class ShipAudioPatches : QSBPatch
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(TravelMusicController), nameof(TravelMusicController.Update))]
|
||||
public static bool TravelMusicController_Update(TravelMusicController instance)
|
||||
{
|
||||
// only this line is changed
|
||||
instance._isTraveling = PlayerState.IsInsideShip()
|
||||
&& ShipManager.Instance.CurrentFlyer != uint.MaxValue
|
||||
&& Locator.GetPlayerRulesetDetector().AllowTravelMusic();
|
||||
|
||||
if (instance._isTraveling && !instance._wasTraveling)
|
||||
{
|
||||
instance._audioSource.FadeIn(5f, false, false, 1f);
|
||||
}
|
||||
else if (!instance._isTraveling && instance._wasTraveling)
|
||||
{
|
||||
instance._audioSource.FadeOut(5f, OWAudioSource.FadeOutCompleteAction.PAUSE, 0f);
|
||||
}
|
||||
|
||||
instance._wasTraveling = instance._isTraveling;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,10 @@ public class ShipManager : WorldObjectManager
|
||||
public ShipElectricalComponent ShipElectricalComponent;
|
||||
public ShipCockpitUI ShipCockpitUI;
|
||||
private GameObject _shipCustomAttach;
|
||||
|
||||
/// <summary>
|
||||
/// PlayerID of the person who is flying the ship. If no one is flying, this is <see cref="uint.MaxValue"/>.
|
||||
/// </summary>
|
||||
public uint CurrentFlyer
|
||||
{
|
||||
get => _currentFlyer;
|
||||
|
Loading…
x
Reference in New Issue
Block a user