MakesGameTicker use FlushEntities() (#23299)

This commit is contained in:
Leon Friedrich
2024-01-03 22:33:43 -05:00
committed by GitHub
parent 0fd68b2af8
commit 9f2535a130

View File

@@ -503,29 +503,9 @@ namespace Content.Server.GameTicking
RaiseLocalEvent(ev);
// So clients' entity systems can clean up too...
RaiseNetworkEvent(ev, Filter.Broadcast());
RaiseNetworkEvent(ev);
// Delete all entities.
foreach (var entity in EntityManager.GetEntities().ToArray())
{
#if EXCEPTION_TOLERANCE
try
{
#endif
// TODO: Maybe something less naive here?
// FIXME: Actually, definitely.
if (!Deleted(entity) && !Terminating(entity))
EntityManager.DeleteEntity(entity);
#if EXCEPTION_TOLERANCE
}
catch (Exception e)
{
_sawmill.Error($"Caught exception while trying to delete entity {ToPrettyString(entity)}, this might corrupt the game state...");
_runtimeLog.LogException(e, nameof(GameTicker));
continue;
}
#endif
}
EntityManager.FlushEntities();
_mapManager.Restart();