2024-05-21 19:10:17 +01:00
|
|
|
|
using SPT.Reflection.Patching;
|
2024-01-26 08:28:29 +00:00
|
|
|
|
using Comfort.Common;
|
|
|
|
|
using EFT;
|
|
|
|
|
using HarmonyLib;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using Object = UnityEngine.Object;
|
|
|
|
|
|
2024-05-21 19:10:17 +01:00
|
|
|
|
namespace SPT.Custom.BTR.Patches
|
2024-01-26 08:28:29 +00:00
|
|
|
|
{
|
2024-01-27 09:05:33 +00:00
|
|
|
|
public class BTRDestroyAtRaidEndPatch : ModulePatch
|
2024-01-26 08:28:29 +00:00
|
|
|
|
{
|
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
|
{
|
2024-04-03 15:38:14 +01:00
|
|
|
|
return AccessTools.Method(typeof(BaseLocalGame<EftGamePlayerOwner>), nameof(BaseLocalGame<EftGamePlayerOwner>.Stop));
|
2024-01-26 08:28:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[PatchPrefix]
|
|
|
|
|
private static void PatchPrefix()
|
|
|
|
|
{
|
|
|
|
|
var gameWorld = Singleton<GameWorld>.Instance;
|
|
|
|
|
if (gameWorld == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var btrManager = gameWorld.GetComponent<BTRManager>();
|
|
|
|
|
if (btrManager != null)
|
|
|
|
|
{
|
2024-05-20 13:51:52 +01:00
|
|
|
|
Logger.LogWarning("[SPT-BTR] BTRDestroyAtRaidEndPatch - Raid Ended: Destroying BTRManager");
|
2024-01-26 08:28:29 +00:00
|
|
|
|
Object.Destroy(btrManager);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|