From 1297127ae229b76acac83129fdbd7b196af708b7 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Sun, 7 Apr 2019 13:41:07 +0300 Subject: [PATCH] (0be4bd31d) Todo note about idling characters killing the framerate (see #1397) --- .../Source/Characters/AI/Objectives/AIObjectiveIdle.cs | 2 ++ Barotrauma/BarotraumaShared/Source/Items/Item.cs | 6 ------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveIdle.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveIdle.cs index 378a71008..886394bd4 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveIdle.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveIdle.cs @@ -207,6 +207,8 @@ namespace Barotrauma { // Check that there is no unsafe or forbidden hulls on the way to the target // Only do this when the current hull is ok, because otherwise the would block all paths from the current hull to the target hull. + + //TODO: optimize this (only attempt to find a couple of paths per frame?). Now idle characters completely kill the fps if they can't find a path (e.g. if they're in a room with no way out or if the sub is missing waypoints) var path = PathSteering.PathFinder.FindPath(character.SimPosition, hull.SimPosition); if (path.Unreachable) { continue; } if (path.Nodes.Any(n => HumanAIController.UnsafeHulls.Contains(n.CurrentHull) || IsForbidden(n.CurrentHull))) { continue; } diff --git a/Barotrauma/BarotraumaShared/Source/Items/Item.cs b/Barotrauma/BarotraumaShared/Source/Items/Item.cs index b19da3967..35e8db773 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Item.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Item.cs @@ -1144,12 +1144,6 @@ namespace Barotrauma return; } - float forceFactor = 1.0f; - if (CurrentHull != null) - { - return; - } - float forceFactor = 1.0f; if (CurrentHull != null) {