| | | 1 | | //======================================================================= |
| | | 2 | | // ObstacleClearEventInfo.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 | | |
| | | 8 | | using GridForge.Spatial; |
| | | 9 | | |
| | | 10 | | namespace GridForge.Grids; |
| | | 11 | | |
| | | 12 | | /// <summary> |
| | | 13 | | /// Immutable snapshot describing a bulk obstacle clear operation on a voxel. |
| | | 14 | | /// </summary> |
| | | 15 | | public readonly struct ObstacleClearEventInfo |
| | | 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 that had its obstacles cleared. |
| | | 24 | | /// </summary> |
| | | 25 | | public readonly WorldVoxelIndex VoxelIndex; |
| | | 26 | | |
| | | 27 | | /// <summary> |
| | | 28 | | /// The number of obstacles removed by the clear operation. |
| | | 29 | | /// </summary> |
| | | 30 | | public readonly byte ClearedObstacleCount; |
| | | 31 | | |
| | | 32 | | /// <summary> |
| | | 33 | | /// The grid version recorded after the clear operation completes. |
| | | 34 | | /// </summary> |
| | | 35 | | public readonly uint GridVersion; |
| | | 36 | | |
| | | 37 | | /// <summary> |
| | | 38 | | /// The world-local commit order of this event. |
| | | 39 | | /// </summary> |
| | 1 | 40 | | public ulong ChangeSequence => ChangeStamp.Sequence; |
| | | 41 | | |
| | | 42 | | /// <summary> |
| | | 43 | | /// The logical cause shared with the corresponding grid notification. |
| | | 44 | | /// </summary> |
| | 1 | 45 | | public ulong CauseId => ChangeStamp.CauseId; |
| | | 46 | | |
| | | 47 | | /// <summary> |
| | | 48 | | /// The grid index containing <see cref="VoxelIndex"/>. |
| | | 49 | | /// </summary> |
| | 1 | 50 | | public readonly ushort GridIndex => VoxelIndex.GridIndex; |
| | | 51 | | |
| | | 52 | | /// <summary> |
| | | 53 | | /// Initializes a new immutable obstacle clear snapshot. |
| | | 54 | | /// </summary> |
| | | 55 | | public ObstacleClearEventInfo( |
| | | 56 | | WorldVoxelIndex voxelIndex, |
| | | 57 | | byte clearedObstacleCount, |
| | | 58 | | uint gridVersion, |
| | | 59 | | GridChangeStamp changeStamp = default) |
| | | 60 | | { |
| | 566 | 61 | | ChangeStamp = changeStamp; |
| | 566 | 62 | | VoxelIndex = voxelIndex; |
| | 566 | 63 | | ClearedObstacleCount = clearedObstacleCount; |
| | 566 | 64 | | GridVersion = gridVersion; |
| | 566 | 65 | | } |
| | | 66 | | } |