Make PathfindingSystem take a nap during large explosions (#12309)
This commit is contained in:
@@ -27,6 +27,15 @@ public sealed partial class PathfindingSystem
|
||||
public const int PathfindingCollisionMask = (int) CollisionGroup.MobMask;
|
||||
public const int PathfindingCollisionLayer = (int) CollisionGroup.MobLayer;
|
||||
|
||||
/// <summary>
|
||||
/// If true, UpdateGrid() will not process grids.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Useful if something like a large explosion is in the process of shredding the grid, as it avoids uneccesary
|
||||
/// updating.
|
||||
/// </remarks>
|
||||
public bool PauseUpdating = false;
|
||||
|
||||
private readonly Stopwatch _stopwatch = new();
|
||||
|
||||
// Probably can't pool polys as there might be old pathfinding refs to them.
|
||||
@@ -66,6 +75,9 @@ public sealed partial class PathfindingSystem
|
||||
|
||||
private void UpdateGrid()
|
||||
{
|
||||
if (PauseUpdating)
|
||||
return;
|
||||
|
||||
var curTime = _timing.CurTime;
|
||||
#if DEBUG
|
||||
var updateCount = 0;
|
||||
|
||||
Reference in New Issue
Block a user