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>
50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
using Aki.Reflection.Patching;
|
|
using Comfort.Common;
|
|
using EFT;
|
|
using EFT.Vehicle;
|
|
using System;
|
|
using System.Reflection;
|
|
|
|
namespace Aki.Debugging.BTR.Patches
|
|
{
|
|
public class BTRInteractionPatch : ModulePatch
|
|
{
|
|
protected override MethodBase GetTargetMethod()
|
|
{
|
|
var bindingFlags = BindingFlags.NonPublic | BindingFlags.Instance;
|
|
return typeof(Player).GetMethod("BtrInteraction", bindingFlags);
|
|
}
|
|
|
|
[PatchPostfix]
|
|
public static void PatchPostfix(object __instance, BTRSide btr, byte placeId, EInteractionType interaction)
|
|
{
|
|
var gameWorld = Singleton<GameWorld>.Instance;
|
|
var player = (Player)__instance;
|
|
|
|
try
|
|
{
|
|
var interactionBtrPacket = btr.GetInteractWithBtrPacket(placeId, interaction);
|
|
player.UpdateInteractionCast();
|
|
|
|
if (interactionBtrPacket.HasInteraction)
|
|
{
|
|
BTRView btrView = gameWorld.BtrController.BtrView;
|
|
if (btrView == null)
|
|
{
|
|
throw new NullReferenceException("BtrView not found");
|
|
}
|
|
|
|
var btrManager = gameWorld.GetComponent<BTRManager>();
|
|
btrManager.OnPlayerInteractDoor(interactionBtrPacket);
|
|
|
|
btrView.Interaction(player, interactionBtrPacket);
|
|
}
|
|
}
|
|
catch (Exception ex19)
|
|
{
|
|
UnityEngine.Debug.LogException(ex19);
|
|
}
|
|
}
|
|
}
|
|
}
|