| | | 1 | | using System; |
| | | 2 | | |
| | | 3 | | namespace Trailblazer.Pathing; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Stores the reusable waypoint trail generated for a raw volume request. |
| | | 7 | | /// </summary> |
| | | 8 | | public sealed class VolumeSurveyResult : SurveyResult |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// Gets the sequence of waypoints calculated by the A* pathfinding algorithm. |
| | | 12 | | /// </summary> |
| | | 13 | | public AStarWaypoint[]? Waypoints { get; private set; } |
| | | 14 | | |
| | | 15 | | /// <inheritdoc/> |
| | 1014 | 16 | | public override bool HasPath => IsValid && Waypoints != null && Waypoints.Length > 0; |
| | | 17 | | |
| | | 18 | | /// <summary> |
| | | 19 | | /// Represents an empty result for a volume survey operation. |
| | | 20 | | /// </summary> |
| | | 21 | | /// <remarks>Use this field to represent a default or uninitialized state when no survey data is available.</remarks |
| | 1 | 22 | | public static readonly VolumeSurveyResult Empty = new(); |
| | | 23 | | |
| | 292 | 24 | | private VolumeSurveyResult() { } |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// Creates a new instance of the VolumeSurveyResult class using the specified waypoints, charts, and key. |
| | | 28 | | /// </summary> |
| | | 29 | | /// <param name="context">The world context that owns the survey result.</param> |
| | | 30 | | /// <param name="waypoints">An array of AStarWaypoint objects representing the waypoints to include in the survey re |
| | | 31 | | /// <param name="chartsUtilized">An array of chart names that were utilized in the survey. If null, an empty array i |
| | | 32 | | /// <param name="key">A key used to identify or hash the request associated with this survey result.</param> |
| | | 33 | | /// <returns>A new VolumeSurveyResult instance initialized with the provided waypoints, charts, and key.</returns> |
| | | 34 | | public static VolumeSurveyResult Create( |
| | | 35 | | TrailblazerWorldContext context, |
| | | 36 | | AStarWaypoint[] waypoints, |
| | | 37 | | string[] chartsUtilized, |
| | | 38 | | int key) |
| | | 39 | | { |
| | 145 | 40 | | PathRequestContextResolver.ThrowIfUnusable(context); |
| | 145 | 41 | | return new VolumeSurveyResult() |
| | 145 | 42 | | { |
| | 145 | 43 | | IsValid = true, |
| | 145 | 44 | | IsInUse = false, |
| | 145 | 45 | | Context = context, |
| | 145 | 46 | | ChartsUtilized = chartsUtilized ?? Array.Empty<string>(), |
| | 145 | 47 | | Waypoints = waypoints, |
| | 145 | 48 | | LastUsedFrame = -1, |
| | 145 | 49 | | RequestHashKey = key |
| | 145 | 50 | | }; |
| | | 51 | | } |
| | | 52 | | |
| | | 53 | | /// <inheritdoc/> |
| | | 54 | | public override void Reset() |
| | | 55 | | { |
| | 31 | 56 | | base.Reset(); |
| | 31 | 57 | | Waypoints = null; |
| | 31 | 58 | | } |
| | | 59 | | } |