2024-01-12 08:54:12 +00:00
|
|
|
|
using Aki.Reflection.Patching;
|
|
|
|
|
using Comfort.Common;
|
|
|
|
|
using EFT;
|
|
|
|
|
using EFT.Vehicle;
|
|
|
|
|
using HarmonyLib;
|
|
|
|
|
using System.Reflection;
|
2024-01-19 08:47:52 +00:00
|
|
|
|
using BotEventHandler = GClass595;
|
2024-01-12 08:54:12 +00:00
|
|
|
|
|
|
|
|
|
namespace Aki.Debugging.BTR.Patches
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Patches an empty method in <see cref="BTRView"/> to handle updating the BTR bot's Neutrals and Enemies lists in response to taking damage.
|
|
|
|
|
/// </summary>
|
2024-01-19 08:47:52 +00:00
|
|
|
|
internal class BTRReceiveDamageInfoPatch : ModulePatch
|
2024-01-12 08:54:12 +00:00
|
|
|
|
{
|
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
|
{
|
2024-01-19 08:47:52 +00:00
|
|
|
|
return AccessTools.Method(typeof(BTRView), nameof(BTRView.method_1));
|
2024-01-12 08:54:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[PatchPrefix]
|
2024-01-19 08:47:52 +00:00
|
|
|
|
private static void PatchPrefix(DamageInfo damageInfo)
|
2024-01-12 08:54:12 +00:00
|
|
|
|
{
|
2024-01-19 08:47:52 +00:00
|
|
|
|
var botEventHandler = Singleton<BotEventHandler>.Instance;
|
|
|
|
|
if (botEventHandler == null)
|
2024-01-12 08:54:12 +00:00
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var shotBy = (Player)damageInfo.Player.iPlayer;
|
2024-01-19 08:47:52 +00:00
|
|
|
|
botEventHandler.InterruptTraderServiceBtrSupportByBetrayer(shotBy);
|
2024-01-12 08:54:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|