OBT/1.0.15

* Removed PF support again
Fixed Object reference not set to an instance of an object exception in EnemyAIController.cs UpdateLimbAttack()

* Reverted pervious fix on EnemyAIController bcuz the fix will not fix anything
Reduced MaxDegreeOfParallelism by 1 bcuz already a task there

* Re-removed all PF related stuff to fix issue
Removed all RUN_PHYSICS_IN_SEPARATE_THREAD related code because these codes are no longer functional
Removed a duplicated loop in GameScreen
Removed mulitple unnessary parallel operations

* Potentially fixed #44 and #43

* added a ToList for Gap.GapList
This commit is contained in:
NotAlwaysTrue
2026-02-09 15:34:07 +08:00
committed by GitHub
parent 8bfe8a2c37
commit 740ace88f0
5 changed files with 38 additions and 68 deletions
@@ -650,7 +650,8 @@ namespace Barotrauma
// Buffer lists to avoid repeated allocations
var hullList = Hull.HullList.ToList();
var structureList = Structure.WallList.ToList();
var gapList = Gap.GapList.ToList();
// First, WHY THIS LINQ GOT A NULL ERROR? Second, WHY??
List<Gap> shuffledGaps = Gap.GapList?.OrderBy(g => Rand.Int(int.MaxValue)).ToList() ?? Gap.GapList.ToList();
var itemList = Item.ItemList.ToList();
// First phase: parallel updates that have no order dependencies
@@ -679,14 +680,12 @@ namespace Barotrauma
// moved waterflow reset here to see if we can reduce at least some time
{
// if crashed, go ask the god damn physics engine :(
var shuffledGaps = gapList.OrderBy(g => Rand.Int(int.MaxValue)).ToList();
if (shuffledGaps == null) { shuffledGaps = Gap.GapList; }
Parallel.ForEach(shuffledGaps, parallelOptions, gap =>
{
gap.ResetWaterFlowThisFrame();
gap.Update(deltaTime, cam);
});
SingleThreadWorker.GlobalWorker.RunActions();
},
// Powered components update
() =>
@@ -695,6 +694,8 @@ namespace Barotrauma
}
);
SingleThreadWorker.GlobalWorker.RunActions();
#if CLIENT
// Hull Cheats need to be executed after Hull update
Hull.UpdateCheats(deltaTime, cam);
@@ -709,7 +710,6 @@ namespace Barotrauma
// Item update (Item.Update() is not thread-safe and must be executed on the main thread)
Item.UpdatePendingConditionUpdates(deltaTime);
float scaledDeltaTime = deltaTime * MapEntityUpdateInterval;
Item lastUpdatedItem = null;
try
@@ -717,7 +717,7 @@ namespace Barotrauma
foreach (Item item in itemList)
{
lastUpdatedItem = item;
item.Update(scaledDeltaTime, cam);
item.Update(deltaTime, cam);
}
}
catch (InvalidOperationException e)
@@ -729,7 +729,7 @@ namespace Barotrauma
throw new InvalidOperationException($"Error while updating item {lastUpdatedItem?.Name ?? "null"}", innerException: e);
}
UpdateAllProjSpecific(scaledDeltaTime);
UpdateAllProjSpecific(deltaTime);
Spawner?.Update();
#if CLIENT