mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 09:50:43 -05:00
By multiplying `moveSpeed` by `Time.deltaTime` in `BTRVehicle.Update()`, it prevents the BTR movement from desyncing, and possibly going faster or slower than expected. Reviewed-on: SPT-AKI/Modules#73 Co-authored-by: Arys <arys@noreply.dev.sp-tarkov.com> Co-committed-by: Arys <arys@noreply.dev.sp-tarkov.com>
23 lines
570 B
C#
23 lines
570 B
C#
using Aki.Reflection.Patching;
|
|
using EFT.Vehicle;
|
|
using HarmonyLib;
|
|
using System.Reflection;
|
|
using UnityEngine;
|
|
|
|
namespace Aki.Custom.BTR.Patches
|
|
{
|
|
public class BTRVehicleMovementSpeedPatch : ModulePatch
|
|
{
|
|
protected override MethodBase GetTargetMethod()
|
|
{
|
|
return AccessTools.Method(typeof(BTRVehicle), nameof(BTRVehicle.Update));
|
|
}
|
|
|
|
[PatchPrefix]
|
|
private static void PatchPrefix(ref float ___float_10, float ___moveSpeed)
|
|
{
|
|
___float_10 = ___moveSpeed * Time.deltaTime;
|
|
}
|
|
}
|
|
}
|