Fix bug where atmos could get stuck processing certain states for a long time

This commit is contained in:
Víctor Aguilera Puerto
2020-08-08 16:55:36 +02:00
parent a9a6438d74
commit 9681907006

View File

@@ -328,20 +328,20 @@ namespace Content.Server.GameObjects.Components.Atmos
_state = ProcessState.ActiveTiles; _state = ProcessState.ActiveTiles;
return; return;
case ProcessState.ActiveTiles: case ProcessState.ActiveTiles:
if(ProcessActiveTiles()) ProcessActiveTiles();
_state = ProcessState.ExcitedGroups; _state = ProcessState.ExcitedGroups;
return; return;
case ProcessState.ExcitedGroups: case ProcessState.ExcitedGroups:
if(ProcessExcitedGroups()) ProcessExcitedGroups();
_state = ProcessState.HighPressureDelta; _state = ProcessState.HighPressureDelta;
return; return;
case ProcessState.HighPressureDelta: case ProcessState.HighPressureDelta:
ProcessHighPressureDelta(); ProcessHighPressureDelta();
_state = ProcessState.Hotspots; _state = ProcessState.Hotspots;
break; break;
case ProcessState.Hotspots: case ProcessState.Hotspots:
if(ProcessHotspots()) ProcessHotspots();
_state = ProcessState.TileEqualize; _state = ProcessState.TileEqualize;
break; break;
} }
@@ -363,11 +363,9 @@ namespace Content.Server.GameObjects.Components.Atmos
if (_stopwatch.Elapsed.TotalMilliseconds >= LagCheckMaxMilliseconds) if (_stopwatch.Elapsed.TotalMilliseconds >= LagCheckMaxMilliseconds)
return; return;
} }
return;
} }
public bool ProcessActiveTiles() public void ProcessActiveTiles()
{ {
_stopwatch.Restart(); _stopwatch.Restart();
@@ -380,13 +378,11 @@ namespace Content.Server.GameObjects.Components.Atmos
number = 0; number = 0;
// Process the rest next time. // Process the rest next time.
if (_stopwatch.Elapsed.TotalMilliseconds >= LagCheckMaxMilliseconds) if (_stopwatch.Elapsed.TotalMilliseconds >= LagCheckMaxMilliseconds)
return false; return;
} }
return true;
} }
public bool ProcessExcitedGroups() public void ProcessExcitedGroups()
{ {
_stopwatch.Restart(); _stopwatch.Restart();
@@ -406,10 +402,8 @@ namespace Content.Server.GameObjects.Components.Atmos
number = 0; number = 0;
// Process the rest next time. // Process the rest next time.
if (_stopwatch.Elapsed.TotalMilliseconds >= LagCheckMaxMilliseconds) if (_stopwatch.Elapsed.TotalMilliseconds >= LagCheckMaxMilliseconds)
return false; return;
} }
return true;
} }
public void ProcessHighPressureDelta() public void ProcessHighPressureDelta()
@@ -430,11 +424,9 @@ namespace Content.Server.GameObjects.Components.Atmos
if (_stopwatch.Elapsed.TotalMilliseconds >= LagCheckMaxMilliseconds) if (_stopwatch.Elapsed.TotalMilliseconds >= LagCheckMaxMilliseconds)
return; return;
} }
return;
} }
private bool ProcessHotspots() private void ProcessHotspots()
{ {
_stopwatch.Restart(); _stopwatch.Restart();
@@ -447,10 +439,8 @@ namespace Content.Server.GameObjects.Components.Atmos
number = 0; number = 0;
// Process the rest next time. // Process the rest next time.
if (_stopwatch.Elapsed.TotalMilliseconds >= LagCheckMaxMilliseconds) if (_stopwatch.Elapsed.TotalMilliseconds >= LagCheckMaxMilliseconds)
return false; return;
} }
return true;
} }
private AirtightComponent GetObstructingComponent(MapIndices indices) private AirtightComponent GetObstructingComponent(MapIndices indices)