mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 09:50:43 -05:00
Todo: * BTR Driver services * Send to items to player stash (2x4) * Provide covering fire * Taxi to a specific location on Streets * BTR turns hostile if you shoot it * BTR automatically follows a set path from raid start, stopping at locations for 90 seconds each stop Co-authored-by: Nympfonic <arys.steam@gmail.com> Reviewed-on: SPT-AKI/Modules#51 Co-authored-by: Arys <arys@noreply.dev.sp-tarkov.com> Co-committed-by: Arys <arys@noreply.dev.sp-tarkov.com>
45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using Aki.Reflection.Patching;
|
|
using Comfort.Common;
|
|
using EFT;
|
|
using EFT.Vehicle;
|
|
using HarmonyLib;
|
|
using System.Reflection;
|
|
|
|
namespace Aki.Debugging.BTR.Patches
|
|
{
|
|
public class BTRIsDoorsClosedPath : ModulePatch
|
|
{
|
|
protected override MethodBase GetTargetMethod()
|
|
{
|
|
return AccessTools.Method(typeof(VehicleBase), "IsDoorsClosed");
|
|
}
|
|
|
|
[PatchPrefix]
|
|
public static bool PatchPrefix(ref bool __result)
|
|
{
|
|
var btrView = Singleton<GameWorld>.Instance?.BtrController?.BtrView;
|
|
if (btrView == null)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
var btrSides = (BTRSide[])AccessTools.Field(typeof(BTRView), "_btrSides").GetValue(btrView);
|
|
int doorsClosed = 0;
|
|
foreach (var side in btrSides)
|
|
{
|
|
if (side.State == BTRSide.EState.Free)
|
|
{
|
|
doorsClosed++;
|
|
}
|
|
}
|
|
if (doorsClosed == btrSides.Length)
|
|
{
|
|
__result = true;
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|