Add IResettingEntitySystem for entity systems that do resetting cleanup (#2257)

* Add IResettingEntitySystem for entity systems that do resetting cleanup

* You got a license for that submodule update?
This commit is contained in:
DrSmugleaf
2020-10-14 22:45:53 +02:00
committed by GitHub
parent 6be80c119b
commit 50bc61b672
17 changed files with 76 additions and 54 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using Content.Server.GameObjects.Components.Access;
using Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Pathfinders;
using Content.Shared.AI;
using Content.Shared.GameTicking;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects.Components;
@@ -22,7 +23,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
/// </summary>
/// Long-term can be used to do hierarchical pathfinding
[UsedImplicitly]
public sealed class AiReachableSystem : EntitySystem
public sealed class AiReachableSystem : EntitySystem, IResettingEntitySystem
{
/*
* The purpose of this is to provide a higher-level / hierarchical abstraction of the actual pathfinding graph
@@ -134,14 +135,6 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
_mapManager.OnGridRemoved -= GridRemoved;
}
public void ResettingCleanup()
{
_queuedUpdates.Clear();
_regions.Clear();
_cachedAccessible.Clear();
_queuedCacheDeletions.Clear();
}
private void RecalculateNodeRegions(PathfindingChunkUpdateMessage message)
{
// TODO: Only need to do changed nodes ideally
@@ -683,6 +676,14 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
#endif
}
public void Reset()
{
_queuedUpdates.Clear();
_regions.Clear();
_cachedAccessible.Clear();
_queuedCacheDeletions.Clear();
}
#if DEBUG
private void SendDebugMessage(PlayerAttachSystemMessage message)
{