//this needs to accept a distance parameter.... public static bool NavigateToTarget(EntityCache target, string module, bool orbit, int DistanceFromTarget) { // if we are inside warpto range you need to approach (you cant warp from here) if (target.Distance < (int) Distances.WarptoDistance) { if (orbit) { if (target.Distance < DistanceFromTarget) { return true; } if (DateTime.UtcNow > Time.Instance.NextOrbit) { //we cant move in bastion mode, do not try List<ModuleCache> bastionModules = null; if (QuestorCache.Instance.Modules == null) return false; bastionModules = QuestorCache.Instance.Modules.Where(m => m.GroupId == (int)Group.Bastion && m.IsOnline).ToList(); if (bastionModules.Any(i => i.IsActive)) return false; Logging.Log(module, "StartOrbiting: Target in range", Logging.Teal); if (!QuestorCache.Instance.IsApproachingOrOrbiting(target.Id)) { Logging.Log("CombatMissionCtrl.NavigateToObject", "We are not approaching nor orbiting", Logging.Teal); if (target.Orbit(DistanceFromTarget - 1500)) { Logging.Log(module, "Initiating Orbit [" + target.Name + "][ID: " + target.MaskedId + "]", Logging.Teal); return false; } return false; } } } else //if we are not speed tanking then check optimalrange setting, if that is not set use the less of targeting range and weapons range to dictate engagement range { if (DateTime.UtcNow > Time.Instance.NextApproachAction) { if (target.Distance < DistanceFromTarget) { return true; } if (QuestorCache.Instance.Approaching == null || QuestorCache.Instance.Approaching.Id != target.Id || QuestorCache.Instance.MyShipEntity.Velocity < 50) { if (target.KeepAtRange(DistanceFromTarget - 1500)) { Logging.Log(module, "Using SafeDistanceFromStructure: Approaching target [" + target.Name + "][ID: " + target.MaskedId + "][" + Math.Round(target.Distance / 1000, 0) + "k away]", Logging.Teal); } return false; } return false; } return false; } } // Probably never happens if (target.AlignTo()) { return false; } return false; }