-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #564 from misternebula/dev
0.22.0
- Loading branch information
Showing
171 changed files
with
2,629 additions
and
593 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
QSB/Animation/Player/Thrusters/RemoteThrusterFlameController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using QSB.Messaging; | ||
using QSB.Player; | ||
using QSB.WorldSync; | ||
|
||
namespace QSB.Audio.Messages; | ||
|
||
|
||
public class PlayerAudioControllerOneShotMessage : QSBMessage<(AudioType audioType, uint userID, float pitch, float volume)> | ||
{ | ||
public PlayerAudioControllerOneShotMessage(AudioType audioType, uint userID, float pitch = 1f, float volume = 1f) : base((audioType, userID, pitch, volume)) { } | ||
|
||
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady; | ||
|
||
public override void OnReceiveRemote() => | ||
QSBPlayerManager.GetPlayer(Data.userID)?.AudioController?.PlayOneShot(Data.audioType, Data.pitch, Data.volume); | ||
} |
12 changes: 12 additions & 0 deletions
12
QSB/Audio/Messages/PlayerAudioControllerUpdateHazardDamageMessage.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using QSB.Messaging; | ||
using QSB.Player; | ||
|
||
namespace QSB.Audio.Messages; | ||
|
||
internal class PlayerAudioControllerUpdateHazardDamageMessage : QSBMessage<(uint userID, HazardVolume.HazardType latestHazardType)> | ||
{ | ||
public PlayerAudioControllerUpdateHazardDamageMessage((uint userID, HazardVolume.HazardType latestHazardType) data) : base(data) { } | ||
|
||
public override void OnReceiveRemote() => | ||
QSBPlayerManager.GetPlayer(Data.userID)?.AudioController.SetHazardDamage(Data.latestHazardType); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using QSB.Messaging; | ||
using QSB.Player; | ||
using QSB.WorldSync; | ||
|
||
namespace QSB.Audio.Messages; | ||
|
||
|
||
public class PlayerMovementAudioFootstepMessage : QSBMessage<(AudioType audioType, float pitch, uint userID)> | ||
{ | ||
public PlayerMovementAudioFootstepMessage(AudioType audioType, float pitch, uint userID) : base((audioType, pitch, userID)) { } | ||
|
||
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady; | ||
|
||
public override void OnReceiveRemote() => | ||
QSBPlayerManager.GetPlayer(Data.userID)?.AudioController?.PlayFootstep(Data.audioType, Data.pitch); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using QSB.Messaging; | ||
using QSB.Player; | ||
using QSB.WorldSync; | ||
|
||
namespace QSB.Audio.Messages; | ||
|
||
|
||
public class PlayerMovementAudioJumpMessage : QSBMessage<(float pitch, uint userID)> | ||
{ | ||
public PlayerMovementAudioJumpMessage(float pitch, uint userID) : base((pitch, userID)) { } | ||
|
||
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady; | ||
|
||
public override void OnReceiveRemote() => | ||
QSBPlayerManager.GetPlayer(Data.userID)?.AudioController?.OnJump(Data.pitch); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using QSB.Messaging; | ||
using QSB.ShipSync; | ||
using QSB.WorldSync; | ||
|
||
namespace QSB.Audio.Messages; | ||
|
||
|
||
public class ShipThrusterAudioOneShotMessage : QSBMessage<(AudioType audioType, float pitch, float volume)> | ||
{ | ||
public ShipThrusterAudioOneShotMessage(AudioType audioType, float pitch = 1f, float volume = 1f) : base((audioType, pitch, volume)) { } | ||
|
||
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady; | ||
|
||
public override void OnReceiveRemote() | ||
{ | ||
var source = ShipManager.Instance.ShipThrusterAudio._rotationalSource; | ||
source.pitch = Data.pitch; | ||
source.PlayOneShot(Data.audioType, Data.volume); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using HarmonyLib; | ||
using QSB.Audio.Messages; | ||
using QSB.Messaging; | ||
using QSB.Patches; | ||
using QSB.Player; | ||
using UnityEngine; | ||
|
||
namespace QSB.Audio.Patches; | ||
|
||
[HarmonyPatch] | ||
internal class PlayerAudioControllerPatches : QSBPatch | ||
{ | ||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect; | ||
|
||
private static void PlayOneShot(AudioType audioType) => | ||
new PlayerAudioControllerOneShotMessage(audioType, QSBPlayerManager.LocalPlayerId).Send(); | ||
|
||
[HarmonyPostfix] | ||
[HarmonyPatch(typeof(PlayerAudioController), nameof(PlayerAudioController.PlayMarshmallowEat))] | ||
public static void PlayerAudioController_PlayMarshmallowEat() => PlayOneShot(AudioType.ToolMarshmallowEat); | ||
|
||
[HarmonyPostfix] | ||
[HarmonyPatch(typeof(PlayerAudioController), nameof(PlayerAudioController.PlayMarshmallowEatBurnt))] | ||
public static void PlayerAudioController_PlayMarshmallowEatBurnt() => PlayOneShot(AudioType.ToolMarshmallowEatBurnt); | ||
|
||
[HarmonyPostfix] | ||
[HarmonyPatch(typeof(PlayerAudioController), nameof(PlayerAudioController.PlayPatchPuncture))] | ||
public static void PlayerAudioController_PlayPatchPuncture() => PlayOneShot(AudioType.PlayerSuitPatchPuncture); | ||
|
||
[HarmonyPostfix] | ||
[HarmonyPatch(typeof(PlayerAudioController), nameof(PlayerAudioController.PlayMedkit))] | ||
public static void PlayerAudioController_PlayMedkit() => PlayOneShot(AudioType.ShipCabinUseMedkit); | ||
|
||
[HarmonyPostfix] | ||
[HarmonyPatch(typeof(PlayerAudioController), nameof(PlayerAudioController.PlayRefuel))] | ||
public static void PlayerAudioController_PlayRefuel() => PlayOneShot(AudioType.ShipCabinUseRefueller); | ||
|
||
[HarmonyPostfix] | ||
[HarmonyPatch(typeof(PlayerAudioController), nameof(PlayerAudioController.OnArtifactFocus))] | ||
public static void PlayerAudioController_OnArtifactFocus() => PlayOneShot(AudioType.Artifact_Focus); | ||
|
||
[HarmonyPostfix] | ||
[HarmonyPatch(typeof(PlayerAudioController), nameof(PlayerAudioController.OnArtifactUnfocus))] | ||
public static void PlayerAudioController_OnArtifactUnfocus() => PlayOneShot(AudioType.Artifact_Unfocus); | ||
|
||
[HarmonyPostfix] | ||
[HarmonyPatch(typeof(PlayerAudioController), nameof(PlayerAudioController.OnArtifactConceal))] | ||
public static void PlayerAudioController_OnArtifactConceal() => PlayOneShot(AudioType.Artifact_Conceal); | ||
|
||
[HarmonyPostfix] | ||
[HarmonyPatch(typeof(PlayerAudioController), nameof(PlayerAudioController.OnArtifactUnconceal))] | ||
public static void PlayerAudioController_OnArtifactUnconceal() => PlayOneShot(AudioType.Artifact_Unconceal); | ||
|
||
[HarmonyPrefix] | ||
[HarmonyPatch(typeof(PlayerAudioController), nameof(PlayerAudioController.UpdateHazardDamage))] | ||
public static void PlayerAudioController_UpdateHazardDamage(PlayerAudioController __instance, float damage, HazardDetector hazardDetector) | ||
{ | ||
var hazardType = damage > 0f ? hazardDetector.GetLatestHazardType() : HazardVolume.HazardType.NONE; | ||
if (hazardType != __instance._hazardTypePlaying) | ||
{ | ||
new PlayerAudioControllerUpdateHazardDamageMessage((QSBPlayerManager.LocalPlayerId, hazardDetector.GetLatestHazardType())).Send(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using HarmonyLib; | ||
using QSB.Audio.Messages; | ||
using QSB.Messaging; | ||
using QSB.Patches; | ||
using QSB.Player; | ||
|
||
namespace QSB.Audio.Patches; | ||
|
||
internal class PlayerImpactAudioPatches : QSBPatch | ||
{ | ||
// Since we patch Start we do it when the mod starts, else it won't run | ||
public override QSBPatchTypes Type => QSBPatchTypes.OnModStart; | ||
|
||
[HarmonyPostfix] | ||
[HarmonyPatch(typeof(PlayerImpactAudio), nameof(PlayerImpactAudio.Start))] | ||
public static void PlayerImpactAudio_Start(PlayerImpactAudio __instance) | ||
{ | ||
__instance.gameObject.AddComponent<QSBAudioSourceOneShotTracker>(); | ||
} | ||
|
||
[HarmonyPrefix] | ||
[HarmonyPatch(typeof(PlayerImpactAudio), nameof(PlayerImpactAudio.OnImpact))] | ||
public static void PlayerImpactAudio_OnImpact_Prefix(PlayerImpactAudio __instance) => | ||
// First we reset in case no audio is actually played | ||
__instance.gameObject.GetComponent<QSBAudioSourceOneShotTracker>()?.Reset(); | ||
|
||
[HarmonyPostfix] | ||
[HarmonyPatch(typeof(PlayerImpactAudio), nameof(PlayerImpactAudio.OnImpact))] | ||
public static void PlayerImpactAudio_OnImpact_Postfix(PlayerImpactAudio __instance) | ||
{ | ||
var tracker = __instance.gameObject.GetComponent<QSBAudioSourceOneShotTracker>(); | ||
if (tracker) | ||
{ | ||
if (tracker.LastPlayed != AudioType.None) | ||
{ | ||
new PlayerAudioControllerOneShotMessage(tracker.LastPlayed, QSBPlayerManager.LocalPlayerId, tracker.Pitch, tracker.Volume).Send(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using HarmonyLib; | ||
using QSB.Audio.Messages; | ||
using QSB.Messaging; | ||
using QSB.Patches; | ||
using QSB.Player; | ||
|
||
namespace QSB.Audio.Patches; | ||
|
||
internal class PlayerMovementAudioPatches : QSBPatch | ||
{ | ||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect; | ||
|
||
[HarmonyPostfix] | ||
[HarmonyPatch(typeof(PlayerMovementAudio), nameof(PlayerMovementAudio.PlayFootstep))] | ||
public static void PlayerMovementAudio_PlayFootstep(PlayerMovementAudio __instance) | ||
{ | ||
var underwater = !PlayerState.IsCameraUnderwater() && __instance._fluidDetector.InFluidType(FluidVolume.Type.WATER); | ||
var audioType = underwater ? AudioType.MovementShallowWaterFootstep : PlayerMovementAudio.GetFootstepAudioType(__instance._playerController.GetGroundSurface()); | ||
|
||
if (audioType != AudioType.None) | ||
{ | ||
new PlayerMovementAudioFootstepMessage(audioType, __instance._footstepAudio.pitch, QSBPlayerManager.LocalPlayerId).Send(); | ||
} | ||
} | ||
|
||
[HarmonyPostfix] | ||
[HarmonyPatch(typeof(PlayerMovementAudio), nameof(PlayerMovementAudio.OnJump))] | ||
public static void PlayerMovementAudio_OnJump(PlayerMovementAudio __instance) | ||
{ | ||
new PlayerMovementAudioJumpMessage(__instance._jumpAudio.pitch, QSBPlayerManager.LocalPlayerId).Send(); | ||
} | ||
} |
Oops, something went wrong.