From 3aec22097bfa5629e5f0dbfc49da9538552fff74 Mon Sep 17 00:00:00 2001 From: Dev Date: Thu, 27 Jul 2023 21:00:26 +0100 Subject: [PATCH] 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 --- project/Aki.Custom/AkiCustomPlugin.cs | 1 + .../Aki.Custom/Patches/PmcFirstAidPatch.cs | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 project/Aki.Custom/Patches/PmcFirstAidPatch.cs diff --git a/project/Aki.Custom/AkiCustomPlugin.cs b/project/Aki.Custom/AkiCustomPlugin.cs index d3fa849..20d01a4 100644 --- a/project/Aki.Custom/AkiCustomPlugin.cs +++ b/project/Aki.Custom/AkiCustomPlugin.cs @@ -41,6 +41,7 @@ namespace Aki.Custom new CustomAiPatch().Enable(); new ExitWhileLootingPatch().Enable(); new QTEPatch().Enable(); + new PmcFirstAidPatch().Enable(); } catch (Exception ex) { diff --git a/project/Aki.Custom/Patches/PmcFirstAidPatch.cs b/project/Aki.Custom/Patches/PmcFirstAidPatch.cs new file mode 100644 index 0000000..5ebe26f --- /dev/null +++ b/project/Aki.Custom/Patches/PmcFirstAidPatch.cs @@ -0,0 +1,39 @@ +using Aki.Reflection.Patching; +using EFT; +using System.Reflection; + +namespace Aki.Custom.Patches +{ + /// + /// 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 + /// + 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 + } + } +}