mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 05:30:43 -05:00
removed more un-needed patches
This commit is contained in:
parent
c234e0d1d6
commit
e3bc4e3210
@ -1,52 +0,0 @@
|
|||||||
using SPT.Reflection.Patching;
|
|
||||||
using EFT;
|
|
||||||
using System.Reflection;
|
|
||||||
using HarmonyLib;
|
|
||||||
|
|
||||||
namespace SPT.Custom.Patches
|
|
||||||
{
|
|
||||||
public class BotEnemyTargetPatch : ModulePatch
|
|
||||||
{
|
|
||||||
protected override MethodBase GetTargetMethod()
|
|
||||||
{
|
|
||||||
return AccessTools.Method(typeof(BotsController), nameof(BotsController.AddEnemyToAllGroupsInBotZone));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// AddEnemyToAllGroupsInBotZone()
|
|
||||||
/// Goal: by default, AddEnemyToAllGroupsInBotZone doesn't check if the bot group is on the same side as the player.
|
|
||||||
/// The effect of this is that when you are a Scav and kill a Usec, every bot group in the zone will aggro you including other Scavs.
|
|
||||||
/// This should fix that.
|
|
||||||
/// </summary>
|
|
||||||
[PatchPrefix]
|
|
||||||
private static bool PatchPrefix(BotsController __instance, IPlayer aggressor, IPlayer groupOwner, IPlayer target)
|
|
||||||
{
|
|
||||||
BotZone botZone = groupOwner.AIData.BotOwner.BotsGroup.BotZone;
|
|
||||||
foreach (var item in __instance.Groups())
|
|
||||||
{
|
|
||||||
if (item.Key != botZone)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var group in item.Value.GetGroups(notNull: true))
|
|
||||||
{
|
|
||||||
if (!group.Enemies.ContainsKey(aggressor) && ShouldAttack(aggressor, target, group))
|
|
||||||
{
|
|
||||||
group.AddEnemy(aggressor, EBotEnemyCause.AddEnemyToAllGroupsInBotZone);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
private static bool ShouldAttack(IPlayer attacker, IPlayer victim, BotsGroup groupToCheck)
|
|
||||||
{
|
|
||||||
// Group should target if player attack a victim on the same side or if the group is not on the same side as the player.
|
|
||||||
bool shouldAttack = attacker.Side != groupToCheck.Side
|
|
||||||
|| attacker.Side == victim.Side;
|
|
||||||
|
|
||||||
return !groupToCheck.HaveMemberWithRole(WildSpawnType.gifter) && groupToCheck.ShallRevengeFor(victim) && shouldAttack;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
using SPT.Reflection.Patching;
|
|
||||||
using EFT;
|
|
||||||
using System.Reflection;
|
|
||||||
using HarmonyLib;
|
|
||||||
|
|
||||||
namespace SPT.Custom.Patches
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Goal: patch removes the current bot from its own enemy list - occurs when adding bots type to its enemy array in difficulty settings
|
|
||||||
/// </summary>
|
|
||||||
public class BotSelfEnemyPatch : ModulePatch
|
|
||||||
{
|
|
||||||
protected override MethodBase GetTargetMethod()
|
|
||||||
{
|
|
||||||
return AccessTools.Method(typeof(BotOwner), nameof(BotOwner.PreActivate));
|
|
||||||
}
|
|
||||||
|
|
||||||
[PatchPrefix]
|
|
||||||
private static bool PatchPrefix(BotOwner __instance, BotsGroup group)
|
|
||||||
{
|
|
||||||
IPlayer selfToRemove = null;
|
|
||||||
|
|
||||||
foreach (var enemy in group.Enemies)
|
|
||||||
{
|
|
||||||
if (enemy.Key.Id == __instance.Id)
|
|
||||||
{
|
|
||||||
selfToRemove = enemy.Key;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selfToRemove != null)
|
|
||||||
{
|
|
||||||
group.Enemies.Remove(selfToRemove);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
using SPT.Reflection.Patching;
|
|
||||||
using System.Reflection;
|
|
||||||
using HarmonyLib;
|
|
||||||
|
|
||||||
namespace SPT.Custom.Patches
|
|
||||||
{
|
|
||||||
public class BotsGroupLetBossesShootPmcsPatch : ModulePatch
|
|
||||||
{
|
|
||||||
protected override MethodBase GetTargetMethod()
|
|
||||||
{
|
|
||||||
return AccessTools.Method(typeof(BotsGroup), nameof(BotsGroup.CheckAndAddEnemy));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// CheckAndAddEnemy()
|
|
||||||
/// Goal: This patch lets bosses shoot back once a PMC has shot them
|
|
||||||
/// Force method to always run the code
|
|
||||||
/// </summary>
|
|
||||||
[PatchPrefix]
|
|
||||||
private static bool PatchPrefix(ref bool ignoreAI)
|
|
||||||
{
|
|
||||||
// original
|
|
||||||
// return player.HealthController.IsAlive && (!player.AIData.IsAI || ignoreAI) && !this.Enemies.ContainsKey(player) && this.AddEnemy(player, EBotEnemyCause.checkAddTODO);
|
|
||||||
ignoreAI = true;
|
|
||||||
|
|
||||||
|
|
||||||
return true; // Do Original
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,68 +0,0 @@
|
|||||||
using SPT.Reflection.Patching;
|
|
||||||
using SPT.Reflection.Utils;
|
|
||||||
using EFT;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using Comfort.Common;
|
|
||||||
using System;
|
|
||||||
using static LocationSettingsClass;
|
|
||||||
|
|
||||||
namespace SPT.Custom.Patches
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Local games do not set the locationId property like a network game does, `LocationId` is used by various bsg systems
|
|
||||||
/// e.g. btr/lightkeeper services
|
|
||||||
/// </summary>
|
|
||||||
public class SetLocationIdOnRaidStartPatch : ModulePatch
|
|
||||||
{
|
|
||||||
private static PropertyInfo _locationProperty;
|
|
||||||
|
|
||||||
protected override MethodBase GetTargetMethod()
|
|
||||||
{
|
|
||||||
Type localGameBaseType = PatchConstants.LocalGameType.BaseType;
|
|
||||||
|
|
||||||
// At this point, gameWorld.MainPlayer isn't set, so we need to use the LocalGame's `Location_0` property
|
|
||||||
_locationProperty = localGameBaseType.GetProperties(PatchConstants.PublicDeclaredFlags)
|
|
||||||
.SingleCustom(x => x.PropertyType == typeof(Location));
|
|
||||||
|
|
||||||
// Find the TimeAndWeatherSettings handling method
|
|
||||||
var desiredMethod = localGameBaseType.GetMethods(PatchConstants.PublicDeclaredFlags).SingleOrDefault(IsTargetMethod);
|
|
||||||
|
|
||||||
Logger.LogDebug($"{GetType().Name} Type: {localGameBaseType?.Name}");
|
|
||||||
Logger.LogDebug($"{GetType().Name} Method: {desiredMethod?.Name}");
|
|
||||||
|
|
||||||
return desiredMethod;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool IsTargetMethod(MethodInfo mi)
|
|
||||||
{
|
|
||||||
// Find method_3(TimeAndWeatherSettings timeAndWeather)
|
|
||||||
var parameters = mi.GetParameters();
|
|
||||||
return (parameters.Length == 1 && parameters[0].ParameterType == typeof(TimeAndWeatherSettings));
|
|
||||||
}
|
|
||||||
|
|
||||||
[PatchPostfix]
|
|
||||||
private static void PatchPostfix(AbstractGame __instance)
|
|
||||||
{
|
|
||||||
var gameWorld = Singleton<GameWorld>.Instance;
|
|
||||||
|
|
||||||
// EFT.HideoutGame is an internal class, so we can't do static type checking :(
|
|
||||||
if (__instance.GetType().Name.Contains("HideoutGame"))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Location location = _locationProperty.GetValue(__instance) as Location;
|
|
||||||
|
|
||||||
if (location == null)
|
|
||||||
{
|
|
||||||
Logger.LogError($"[SetLocationId] Failed to get location data");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gameWorld.LocationId = location.Id;
|
|
||||||
|
|
||||||
Logger.LogDebug($"[SetLocationId] Set locationId to: {location.Id}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -22,25 +22,20 @@ namespace SPT.Custom
|
|||||||
new EasyBundlePatch().Enable();
|
new EasyBundlePatch().Enable();
|
||||||
|
|
||||||
// TODO: check if these patches are needed
|
// TODO: check if these patches are needed
|
||||||
// new BotsGroupLetBossesShootPmcsPatch().Enable();
|
|
||||||
new CustomAiPatch().Enable();
|
|
||||||
new AddTraitorScavsPatch().Enable();
|
|
||||||
new PmcTakesAgesToHealLimbsPatch().Enable();
|
new PmcTakesAgesToHealLimbsPatch().Enable();
|
||||||
new SendFleaListingTaxAmountToServerPatch().Enable();
|
|
||||||
new DisableNonHalloweenExitsDuringEventPatch().Enable();
|
new DisableNonHalloweenExitsDuringEventPatch().Enable();
|
||||||
// new SetLocationIdOnRaidStartPatch().Enable();
|
|
||||||
// new AllScavsHostileHostileToPlayerScavPatch().Enable();
|
// new AllScavsHostileHostileToPlayerScavPatch().Enable();
|
||||||
// new CopyPmcQuestsToPlayerScavPatch().Enable();
|
// new CopyPmcQuestsToPlayerScavPatch().Enable();
|
||||||
// new MergeScavPmcQuestsOnInventoryLoadPatch().Enable();
|
// new MergeScavPmcQuestsOnInventoryLoadPatch().Enable();
|
||||||
|
|
||||||
// Needed but needs editing
|
|
||||||
new IsEnemyPatch().Enable();
|
|
||||||
|
|
||||||
// Still need
|
// Still need
|
||||||
|
new SendFleaListingTaxAmountToServerPatch().Enable();
|
||||||
|
new AddTraitorScavsPatch().Enable();
|
||||||
|
new IsEnemyPatch().Enable(); // Might be able to refactor
|
||||||
|
new CustomAiPatch().Enable();
|
||||||
new SaveSettingsToSptFolderPatch().Enable();
|
new SaveSettingsToSptFolderPatch().Enable();
|
||||||
new QTEPatch().Enable();
|
new QTEPatch().Enable();
|
||||||
new RedirectClientImageRequestsPatch().Enable();
|
new RedirectClientImageRequestsPatch().Enable();
|
||||||
new BotSelfEnemyPatch().Enable();
|
|
||||||
new DisableGameModeAdjustButtonPatch().Enable();
|
new DisableGameModeAdjustButtonPatch().Enable();
|
||||||
new FixPmcSpawnParamsNullErrorPatch().Enable();
|
new FixPmcSpawnParamsNullErrorPatch().Enable();
|
||||||
new SetPreRaidSettingsScreenDefaultsPatch().Enable();
|
new SetPreRaidSettingsScreenDefaultsPatch().Enable();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user