< Summary

Information
Class: GridForge.Grids.ObstacleEventInfo
Assembly: GridForge
File(s): /home/runner/work/GridForge/GridForge/src/GridForge/Grids/Support/ObstacleEventInfo.cs
Line coverage
100%
Covered lines: 9
Uncovered lines: 0
Coverable lines: 9
Total lines: 73
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_ChangeSequence()100%11100%
get_CauseId()100%11100%
get_GridIndex()100%11100%
.ctor(...)100%11100%

File(s)

/home/runner/work/GridForge/GridForge/src/GridForge/Grids/Support/ObstacleEventInfo.cs

#LineLine coverage
 1//=======================================================================
 2// ObstacleEventInfo.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2024–present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using GridForge.Spatial;
 9
 10namespace GridForge.Grids;
 11
 12/// <summary>
 13/// Immutable snapshot describing a single obstacle mutation on a voxel.
 14/// </summary>
 15public readonly struct ObstacleEventInfo
 16{
 17    /// <summary>
 18    /// The world-owned ordering and cause identity for this committed mutation.
 19    /// </summary>
 20    public readonly GridChangeStamp ChangeStamp;
 21
 22    /// <summary>
 23    /// The voxel affected by the obstacle mutation.
 24    /// </summary>
 25    public readonly WorldVoxelIndex VoxelIndex;
 26
 27    /// <summary>
 28    /// The token identifying the obstacle that was added or removed.
 29    /// </summary>
 30    public readonly ObstacleToken ObstacleToken;
 31
 32    /// <summary>
 33    /// The number of active obstacles on the voxel after the mutation completes.
 34    /// </summary>
 35    public readonly byte ObstacleCount;
 36
 37    /// <summary>
 38    /// The grid version recorded after the mutation completes.
 39    /// </summary>
 40    public readonly uint GridVersion;
 41
 42    /// <summary>
 43    /// The world-local commit order of this event.
 44    /// </summary>
 145    public ulong ChangeSequence => ChangeStamp.Sequence;
 46
 47    /// <summary>
 48    /// The logical cause shared with the corresponding grid notification.
 49    /// </summary>
 150    public ulong CauseId => ChangeStamp.CauseId;
 51
 52    /// <summary>
 53    /// The grid index containing <see cref="VoxelIndex"/>.
 54    /// </summary>
 155    public readonly ushort GridIndex => VoxelIndex.GridIndex;
 56
 57    /// <summary>
 58    /// Initializes a new immutable obstacle mutation snapshot.
 59    /// </summary>
 60    public ObstacleEventInfo(
 61        WorldVoxelIndex voxelIndex,
 62        ObstacleToken obstacleToken,
 63        byte obstacleCount,
 64        uint gridVersion,
 65        GridChangeStamp changeStamp = default)
 66    {
 111567        ChangeStamp = changeStamp;
 111568        VoxelIndex = voxelIndex;
 111569        ObstacleToken = obstacleToken;
 111570        ObstacleCount = obstacleCount;
 111571        GridVersion = gridVersion;
 111572    }
 73}