0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:50:43 -05:00
modules/project/Aki.Debugging/BTR/Patches/BTRIsDoorsClosedPatch.cs

35 lines
877 B
C#
Raw Normal View History

using Aki.Reflection.Patching;
using Comfort.Common;
using EFT;
using HarmonyLib;
using System.Reflection;
namespace Aki.Debugging.BTR.Patches
{
public class BTRIsDoorsClosedPath : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(VehicleBase), nameof(VehicleBase.IsDoorsClosed));
}
[PatchPrefix]
public static bool PatchPrefix(ref bool __result)
{
var serverSideBTR = Singleton<GameWorld>.Instance?.BtrController.BtrVehicle;
if (serverSideBTR == null)
{
return true;
}
if (serverSideBTR.LeftSideState == 0 && serverSideBTR.RightSideState == 0)
{
__result = true;
return false;
}
return true;
}
}
}