From d16707a2f38902916d10ff5ac6a4ce96f484a4bd Mon Sep 17 00:00:00 2001 From: NotAlwaysTrue <77662224+NotAlwaysTrue@users.noreply.github.com> Date: Fri, 13 Feb 2026 15:02:17 +0800 Subject: [PATCH] OBT/1.0.16 Fixed the GapList bug again to see if this will work P L E A S E W O R K --- .../BarotraumaShared/SharedSource/Map/MapEntity.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Barotrauma/BarotraumaShared/SharedSource/Map/MapEntity.cs b/Barotrauma/BarotraumaShared/SharedSource/Map/MapEntity.cs index 97b3a8697..cc04729fc 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Map/MapEntity.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Map/MapEntity.cs @@ -650,8 +650,12 @@ namespace Barotrauma // Buffer lists to avoid repeated allocations var hullList = Hull.HullList.ToList(); var structureList = Structure.WallList.ToList(); - // First, WHY THIS LINQ GOT A NULL ERROR? Second, WHY?? - List shuffledGaps = Gap.GapList?.OrderBy(g => Rand.Int(int.MaxValue)).ToList() ?? Gap.GapList.ToList(); + + List gapList = Gap.GapList.ToList(); + List shuffledGaps = new List(gapList?.OrderBy(g => Rand.Int(int.MaxValue))); + // In case if it failed, but why it would fail? + shuffledGaps = shuffledGaps ?? gapList; + var itemList = Item.ItemList.ToList(); // First phase: parallel updates that have no order dependencies @@ -680,7 +684,7 @@ namespace Barotrauma // moved waterflow reset here to see if we can reduce at least some time { - if (shuffledGaps == null) { shuffledGaps = Gap.GapList; } + // PLEASE WORK Parallel.ForEach(shuffledGaps, parallelOptions, gap => { gap.ResetWaterFlowThisFrame();