From 612e7f0b1be6e42f7f0e3d0ba6ab5700083e322f Mon Sep 17 00:00:00 2001 From: DanW Date: Thu, 21 Dec 2023 22:29:49 +0000 Subject: [PATCH] Prevent Bots from Running into Airdrop Crates (!46) Adds a `NavMeshObstacle` component to airdrop boxes at the end of `OnBoxLand`. Without this change, bots run into the crates as if they aren't there (because they're dumb). Co-authored-by: dwesterwick Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Modules/pulls/46 Co-authored-by: DanW Co-committed-by: DanW --- project/Aki.Custom/Airdrops/AirdropBox.cs | 10 ++++++++++ project/Aki.Custom/Aki.Custom.csproj | 1 + 2 files changed, 11 insertions(+) diff --git a/project/Aki.Custom/Airdrops/AirdropBox.cs b/project/Aki.Custom/Airdrops/AirdropBox.cs index 8ebf39b..c922de7 100644 --- a/project/Aki.Custom/Airdrops/AirdropBox.cs +++ b/project/Aki.Custom/Airdrops/AirdropBox.cs @@ -6,6 +6,7 @@ using EFT.Airdrop; using EFT.Interactive; using EFT.SynchronizableObjects; using UnityEngine; +using UnityEngine.AI; namespace Aki.Custom.Airdrops { @@ -145,6 +146,15 @@ namespace Aki.Custom.Airdrops Falloff = (int)surfaceSet.LandingSoundBank.Rolloff, Volume = surfaceSet.LandingSoundBank.BaseVolume }); + + AddNavMeshObstacle(); + } + + private void AddNavMeshObstacle() + { + var navMeshObstacle = this.GetOrAddComponent(); + navMeshObstacle.size = boxSync.CollisionCollider.bounds.size; + navMeshObstacle.carving = true; } private bool RaycastBoxDistance(LayerMask layerMask, out RaycastHit hitInfo) diff --git a/project/Aki.Custom/Aki.Custom.csproj b/project/Aki.Custom/Aki.Custom.csproj index 174c36a..ff37427 100644 --- a/project/Aki.Custom/Aki.Custom.csproj +++ b/project/Aki.Custom/Aki.Custom.csproj @@ -15,6 +15,7 @@ +