private BooleanValue HasImpact() { if (Available()) { return(shared.Vessel == FlightGlobals.ActiveVessel && TRWrapper.ImpactVector().HasValue); } throw new KOSUnavailableAddonException("HASIMPACT", "Trajectories"); }
// Older suffixes. private GeoCoordinates ImpactPos() { if (shared.Vessel != FlightGlobals.ActiveVessel) { throw new KOSException("You may only call addons:TR:ImpactPos from the active vessel. Always check addons:tr:HasImpact"); } if (Available()) { CelestialBody body = shared.Vessel.orbit.referenceBody; Vector3? impactVect = TRWrapper.ImpactVector(); if (impactVect != null) { var worldImpactPos = (Vector3d)impactVect + body.position; var lat = body.GetLatitude(worldImpactPos); var lng = Utils.DegreeFix(body.GetLongitude(worldImpactPos), -180); return(new GeoCoordinates(shared, lat, lng)); } throw new KOSException("Impact position is not available. Remember to check addons:tr:HasImpact"); } throw new KOSUnavailableAddonException("IMPACTPOS", "Trajectories"); }