< Summary

Information
Class: Trailblazer.Pathing.PathingWorldState
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/PathingWorldState.cs
Line coverage
92%
Covered lines: 12
Uncovered lines: 1
Coverable lines: 13
Total lines: 108
Line coverage: 92.3%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_World()100%11100%
Dispose()50%2287.5%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/PathingWorldState.cs

#LineLine coverage
 1using GridForge.Grids;
 2using GridForge.Spatial;
 3using SwiftCollections;
 4using SwiftCollections.Pool;
 5using System;
 6using System.Threading;
 7
 8namespace Trailblazer.Pathing;
 9
 10/// <summary>
 11/// Owns mutable pathing state for one <see cref="TrailblazerWorldContext"/>.
 12/// </summary>
 13internal sealed class PathingWorldState : IDisposable
 14{
 15    private bool _disposed;
 16
 96117    internal PathingWorldState(TrailblazerWorldContext context)
 18    {
 96119        Context = context;
 96120        ExternalGridBridge = new PathingWorldGridBridge(this);
 96121    }
 22
 23    internal TrailblazerWorldContext Context { get; }
 24
 4107725    internal GridWorld World => Context.World;
 26
 27    internal PathingWorldGridBridge ExternalGridBridge { get; }
 28
 29    internal SwiftObjectPool<SolidChartPartition> PartitionPool { get; } = new(
 30        () => new SolidChartPartition(),
 31        actionOnRelease: partition => partition.Reset());
 32
 33    internal SwiftObjectPool<VolumeChartPartition> VolumeChartPartitionPool { get; } = new(
 34        () => new VolumeChartPartition(),
 35        actionOnRelease: partition => partition.Reset());
 36
 37    internal SwiftDictionary<string, NavigationChartRegistration> NavigationChartMap { get; } = new();
 38
 39    internal SwiftDictionary<WorldVoxelIndex, ResolvedChartVoxelState> ResolvedChartVoxelStates { get; } = new();
 40
 41    internal SwiftDictionary<ushort, SwiftDictionary<string, int>> InitializedChartTouchCountsByGridIndex { get; } = new
 42
 43    internal ReaderWriterLockSlim NavigationChartMapLock { get; } = new();
 44
 45    internal int ActiveAuthoredGasCellCount { get; set; }
 46
 47    internal int ActiveAuthoredLiquidCellCount { get; set; }
 48
 49    internal int NextChartRegistrationOrder { get; set; }
 50
 51    internal TraversalTransitionRegistryState TransitionRegistryState { get; } = new();
 52
 53    internal TraversalTransitionQueryCache TransitionQueryCache { get; } = new();
 54
 55    internal VolumeMediumRulesState VolumeRulesState { get; } = new();
 56
 57    internal SolidPartitionReachabilityState ReachabilityState { get; } = new();
 58
 59    internal TrailblazerGuideState GuideState { get; } = new();
 60
 61    internal AlternativeVoxelFinder AlternativeVoxelFinder { get; } = new();
 62
 63    internal SwiftDictionary<ushort, ExternalGridEventObservation> ExternalGridEventObservationsByGridIndex { get; } = n
 64
 65    internal SwiftDictionary<ushort, PendingExternalGridChange> PendingGridChangesByGridIndex { get; } = new();
 66
 67    internal SwiftList<ushort> PendingGridChangeOrder { get; } = new();
 68
 69    internal int GridEventsReceived { get; set; }
 70
 71    internal int GridAddEventsReceived { get; set; }
 72
 73    internal int GridRemoveEventsReceived { get; set; }
 74
 75    internal int GridChangeEventsReceived { get; set; }
 76
 77    internal int DistinctObservedGridSlots { get; set; }
 78
 79    internal int DuplicateGridEventSignaturesObserved { get; set; }
 80
 81    internal int DuplicateGridAddEventSignaturesObserved { get; set; }
 82
 83    internal int DuplicateGridRemoveEventSignaturesObserved { get; set; }
 84
 85    internal int DuplicateGridChangeEventSignaturesObserved { get; set; }
 86
 87    internal int MaxGridEventStreak { get; set; }
 88
 89    internal int GridRebuildPassesExecuted { get; set; }
 90
 91    internal int GridEventsIgnoredForNoIntersectingCharts { get; set; }
 92
 93    internal int TotalChartsSelectedForGridRebuild { get; set; }
 94
 95    internal int MaxChartsSelectedForSingleGridEvent { get; set; }
 96
 97    public void Dispose()
 98    {
 96199        if (_disposed)
 0100            return;
 101
 961102        _disposed = true;
 961103        ExternalGridBridge.Dispose();
 961104        GuideState.Dispose();
 961105        TransitionRegistryState.Dispose();
 961106        NavigationChartMapLock.Dispose();
 961107    }
 108}