From a965314b8fe58f02073890505f18973fc7bdb5c3 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Thu, 23 May 2019 15:07:50 +0300 Subject: [PATCH] (15bea4eef) Only ask medical assistance if there is a character with the rescue all objective. Don't allow to add targets if the bot is dead. --- .../Source/Characters/AI/HumanAIController.cs | 10 ++++++---- .../Source/Characters/AI/Objectives/AIObjectiveLoop.cs | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs index 7b61861e2..e1587cdfc 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs @@ -321,11 +321,13 @@ namespace Barotrauma if (c.CurrentHull != hull) { continue; } if (AIObjectiveRescueAll.IsValidTarget(c, Character)) { - AddTargets(c, Character); - if (newOrder == null) + if (AddTargets(c, Character)) { - var orderPrefab = Order.PrefabList.Find(o => o.AITag == "requestfirstaid"); - newOrder = new Order(orderPrefab, c.CurrentHull, null, orderGiver: Character); + if (newOrder == null) + { + var orderPrefab = Order.PrefabList.Find(o => o.AITag == "requestfirstaid"); + newOrder = new Order(orderPrefab, c.CurrentHull, null, orderGiver: Character); + } } } } diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveLoop.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveLoop.cs index 1d0816dca..82a276ec0 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveLoop.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveLoop.cs @@ -21,6 +21,7 @@ namespace Barotrauma public bool AddTarget(T target) { + if (character.IsDead) { return false; } if (ReportedTargets.Contains(target)) { return false;