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

New patch - Resolve issue with PMCs not removing bleeds causing them to slowly bleed to death.

This is due to different medkit classes being used depending on what wildspawntype is used

Patch removes all negative effects from all body parts when PMC heals
This commit is contained in:
Dev 2023-07-27 21:00:26 +01:00
parent 95639b9d03
commit 3aec22097b
2 changed files with 40 additions and 0 deletions

View File

@ -41,6 +41,7 @@ namespace Aki.Custom
new CustomAiPatch().Enable();
new ExitWhileLootingPatch().Enable();
new QTEPatch().Enable();
new PmcFirstAidPatch().Enable();
}
catch (Exception ex)
{

View File

@ -0,0 +1,39 @@
using Aki.Reflection.Patching;
using EFT;
using System.Reflection;
namespace Aki.Custom.Patches
{
/// <summary>
/// SPT PMC enum value is high enough in wildspawntype it means the first aid class that gets init doesnt have an implementation
/// On heal event, remove all negative effects from limbs e.g. light/heavy bleeds
/// </summary>
public class PmcFirstAidPatch : ModulePatch
{
private static readonly string methodName = "FirstAidApplied";
protected override MethodBase GetTargetMethod()
{
return typeof(GClass397).GetMethod(methodName);
}
[PatchPrefix]
private static bool PatchPrefix(BotOwner ___botOwner_0)
{
if (___botOwner_0.IsRole((WildSpawnType)33) || ___botOwner_0.IsRole((WildSpawnType)34))
{
var healthController = ___botOwner_0.GetPlayer.ActiveHealthController;
healthController.RemoveNegativeEffects(EBodyPart.Head);
healthController.RemoveNegativeEffects(EBodyPart.Chest);
healthController.RemoveNegativeEffects(EBodyPart.Stomach);
healthController.RemoveNegativeEffects(EBodyPart.LeftLeg);
healthController.RemoveNegativeEffects(EBodyPart.RightLeg);
healthController.RemoveNegativeEffects(EBodyPart.LeftArm);
healthController.RemoveNegativeEffects(EBodyPart.RightArm);
}
return false; // skip original
}
}
}