0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:50:43 -05:00
modules/project/SPT.SinglePlayer/Patches/MainMenu/ForceRaidModeToLocalPatch.cs

28 lines
886 B
C#
Raw Normal View History

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
2025-01-06 17:35:35 +00:00
/// One outcome of not having this patch is grenades do not explode after being thrown
/// </summary>
2024-11-17 15:44:18 +00:00
public class ForceRaidModeToLocalPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
2025-01-06 18:22:29 +01:00
return AccessTools.Method(typeof(TarkovApplication), nameof(TarkovApplication.method_39));
}
[PatchPrefix]
2025-01-06 17:35:35 +00:00
public static void Prefix(ref RaidSettings ____raidSettings, bool canEscape)
{
____raidSettings.RaidMode = ERaidMode.Local;
____raidSettings.IsPveOffline = true;
}
}
}