mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 06:10:45 -05:00
Removed unnecessary patch BotCallForHelpCallBotPatch
Removed unnecessary null check
This commit is contained in:
parent
de7e762211
commit
42060f027d
@ -1,54 +0,0 @@
|
|||||||
using SPT.Reflection.Patching;
|
|
||||||
using EFT;
|
|
||||||
using HarmonyLib;
|
|
||||||
using System.Reflection;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace SPT.Custom.Patches
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* BSG passes the wrong target location into the TryCall method for BotCallForHelp, it's passing in
|
|
||||||
* the bots current target instead of the target of the bot calling for help
|
|
||||||
*
|
|
||||||
* This results in both an NRE, and the called bots target location being wrong
|
|
||||||
*/
|
|
||||||
public class BotCallForHelpCallBotPatch : ModulePatch
|
|
||||||
{
|
|
||||||
private static FieldInfo _originalPanicTypeField;
|
|
||||||
|
|
||||||
protected override MethodBase GetTargetMethod()
|
|
||||||
{
|
|
||||||
_originalPanicTypeField = AccessTools.Field(typeof(BotCallForHelp), "_originalPanicType");
|
|
||||||
|
|
||||||
return AccessTools.FirstMethod(typeof(BotCallForHelp), IsTargetMethod);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected bool IsTargetMethod(MethodBase method)
|
|
||||||
{
|
|
||||||
var parameters = method.GetParameters();
|
|
||||||
return (parameters.Length == 1
|
|
||||||
&& parameters[0].Name == "calledBot");
|
|
||||||
}
|
|
||||||
|
|
||||||
[PatchPrefix]
|
|
||||||
private static bool PatchPrefix(ref bool __result, BotCallForHelp __instance, BotOwner calledBot, BotOwner ___botOwner_0)
|
|
||||||
{
|
|
||||||
if (__instance.method_2(calledBot) && ___botOwner_0.Memory.GoalEnemy != null)
|
|
||||||
{
|
|
||||||
_originalPanicTypeField.SetValue(calledBot.CallForHelp, calledBot.DangerPointsData.PanicType);
|
|
||||||
calledBot.DangerPointsData.PanicType = PanicType.none;
|
|
||||||
calledBot.Brain.BaseBrain.CalcActionNextFrame();
|
|
||||||
// Note: This differs from BSG's implementation in that we pass in botOwner_0's enemy pos instead of calledBot's enemy pos
|
|
||||||
calledBot.CalledData.TryCall(new Vector3?(___botOwner_0.Memory.GoalEnemy.Person.Position), ___botOwner_0, true);
|
|
||||||
__result = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
__result = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skip original
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -41,12 +41,6 @@ namespace SPT.Custom.Patches
|
|||||||
}
|
}
|
||||||
|
|
||||||
var isEnemy = false; // default not an enemy
|
var isEnemy = false; // default not an enemy
|
||||||
if (requester == null)
|
|
||||||
{
|
|
||||||
__result = isEnemy;
|
|
||||||
|
|
||||||
return false; // Skip original
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check existing enemies list
|
// Check existing enemies list
|
||||||
// Could also check x.Value.Player?.Id - BSG do it this way
|
// Could also check x.Value.Player?.Id - BSG do it this way
|
||||||
|
@ -35,7 +35,6 @@ namespace SPT.Custom
|
|||||||
new VersionLabelPatch().Enable();
|
new VersionLabelPatch().Enable();
|
||||||
new IsEnemyPatch().Enable();
|
new IsEnemyPatch().Enable();
|
||||||
new BotCalledDataTryCallPatch().Enable();
|
new BotCalledDataTryCallPatch().Enable();
|
||||||
new BotCallForHelpCallBotPatch().Enable();
|
|
||||||
new BotOwnerDisposePatch().Enable();
|
new BotOwnerDisposePatch().Enable();
|
||||||
new LocationLootCacheBustingPatch().Enable();
|
new LocationLootCacheBustingPatch().Enable();
|
||||||
//new AddSelfAsEnemyPatch().Enable();
|
//new AddSelfAsEnemyPatch().Enable();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user