using XFEEDToolBox.Core.Models; namespace XFEEDToolBox.Core.Navigation; /// Fuel presentation of the original game route; never creates or changes its waypoints. public sealed record NavigationFuelOverlay(IReadOnlyList DashedLegs,IReadOnlyList SupplySites,long? RecommendedSupply) { public static readonly NavigationFuelOverlay Empty=new([],[],null); public static NavigationFuelOverlay Build(PlayerState player,double reserve) { var route=player.Navigation.Route; var current=route.ToList().FindIndex(w=>w.SystemAddress==player.Navigation.CurrentSystemAddress); var ship=player.Ships.FirstOrDefault(s=>s.ShipId==player.CurrentShipId); var drive=NavigationPreviewBuilder.Drive(ship); var main=player.Navigation.FuelAt>player.StatusAt?player.Navigation.MainFuel:player.Status?.FuelMain??player.Navigation.MainFuel; if(current<0||drive is null||main is not {} fuel||!double.IsFinite(fuel))return Empty; var sites=NavigationPreviewBuilder.HasScoop(ship)?route.Skip(current).Where(w=>w.Scoopable).Select(w=>w.SystemAddress).ToArray():[]; double? mass=ship?.UnladenMass is {} dry&&player.Status?.FuelReserve is {} aux&&player.CargoReliable?dry+fuel+aux+player.CargoCount:null; var dashed=new List();long? lastReachableSupply=sites.Contains(route[current].SystemAddress)?route[current].SystemAddress:null,recommended=null; var outsideRange=false; for(var i=current+1;i