Fixes exceptions in AiReachableSystem on round restart.
This commit is contained in:
@@ -86,6 +86,12 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
SubscribeLocalEvent<PlayerAttachSystemMessage>(SendDebugMessage);
|
SubscribeLocalEvent<PlayerAttachSystemMessage>(SendDebugMessage);
|
||||||
#endif
|
#endif
|
||||||
|
_mapmanager.OnGridRemoved += GridRemoved;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GridRemoved(GridId gridId)
|
||||||
|
{
|
||||||
|
_regions.Remove(gridId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(float frameTime)
|
public override void Update(float frameTime)
|
||||||
@@ -588,7 +594,12 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
|
|||||||
var chunkIdx = 0;
|
var chunkIdx = 0;
|
||||||
var regionIdx = 0;
|
var regionIdx = 0;
|
||||||
|
|
||||||
foreach (var (_, regions) in _regions[gridId])
|
if (!_regions.TryGetValue(gridId, out var dict))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var (_, regions) in dict)
|
||||||
{
|
{
|
||||||
var debugRegions = new Dictionary<int, List<Vector2>>();
|
var debugRegions = new Dictionary<int, List<Vector2>>();
|
||||||
debugResult.Add(chunkIdx, debugRegions);
|
debugResult.Add(chunkIdx, debugRegions);
|
||||||
|
|||||||
Reference in New Issue
Block a user