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

Fixed scav raid patch + bosses spawning when unchecked

This commit is contained in:
Dev 2024-09-13 18:17:13 +01:00
parent e92504ff5b
commit 53412fbdc4

View File

@ -8,8 +8,8 @@ namespace SPT.SinglePlayer.Patches.ScavMode
public class EnablePlayerScavPatch : ModulePatch public class EnablePlayerScavPatch : ModulePatch
{ {
/// <summary> /// <summary>
/// Modifies raid settings to retain raidsettings options in menu and allows scav to load into raid /// Fixes player loading into a 'practice' raid instead of a 'local' raid
/// All these settings might not be needed but this allows pmc and scavs to load in as needed. /// Also fixes player not loading into raid as a scav
/// </summary> /// </summary>
protected override MethodBase GetTargetMethod() protected override MethodBase GetTargetMethod()
{ {
@ -19,18 +19,36 @@ namespace SPT.SinglePlayer.Patches.ScavMode
[PatchPrefix] [PatchPrefix]
public static void PatchPrefix(ref RaidSettings ___raidSettings_0, ref RaidSettings ___raidSettings_1, MainMenuController __instance) public static void PatchPrefix(ref RaidSettings ___raidSettings_0, ref RaidSettings ___raidSettings_1, MainMenuController __instance)
{ {
if (___raidSettings_0.Side == ESideType.Pmc)
{
// Client does some 'online' work before realising it should be pve
___raidSettings_0.RaidMode = ERaidMode.Online; // Sets ___raidSettings_0.Local to true
}
else
{
// Needed for scav runs
___raidSettings_0.RaidMode = ERaidMode.Local; ___raidSettings_0.RaidMode = ERaidMode.Local;
___raidSettings_0.IsPveOffline = true; }
// Copy values from 'good' location to raidsettings_0 to ensure the rest of raid start process uses them
___raidSettings_0.WavesSettings = ___raidSettings_1.WavesSettings; ___raidSettings_0.WavesSettings = ___raidSettings_1.WavesSettings;
___raidSettings_0.BotSettings = ___raidSettings_1.BotSettings; ___raidSettings_0.BotSettings = ___raidSettings_1.BotSettings;
___raidSettings_1.Apply(___raidSettings_0);
// Update backup to have same values as primary
___raidSettings_1 = ___raidSettings_0.Clone();
} }
[PatchPostfix] [PatchPostfix]
public static void PatchPostfix(ref RaidSettings ___raidSettings_0) public static void PatchPostfix(ref RaidSettings ___raidSettings_0)
{ {
___raidSettings_0.RaidMode = ERaidMode.Local; // This ensures scav raids show as 'local' instead of 'training', works in conjunction with prefix patches' "RaidMode = local" line
___raidSettings_0.IsPveOffline = true; ___raidSettings_0.IsPveOffline = true;
// Bosses are never removed from pve raids, this forces the boss array to empty itself if the 'enable bosses' flag is unchecked
if (!___raidSettings_0.WavesSettings.IsBosses)
{
___raidSettings_0.SelectedLocation.BossLocationSpawn = [];
}
} }
} }
} }