first commit
This commit is contained in:
25
NitroxPatcher/Patches/Dynamic/Exosuit_GetVelocity_Patch.cs
Normal file
25
NitroxPatcher/Patches/Dynamic/Exosuit_GetVelocity_Patch.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Reflection;
|
||||
using NitroxClient.MonoBehaviours.Vehicles;
|
||||
using NitroxModel.Helper;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NitroxPatcher.Patches.Dynamic;
|
||||
|
||||
/// <summary>
|
||||
/// Gives the real velocity data for <see cref="FootstepSounds"/> to play the right step sounds.
|
||||
/// </summary>
|
||||
public sealed partial class Exosuit_GetVelocity_Patch : NitroxPatch, IDynamicPatch
|
||||
{
|
||||
private static readonly MethodInfo targetMethod = Reflect.Method((Exosuit t) => ((IGroundMoveable)t).GetVelocity());
|
||||
|
||||
public static bool Prefix(Exosuit __instance, ref Vector3 __result)
|
||||
{
|
||||
if (__instance.TryGetComponent(out ExosuitMovementReplicator exosuitMovementReplicator))
|
||||
{
|
||||
__result = exosuitMovementReplicator.velocity;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user