< Summary

Information
Class: GridForge.Grids.OccupantEventInfo
Assembly: GridForge
File(s): /home/runner/work/GridForge/GridForge/src/GridForge/Grids/Support/OccupantEventInfo.cs
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 60
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_GridIndex()100%11100%
.ctor(...)100%11100%

File(s)

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

#LineLine coverage
 1//=======================================================================
 2// OccupantEventInfo.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 an occupant mutation on a voxel.
 14/// </summary>
 15/// <remarks>
 16/// Occupant notifications are not part of the world's committed navigation-change stream and
 17/// therefore do not carry a <see cref="GridChangeStamp"/>.
 18/// </remarks>
 19public readonly struct OccupantEventInfo
 20{
 21    /// <summary>
 22    /// The voxel affected by the occupant mutation.
 23    /// </summary>
 24    public readonly WorldVoxelIndex VoxelIndex;
 25
 26    /// <summary>
 27    /// The occupant that was added to or removed from the voxel.
 28    /// </summary>
 29    public readonly IVoxelOccupant Occupant;
 30
 31    /// <summary>
 32    /// The scan-cell ticket assigned to the occupant for this voxel.
 33    /// </summary>
 34    public readonly OccupantTicket Ticket;
 35
 36    /// <summary>
 37    /// The number of occupants on the voxel after the mutation completes.
 38    /// </summary>
 39    public readonly byte OccupantCount;
 40
 41    /// <summary>
 42    /// The grid index containing <see cref="VoxelIndex"/>.
 43    /// </summary>
 144    public readonly ushort GridIndex => VoxelIndex.GridIndex;
 45
 46    /// <summary>
 47    /// Initializes a new immutable occupant mutation snapshot.
 48    /// </summary>
 49    public OccupantEventInfo(
 50        WorldVoxelIndex voxelIndex,
 51        IVoxelOccupant occupant,
 52        OccupantTicket ticket,
 53        byte occupantCount)
 54    {
 82555        VoxelIndex = voxelIndex;
 82556        Occupant = occupant;
 82557        Ticket = ticket;
 82558        OccupantCount = occupantCount;
 82559    }
 60}