From 2ebabeffc9dd311d7cff98c91ae67a776ed2590f Mon Sep 17 00:00:00 2001 From: Kaeno Date: Mon, 5 Feb 2024 06:42:59 +0000 Subject: [PATCH] Made Player invincible while in BTR so Border snipers dont kill you while being protected by the BTR --- project/Aki.Custom/BTR/BTRManager.cs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/project/Aki.Custom/BTR/BTRManager.cs b/project/Aki.Custom/BTR/BTRManager.cs index e0599e0..10ad4cb 100644 --- a/project/Aki.Custom/BTR/BTRManager.cs +++ b/project/Aki.Custom/BTR/BTRManager.cs @@ -51,7 +51,9 @@ namespace Aki.Custom.BTR private MethodInfo _updateTaxiPriceMethod; - BTRManager() + private float originalDamageCoeff; + + BTRManager() { Type btrControllerType = typeof(BTRControllerClass); _updateTaxiPriceMethod = AccessTools.GetDeclaredMethods(btrControllerType).Single(IsUpdateTaxiPriceMethod); @@ -107,7 +109,7 @@ namespace Aki.Custom.BTR } else if (interactPacket.SideId == 1 && playerGoIn) { - if (interactPacket.SlotId == 0) + if (interactPacket.SlotId == 0) { btrServerSide.RightSlot0State = 1; } @@ -116,7 +118,21 @@ namespace Aki.Custom.BTR btrServerSide.RightSlot1State = 1; } } - } + + // If the player is going into the BTR, store their damage coefficient + // and set it to 0, so they don't die while inside the BTR + if (interactPacket.InteractionType == EInteractionType.GoIn) + { + originalDamageCoeff = gameWorld.MainPlayer.ActiveHealthController.DamageCoeff; + gameWorld.MainPlayer.ActiveHealthController.SetDamageCoeff(0f); + + } + // Otherwise restore the damage coefficient + else if (interactPacket.InteractionType == EInteractionType.GoOut) + { + gameWorld.MainPlayer.ActiveHealthController.SetDamageCoeff(originalDamageCoeff); + } + } // Find `BTRControllerClass.method_9(PathDestination currentDestinationPoint, bool lastRoutePoint)` private bool IsUpdateTaxiPriceMethod(MethodInfo method)