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

Add FixLocalRaidPatch (!167)

This patch ensures that the game mode is _always_ Local and PvE if the player skips the raid settings window. This way an online `GameWorld` will not be incorrectly instantiated.
**NOTE**: This might make EnablePlayerScavPatch redundant or at least parts of it.

Co-authored-by: Lacyway <20912169+Lacyway@users.noreply.github.com>
Reviewed-on: SPT/Modules#167
Co-authored-by: Lacyway <lacyway@noreply.dev.sp-tarkov.com>
Co-committed-by: Lacyway <lacyway@noreply.dev.sp-tarkov.com>
This commit is contained in:
Lacyway 2024-09-16 18:18:52 +00:00 committed by chomp
parent 4a187bef22
commit 9b57469707
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,26 @@
using EFT;
using HarmonyLib;
using SPT.Reflection.Patching;
using System.Reflection;
namespace SPT.SinglePlayer.Patches.MainMenu
{
/// <summary>
/// This patch ensures that the gamemode is always <see cref="ERaidMode.Local"/> and that IsPveOffline is always true when starting a game<br/>
/// This prevents a bug where the gameworld is instantiated as an online world
/// </summary>
public class FixLocalRaidPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(TarkovApplication), nameof(TarkovApplication.method_41));
}
[PatchPrefix]
public static void Prefix(ref RaidSettings ____raidSettings)
{
____raidSettings.RaidMode = ERaidMode.Local;
____raidSettings.IsPveOffline = true;
}
}
}

View File

@ -59,6 +59,7 @@ namespace SPT.SinglePlayer
//new InsuranceScreenPatch().Enable();
new RemoveStashUpgradeLabelPatch().Enable();
new RemoveClothingItemExternalObtainLabelPatch().Enable();
new FixLocalRaidPatch().Enable();
}
catch (Exception ex)
{