OBT/1.0.11
Fixed a bug that caused the server to stop responding Fixed an issue in gap.Update that may cause the server to crash
This commit is contained in:
@@ -812,7 +812,7 @@ namespace Barotrauma
|
||||
if (outsideCollisionBlocker == null) { return false; }
|
||||
if (IsRoomToRoom || Submarine == null || open <= 0.0f || linkedTo.Count == 0 || linkedTo[0] is not Hull)
|
||||
{
|
||||
outsideCollisionBlocker.Enabled = false;
|
||||
outsideCollisionBlocker.AddToDisableQueue();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -686,6 +686,7 @@ namespace Barotrauma
|
||||
gap.ResetWaterFlowThisFrame();
|
||||
gap.Update(deltaTime, cam);
|
||||
});
|
||||
FarseerPhysics.Dynamics.Body.QueueDisable();
|
||||
},
|
||||
// Powered components update
|
||||
() =>
|
||||
|
||||
@@ -245,10 +245,10 @@ namespace Barotrauma
|
||||
Character.Controlled?.UpdateLocalCursor(cam);
|
||||
|
||||
#elif SERVER
|
||||
Parallel.Invoke(parallelOptions,
|
||||
() => { if (Level.Loaded != null) Level.Loaded.Update((float)deltaTime, Camera.Instance); },
|
||||
() => Character.UpdateAll((float)deltaTime, Camera.Instance)
|
||||
);
|
||||
|
||||
// Don't parallize these things here or the server may got stuck but why idk
|
||||
if (Level.Loaded != null) { Level.Loaded.Update((float)deltaTime, Camera.Instance); }
|
||||
Character.UpdateAll((float)deltaTime, Camera.Instance);
|
||||
|
||||
//StatusEffect.UpdateAll is not thread-safe and must be executed on the main thread
|
||||
StatusEffect.UpdateAll((float)deltaTime);
|
||||
@@ -272,9 +272,7 @@ namespace Barotrauma
|
||||
#if CLIENT
|
||||
MapEntity.UpdateAll((float)deltaTime, cam, parallelOptions);
|
||||
#elif SERVER
|
||||
|
||||
MapEntity.UpdateAll((float)deltaTime, Camera.Instance, parallelOptions);
|
||||
|
||||
#endif
|
||||
|
||||
#if CLIENT
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
@@ -349,6 +350,21 @@ namespace FarseerPhysics.Dynamics
|
||||
}
|
||||
}
|
||||
|
||||
private static ConcurrentQueue<Body> DisableQueue = new ConcurrentQueue<Body>();
|
||||
|
||||
public static void QueueDisable()
|
||||
{
|
||||
while (DisableQueue.TryDequeue(out var pendingbody))
|
||||
{
|
||||
pendingbody.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddToDisableQueue()
|
||||
{
|
||||
DisableQueue.Enqueue(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create all proxies.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user