mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 09:50:43 -05:00
Resolve issue with bots spawning well beyond the maxbotcap value
This commit is contained in:
parent
c1ff106a16
commit
9482040d08
@ -50,6 +50,7 @@ namespace Aki.SinglePlayer
|
|||||||
new SmokeGrenadeFuseSoundFixPatch().Enable();
|
new SmokeGrenadeFuseSoundFixPatch().Enable();
|
||||||
new PlayerToggleSoundFixPatch().Enable();
|
new PlayerToggleSoundFixPatch().Enable();
|
||||||
new PluginErrorNotifierPatch().Enable();
|
new PluginErrorNotifierPatch().Enable();
|
||||||
|
new SpawnProcessNegativeValuePatch().Enable();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
using Aki.Common.Http;
|
||||||
|
using Aki.Reflection.Patching;
|
||||||
|
using Aki.Reflection.Utils;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Aki.SinglePlayer.Patches.RaidFix
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Prevent BotSpawnerClass from adjusting the spawn process value to be below 0
|
||||||
|
/// This fixes aiamount = high spawning 80+ bots on maps like streets/customs
|
||||||
|
/// int_0 = all bots alive
|
||||||
|
/// int_1 = followers alive
|
||||||
|
/// int_2 = bosses currently alive
|
||||||
|
/// int_3 = spawn process? - current guess is open spawn positions - bsg doesnt seem to handle negative vaues well
|
||||||
|
/// int_4 = max bots
|
||||||
|
/// </summary>
|
||||||
|
class SpawnProcessNegativeValuePatch : ModulePatch
|
||||||
|
{
|
||||||
|
protected override MethodBase GetTargetMethod()
|
||||||
|
{
|
||||||
|
var desiredType = typeof(BotSpawnerClass);
|
||||||
|
var desiredMethod = desiredType.GetMethod("CheckOnMax", PatchConstants.PublicFlags);
|
||||||
|
|
||||||
|
Logger.LogDebug($"{this.GetType().Name} Type: {desiredType?.Name}");
|
||||||
|
Logger.LogDebug($"{this.GetType().Name} Method: {desiredMethod?.Name}");
|
||||||
|
|
||||||
|
return desiredMethod;
|
||||||
|
}
|
||||||
|
|
||||||
|
[PatchPrefix]
|
||||||
|
private static void PatchPreFix(ref int ___int_3)
|
||||||
|
{
|
||||||
|
// Spawn process
|
||||||
|
if (___int_3 < 0)
|
||||||
|
{
|
||||||
|
___int_3 = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user