0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:50:43 -05:00

69 lines
2.7 KiB
C#
Raw Normal View History

2023-12-30 15:27:30 +00:00
using System.Reflection;
using Aki.Reflection.Patching;
using Comfort.Common;
using EFT;
using EFT.UI;
namespace Aki.Debugging.Patches
{
public class BtrTestPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return typeof(GameWorld).GetMethod(nameof(GameWorld.OnGameStarted));
}
[PatchPostfix]
public static void PatchPostfix()
{
try
{
var gameWorld = Singleton<GameWorld>.Instance;
if (gameWorld.MainPlayer.Location.ToLower() != "tarkovstreets")
{
// only run patch on streets
return;
}
var botGame = Singleton<IBotGame>.Instance;
if (gameWorld.BtrController == null)
{
if (!Singleton<GClass2911>.Instantiated)
{
Singleton<GClass2911>.Create(new GClass2911());
}
gameWorld.BtrController = Singleton<GClass2911>.Instance;
ConsoleScreen.LogWarning($"[AKI-BTR] BtrController instance is null: {gameWorld.BtrController == null}");
ConsoleScreen.LogWarning($"[AKI-BTR] Singleton GClass2911 is null: {Singleton<GClass2911>.Instance == null}");
ConsoleScreen.LogWarning($"[AKI-BTR] BtrController.BotShooterBtr instance is null: {gameWorld.BtrController?.BotShooterBtr == null}");
ConsoleScreen.LogWarning($"[AKI-BTR] BtrController.BtrVehicle instance is null: {gameWorld.BtrController?.BtrVehicle == null}");
}
ConsoleScreen.LogWarning($"[AKI-BTR] botspawner is enabled: {botGame.BotsController.IsEnable}");
ConsoleScreen.LogWarning("[AKI-BTR] Post patch, spawning btr");
botGame.BotsController.BotSpawner.SpawnBotBTR();
2023-12-30 15:27:30 +00:00
ConsoleScreen.LogWarning($"[AKI-BTR] btr vehicle is null: {gameWorld.BtrController?.BtrVehicle == null}");
ConsoleScreen.LogWarning($"[AKI-BTR] btr vehicle gameobject is null: {gameWorld.BtrController?.BtrVehicle?.gameObject == null}");
ConsoleScreen.LogWarning($"[AKI-BTR] BtrController.BotShooterBtr instance is null: {gameWorld.BtrController?.BotShooterBtr == null}");
2023-12-30 15:27:30 +00:00
var btrTransform = gameWorld.BtrController?.BtrVehicle?.gameObject?.transform;
if (btrTransform != null)
2023-12-30 15:27:30 +00:00
{
ConsoleScreen.LogWarning($"[AKI-BTR] Btr Location {btrTransform}");
} else
{
ConsoleScreen.LogWarning($"[AKI-BTR] wasnt able to get BTR location");
2023-12-30 15:27:30 +00:00
}
}
catch (System.Exception)
{
ConsoleScreen.LogError("[AKI-BTR] Exception thrown, check logs");
2023-12-30 15:27:30 +00:00
throw;
}
}
}
}