2024-01-04 08:51:06 +00:00
|
|
|
|
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()
|
|
|
|
|
{
|
2024-01-14 09:05:13 +00:00
|
|
|
|
return AccessTools.Method(typeof(VehicleBase), nameof(VehicleBase.IsDoorsClosed));
|
2024-01-04 08:51:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[PatchPrefix]
|
|
|
|
|
public static bool PatchPrefix(ref bool __result)
|
|
|
|
|
{
|
2024-01-05 08:58:15 +00:00
|
|
|
|
var serverSideBTR = Singleton<GameWorld>.Instance?.BtrController.BtrVehicle;
|
|
|
|
|
if (serverSideBTR == null)
|
2024-01-04 08:51:06 +00:00
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-05 08:58:15 +00:00
|
|
|
|
if (serverSideBTR.LeftSideState == 0 && serverSideBTR.RightSideState == 0)
|
2024-01-04 08:51:06 +00:00
|
|
|
|
{
|
|
|
|
|
__result = true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|