mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 02:30:44 -05:00
Fixed bosses not spawning when player chooses medium
ai amount on pre-raid screen
This commit is contained in:
parent
d8c0abfe04
commit
148c45666a
@ -0,0 +1,50 @@
|
|||||||
|
using SPT.Reflection.Patching;
|
||||||
|
using System.Reflection;
|
||||||
|
using EFT;
|
||||||
|
using EFT.Bots;
|
||||||
|
using HarmonyLib;
|
||||||
|
|
||||||
|
namespace SPT.Custom.Patches
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Fix bosses not spawning with any followers because BSG subtract the escort amount from itself
|
||||||
|
/// </summary>
|
||||||
|
public class FixBossesHavingNoFollowersOnMediumAiAmount: ModulePatch
|
||||||
|
{
|
||||||
|
protected override MethodBase GetTargetMethod()
|
||||||
|
{
|
||||||
|
return AccessTools.Method(typeof(LocalGame), nameof(LocalGame.smethod_8));
|
||||||
|
}
|
||||||
|
|
||||||
|
[PatchPrefix]
|
||||||
|
public static void PatchPrefix(LocalGame __instance, WavesSettings wavesSettings, ref BossLocationSpawn[] bossLocationSpawn)
|
||||||
|
{
|
||||||
|
// Not a boss and set to medium, skip
|
||||||
|
if (wavesSettings is not { IsBosses: true, BotAmount: EBotAmount.Medium })
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var locationSpawn in bossLocationSpawn)
|
||||||
|
{
|
||||||
|
// Only adjust bosses with single escort amount value, skip others
|
||||||
|
if (locationSpawn.BossEscortAmount.Length != 1)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only add new value when existing value is > 0
|
||||||
|
var existingAmount = int.Parse(locationSpawn.BossEscortAmount);
|
||||||
|
if (existingAmount == 0)
|
||||||
|
{
|
||||||
|
// Don't add more data to boss with 0 followers
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add second value to property, when client does (max - min / 2), it won't be 0
|
||||||
|
// e.g. reshala has value of "4", we add value "(existing)*3 (=12)", which means the client does "(12 - 4) / 2" giving us 4 escorts - same as high/as online ai amount
|
||||||
|
locationSpawn.BossEscortAmount += $",{existingAmount * 3}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -38,6 +38,7 @@ namespace SPT.Custom
|
|||||||
new FixScavWarNullErrorWithMarkOfUnknownPatch().Enable();
|
new FixScavWarNullErrorWithMarkOfUnknownPatch().Enable();
|
||||||
new MergeScavPmcQuestsOnInventoryLoadPatch().Enable();
|
new MergeScavPmcQuestsOnInventoryLoadPatch().Enable();
|
||||||
new CopyPmcQuestsToPlayerScavPatch().Enable();
|
new CopyPmcQuestsToPlayerScavPatch().Enable();
|
||||||
|
new FixBossesHavingNoFollowersOnMediumAiAmount().Enable();
|
||||||
//new AllowAirdropsInPvEPatch().Enable();
|
//new AllowAirdropsInPvEPatch().Enable();
|
||||||
|
|
||||||
HookObject.AddOrGetComponent<MenuNotificationManager>();
|
HookObject.AddOrGetComponent<MenuNotificationManager>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user