Skip to content

Commit

Permalink
Merge pull request #564 from misternebula/dev
Browse files Browse the repository at this point in the history
0.22.0
  • Loading branch information
misternebula authored Oct 7, 2022
2 parents 60f479b + b4dea30 commit 948ae13
Show file tree
Hide file tree
Showing 171 changed files with 2,629 additions and 593 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ jobs:

- uses: actions/upload-artifact@v2
with:
name: QSB
name: Raicuparta.QuantumSpaceBuddies
path: .\QSB\Bin\Debug
2 changes: 1 addition & 1 deletion EpicOnlineTransport/EpicOnlineTransport.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<RootNamespace>EpicTransport</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OuterWildsGameLibs" Version="1.1.13.393" IncludeAssets="compile" />
<Reference Include="../Mirror/*.dll" />
<PackageReference Include="OuterWildsGameLibs" Version="1.1.12.201" IncludeAssets="compile" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions EpicRerouter/EpicRerouter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OuterWildsGameLibs" Version="1.1.12.201" IncludeAssets="compile" />
<PackageReference Include="HarmonyX" Version="2.10.0" IncludeAssets="compile" />
<PackageReference Include="OuterWildsGameLibs" Version="1.1.13.393" IncludeAssets="compile" />
<PackageReference Include="OWML" Version="2.7.0" IncludeAssets="compile" />
</ItemGroup>
</Project>
5 changes: 2 additions & 3 deletions MirrorWeaver/MirrorWeaver.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OuterWildsGameLibs" Version="1.1.12.201" />
<PackageReference Include="OWML" Version="2.5.2" />
<PackageReference Include="HarmonyX" Version="2.10.0" />
<PackageReference Include="OuterWildsGameLibs" Version="1.1.13.393" />
<PackageReference Include="OWML" Version="2.7.0" />
<Reference Include="../Mirror/*.dll" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion QSB/Animation/NPC/Patches/CharacterAnimationPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static bool AnimatorIKReplacement(
return true;
}

var qsbObj = __instance.playerTrackingZone.GetWorldObject<QSBCharacterTrigger>(); // OPTIMIZE : maybe cache this somewhere... or assess how slow this is
var qsbObj = __instance.playerTrackingZone.GetWorldObject<QSBCharacterTrigger>();

PlayerInfo playerToUse = null;
if (__instance._inConversation)
Expand Down
2 changes: 2 additions & 0 deletions QSB/Animation/Player/AnimationSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace QSB.Animation.Player;

[UsedInUnityProject]
public class AnimationSync : PlayerSyncObject
{
private RuntimeAnimatorController _suitedAnimController;
Expand Down Expand Up @@ -92,6 +93,7 @@ public void InitRemote(Transform body)
SetSuitState(QSBSceneManager.CurrentScene == OWScene.EyeOfTheUniverse);
InitAccelerationSync();
ThrusterManager.CreateRemotePlayerVFX(Player);
ThrusterManager.CreateRemotePlayerSFX(Player);

Delay.RunWhen(() => Player.CameraBody != null,
() => body.GetComponent<PlayerHeadRotationSync>().Init(Player.CameraBody.transform));
Expand Down
9 changes: 9 additions & 0 deletions QSB/Animation/Player/Messages/PlayerSuitMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ public override void OnReceiveRemote()

var animator = player.AnimationSync;
animator.SetSuitState(Data);

if (player.SuitedUp)
{
player.AudioController.PlayWearSuit();
}
else
{
player.AudioController.PlayRemoveSuit();
}
}

public override void OnReceiveLocal()
Expand Down
1 change: 1 addition & 0 deletions QSB/Animation/Player/PlayerHeadRotationSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace QSB.Animation.Player;

[UsedInUnityProject]
public class PlayerHeadRotationSync : MonoBehaviour
{
private Animator _attachedAnimator;
Expand Down
2 changes: 2 additions & 0 deletions QSB/Animation/Player/Thrusters/JetpackAccelerationSync.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using Mirror;
using QSB.Utility;
using QSB.Utility.VariableSync;

namespace QSB.Animation.Player.Thrusters;

[UsedInUnityProject]
public class JetpackAccelerationSync : NetworkBehaviour
{
public Vector3VariableSyncer AccelerationVariableSyncer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using QSB.Player;
using QSB.Utility;
using QSB.WorldSync;
using UnityEngine;

namespace QSB.Animation.Player.Thrusters;

[UsedInUnityProject]
internal class RemoteThrusterFlameController : MonoBehaviour
{
[SerializeField]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace QSB.Animation.Player.Thrusters;

[UsedInUnityProject]
internal class RemoteThrusterParticlesBehaviour : MonoBehaviour
{
[SerializeField]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace QSB.Animation.Player.Thrusters;

[UsedInUnityProject]
internal class RemoteThrusterWashController : MonoBehaviour
{
[SerializeField]
Expand Down
8 changes: 7 additions & 1 deletion QSB/Animation/Player/Thrusters/ThrusterManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using QSB.Player;
using QSB.Audio;
using QSB.Player;
using UnityEngine;

namespace QSB.Animation.Player.Thrusters;
Expand All @@ -14,6 +15,11 @@ public static void CreateRemotePlayerVFX(PlayerInfo player)
InitParticleControllers(newVfx, player);
}

public static void CreateRemotePlayerSFX(PlayerInfo player)
{
player.Body.GetComponentInChildren<QSBJetpackThrusterAudio>(true)?.Init(player);
}

private static void InitFlameControllers(GameObject root, PlayerInfo player)
{
var existingControllers = root.GetComponentsInChildren<RemoteThrusterFlameController>(true);
Expand Down
Binary file modified QSB/AssetBundles/qsb_network
Binary file not shown.
Binary file modified QSB/AssetBundles/qsb_network_big
Binary file not shown.
16 changes: 16 additions & 0 deletions QSB/Audio/Messages/PlayerAudioControllerOneShotMessage.cs
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);
}
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);
}
16 changes: 16 additions & 0 deletions QSB/Audio/Messages/PlayerMovementAudioFootstepMessage.cs
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);
}
16 changes: 16 additions & 0 deletions QSB/Audio/Messages/PlayerMovementAudioJumpMessage.cs
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);
}
21 changes: 21 additions & 0 deletions QSB/Audio/Messages/ShipThrusterAudioOneShotMessage.cs
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);
}

}
64 changes: 64 additions & 0 deletions QSB/Audio/Patches/PlayerAudioControllerPatches.cs
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();
}
}
}
40 changes: 40 additions & 0 deletions QSB/Audio/Patches/PlayerImpactAudioPatches.cs
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();
}
}
}
}
32 changes: 32 additions & 0 deletions QSB/Audio/Patches/PlayerMovementAudioPatches.cs
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();
}
}
Loading

0 comments on commit 948ae13

Please sign in to comment.