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

35 lines
853 B
C#
Raw Normal View History

using Aki.Reflection.Patching;
using Comfort.Common;
using EFT;
using HarmonyLib;
using System.Reflection;
namespace Aki.Custom.BTR.Patches
{
public class BTRSpawnBotAtRaidStartPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(GameWorld), nameof(GameWorld.OnGameStarted));
}
[PatchPostfix]
private static void PatchPostfix(GameWorld __instance)
{
var btrManager = __instance.GetComponent<BTRManager>();
if (btrManager == null)
{
return;
}
var botGame = Singleton<IBotGame>.Instance;
if (botGame == null)
{
return;
}
botGame.BotsController.BotSpawner.SpawnBotBTR();
}
}
}