mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 01:10:45 -05:00
Add FixAirdropCrashPatch (!175)
This fixes the current issue of having an airdrop in the game causing a CTD after an extract. There's still two caveats to this that I'm looking into: - On the very next raid, the sky will still have the chaff from the flares in the sky, however these will have pink textures and take a few seconds to dissipate. - On the very next raid, calling in an airplane with a red flare will cause the notification manager to spam messages about the airspace being currently in use even at the start of the raid. Reviewed-on: SPT/Modules#175 Co-authored-by: Archangel <jesse@archangel.wtf> Co-committed-by: Archangel <jesse@archangel.wtf>
This commit is contained in:
parent
16b9247c26
commit
5a58e03854
42
project/SPT.Custom/Patches/FixAirdropCrashPatch.cs
Normal file
42
project/SPT.Custom/Patches/FixAirdropCrashPatch.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using EFT.SynchronizableObjects;
|
||||||
|
using EFT;
|
||||||
|
using HarmonyLib;
|
||||||
|
using SPT.Reflection.Patching;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
using Comfort.Common;
|
||||||
|
|
||||||
|
namespace SPT.Custom.Patches
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This patch prevents the crashing that was caused by the airdrop since the mortar event, it fully unloads whatever synchronized objects
|
||||||
|
/// Are still loaded before unused resources are cleaned up (Which causes this crash)
|
||||||
|
/// </summary>
|
||||||
|
public class FixAirdropCrashPatch : ModulePatch
|
||||||
|
{
|
||||||
|
protected override MethodBase GetTargetMethod()
|
||||||
|
{
|
||||||
|
return typeof(TarkovApplication).GetMethod(nameof(TarkovApplication.method_48));
|
||||||
|
}
|
||||||
|
|
||||||
|
[PatchPrefix]
|
||||||
|
public static void Prefix()
|
||||||
|
{
|
||||||
|
if (Singleton<GameWorld>.Instantiated)
|
||||||
|
{
|
||||||
|
GameWorld gameWorld = Singleton<GameWorld>.Instance;
|
||||||
|
|
||||||
|
List<SynchronizableObject> synchronizableObjectList = Traverse.Create(gameWorld.SynchronizableObjectLogicProcessor).Field<List<SynchronizableObject>>("list_0").Value;
|
||||||
|
|
||||||
|
foreach (SynchronizableObject obj in synchronizableObjectList)
|
||||||
|
{
|
||||||
|
obj.Logic.ReturnToPool();
|
||||||
|
obj.ReturnToPool();
|
||||||
|
}
|
||||||
|
|
||||||
|
gameWorld.SynchronizableObjectLogicProcessor.Dispose();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -40,6 +40,7 @@ namespace SPT.Custom
|
|||||||
new MergeScavPmcQuestsOnInventoryLoadPatch().Enable();
|
new MergeScavPmcQuestsOnInventoryLoadPatch().Enable();
|
||||||
new CopyPmcQuestsToPlayerScavPatch().Enable();
|
new CopyPmcQuestsToPlayerScavPatch().Enable();
|
||||||
new FixBossesHavingNoFollowersOnMediumAiAmount().Enable();
|
new FixBossesHavingNoFollowersOnMediumAiAmount().Enable();
|
||||||
|
new FixAirdropCrashPatch().Enable();
|
||||||
//new AllowAirdropsInPvEPatch().Enable();
|
//new AllowAirdropsInPvEPatch().Enable();
|
||||||
|
|
||||||
HookObject.AddOrGetComponent<MenuNotificationManager>();
|
HookObject.AddOrGetComponent<MenuNotificationManager>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user