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