Beispiel #1
0
        private void InitializeSuffixes()
        {
            AddSuffix("NAME", new Suffix <StringValue>(() => name));
            AddSuffix("APOAPSIS", new Suffix <ScalarValue>(() => orbit.ApA));
            AddSuffix("PERIAPSIS", new Suffix <ScalarValue>(() => orbit.PeA));
            AddSuffix("BODY", new Suffix <BodyTarget>(() => BodyTarget.CreateOrGetExisting(orbit.referenceBody, Shared)));
            AddSuffix("PERIOD", new Suffix <ScalarValue>(() => orbit.period));
            AddSuffix("INCLINATION", new Suffix <ScalarValue>(() => orbit.inclination));
            AddSuffix("ECCENTRICITY", new Suffix <ScalarValue>(() => orbit.eccentricity));
            AddSuffix("SEMIMAJORAXIS", new Suffix <ScalarValue>(() => orbit.semiMajorAxis));
            AddSuffix("SEMIMINORAXIS", new Suffix <ScalarValue>(() => orbit.semiMinorAxis));
            AddSuffix(new[] { "LAN", "LONGITUDEOFASCENDINGNODE" }, new Suffix <ScalarValue>(() => orbit.LAN));
            AddSuffix("ARGUMENTOFPERIAPSIS", new Suffix <ScalarValue>(() => orbit.argumentOfPeriapsis));
            AddSuffix("TRUEANOMALY", new Suffix <ScalarValue>(() => orbit.eccentricity < 1.0 ?
                                                              Utilities.Utils.DegreeFix(Utilities.Utils.RadiansToDegrees(orbit.trueAnomaly), 0.0) :
                                                              Utilities.Utils.DegreeFix(Utilities.Utils.RadiansToDegrees(orbit.trueAnomaly), -180.0)
                                                              ));
            AddSuffix("MEANANOMALYATEPOCH", new Suffix <ScalarValue>(() => orbit.eccentricity < 1.0 ?
                                                                     Utilities.Utils.DegreeFix(Utilities.Utils.RadiansToDegrees(orbit.meanAnomalyAtEpoch), 0.0) :
                                                                     Utilities.Utils.RadiansToDegrees(orbit.meanAnomalyAtEpoch)
                                                                     ));
            AddSuffix("EPOCH", new Suffix <ScalarValue>(() => orbit.epoch));
            AddSuffix("TRANSITION", new Suffix <StringValue>(() => orbit.patchEndTransition.ToString()));
            AddSuffix("POSITION", new Suffix <Vector>(() => GetPositionAtUT(new TimeStamp(Planetarium.GetUniversalTime()))));
            AddSuffix("VELOCITY", new Suffix <OrbitableVelocity>(() => GetVelocityAtUT(new TimeStamp(Planetarium.GetUniversalTime()))));
            AddSuffix("NEXTPATCH", new Suffix <OrbitInfo>(GetNextPatch));
            AddSuffix("HASNEXTPATCH", new Suffix <BooleanValue>(GetHasNextPatch));
            AddSuffix("NEXTPATCHETA", new Suffix <ScalarValue>(() => GetETA().GetEndTransition()));  // deprecated alias for :ETA:TRANSITION
            AddSuffix("ETA", new Suffix <OrbitEta>(GetETA));

            //TODO: Determine if these vectors are different than POSITION and VELOCITY
            AddSuffix("VSTATEVECTOR", new Suffix <Vector>(() => new Vector(orbit.vel)));
            AddSuffix("RSTATEVECTOR", new Suffix <Vector>(() => new Vector(orbit.pos)));
        }
Beispiel #2
0
        public double BottomAltitudeRadar()
        {
            BodyTarget body            = BodyTarget.CreateOrGetExisting(shared.Vessel.mainBody, shared);
            Vector     bottomInShipRaw = FurthestCorner(new Vector(-shared.Vessel.upAxis));

            return(body.RadarAltitudeFromPosition(bottomInShipRaw));
        }
        public override Dump Dump()
        {
            var dictionary = new DumpWithHeader
            {
                { DumpLat, lat },
                { DumpLng, lng },
                { DumpBody, BodyTarget.CreateOrGetExisting(Body, Shared) }
            };

            return(dictionary);
        }
Beispiel #4
0
 private void InitializeSuffixes()
 {
     AddSuffix("DUMP", new NoArgsSuffix <StringValue>(ToVerboseString)); // for debugging
     AddSuffix("NAME", new NoArgsSuffix <StringValue>(CookedName, "Name of waypoint as it appears on the map and contract"));
     AddSuffix("BODY", new NoArgsSuffix <BodyTarget>(() => BodyTarget.CreateOrGetExisting(GetBody(), Shared), "Celestial body the waypoint is attached to"));
     AddSuffix("GEOPOSITION", new NoArgsSuffix <GeoCoordinates>(BuildGeoCoordinates, "the LATLNG of this waypoint"));
     AddSuffix("POSITION", new NoArgsSuffix <Vector>(() => GetPosition() - new Vector(Shared.Vessel.CoMD)));
     AddSuffix("ALTITUDE", new NoArgsSuffix <ScalarValue>(BuildSeaLevelAltitude, "Altitude of waypoint above sea level.  Warning, this a point somewhere in the " + "midst of the contract altitude range, not the edge of the altitude range."));
     AddSuffix("AGL", new NoArgsSuffix <ScalarValue>(() => WrappedWaypoint.altitude, "Altitude of waypoint above ground.  Warning, this a point somewhere" + "in the midst of the contract altitude range, not the edge of the altitude range."));
     AddSuffix("NEARSURFACE", new NoArgsSuffix <BooleanValue>(() => WrappedWaypoint.isOnSurface, "True if waypoint is a point near or on the body rather than high in orbit."));
     AddSuffix("GROUNDED", new NoArgsSuffix <BooleanValue>(() => WrappedWaypoint.landLocked, "True if waypoint is actually glued to the ground."));
     AddSuffix("INDEX", new NoArgsSuffix <ScalarValue>(() => WrappedWaypoint.index, "Number of this waypoint if this is a grouped waypoint (i.e. alpha/beta/gamma.."));
     AddSuffix("CLUSTERED", new NoArgsSuffix <BooleanValue>(() => WrappedWaypoint.isClustered, "True if this is a member of a cluster of waypoints (i.e. alpha/beta/gamma.."));
 }
 private void GeoCoordsInitializeSuffixes()
 {
     AddSuffix("LAT", new Suffix <ScalarValue>(() => Latitude));
     AddSuffix("LNG", new Suffix <ScalarValue>(() => Longitude));
     AddSuffix("BODY", new Suffix <BodyTarget>(() => BodyTarget.CreateOrGetExisting(Body, Shared)));
     AddSuffix("TERRAINHEIGHT", new Suffix <ScalarValue>(GetTerrainAltitude));
     AddSuffix("DISTANCE", new Suffix <ScalarValue>(GetDistanceFrom));
     AddSuffix("HEADING", new Suffix <ScalarValue>(GetHeadingFrom));
     AddSuffix("BEARING", new Suffix <ScalarValue>(GetBearing));
     AddSuffix("POSITION", new Suffix <Vector>(GetPosition,
                                               "Get the 3-D space position relative to the ship center, of this lat/long, " +
                                               "at a point on the terrain surface"));
     AddSuffix("VELOCITY", new Suffix <OrbitableVelocity>(GetVelocities,
                                                          "Get the 3-D velocity vectors pair (surface and orbit) at a point on the terrain surface. " +
                                                          "This is the movement of that spot on the ground due to planetary rotation."));
     AddSuffix("ALTITUDEPOSITION", new OneArgsSuffix <Vector, ScalarValue>(GetAltitudePosition,
                                                                           "Get the 3-D space position relative to the ship center, " +
                                                                           "of this lat/long, at this (sea level) altitude"));
     AddSuffix("ALTITUDEVELOCITY", new OneArgsSuffix <OrbitableVelocity, ScalarValue>(GetAltitudeVelocities,
                                                                                      "Get the 3-D velocity vectors pair (surface and orbit) of this lat/lont at this (sea level) altitude. " +
                                                                                      "This is the movement of that spot due to planetary rotation."));
 }
Beispiel #6
0
 private void InitializeSuffixes()
 {
     AddSuffix("NAME", new Suffix <StringValue>(GetName));
     AddSuffix("APOAPSIS", new Suffix <ScalarValue>(() => Orbit.ApA));
     AddSuffix("PERIAPSIS", new Suffix <ScalarValue>(() => Orbit.PeA));
     AddSuffix("BODY", new Suffix <BodyTarget>(() => BodyTarget.CreateOrGetExisting(Orbit.referenceBody, Shared)));
     AddSuffix(new [] { "HASBODY", "HASOBT", "HASORBIT" }, new NoArgsSuffix <BooleanValue>(HasBody));
     AddSuffix("UP", new Suffix <Direction>(() => new Direction(GetUpVector(), false)));
     AddSuffix("NORTH", new Suffix <Direction>(() => new Direction(GetNorthVector(), false)));
     AddSuffix("PROGRADE", new Suffix <Direction>(GetPrograde));
     AddSuffix("RETROGRADE", new Suffix <Direction>(GetRetrograde));
     AddSuffix("SRFPROGRADE", new Suffix <Direction>(GetSurfacePrograde));
     AddSuffix("SRFRETROGRADE", new Suffix <Direction>(GetSurfaceRetrograde));
     AddSuffix(new[] { "OBT", "ORBIT" }, new Suffix <OrbitInfo>(GetOrbitInfo));
     AddSuffix("POSITION", new Suffix <Vector>(GetPosition));
     AddSuffix("VELOCITY", new Suffix <OrbitableVelocity>(GetVelocities));
     AddSuffix("DISTANCE", new Suffix <ScalarValue>(GetDistance));
     AddSuffix("DIRECTION", new Suffix <Direction>(() => new Direction(GetPosition(), false)));
     AddSuffix("LATITUDE", new Suffix <ScalarValue>(() => PositionToLatitude(GetPosition())));
     AddSuffix("LONGITUDE", new Suffix <ScalarValue>(() => PositionToLongitude(GetPosition())));
     AddSuffix("ALTITUDE", new Suffix <ScalarValue>(() => PositionToAltitude(GetPosition())));
     AddSuffix("GEOPOSITION", new Suffix <GeoCoordinates>(() => new GeoCoordinates(this, Shared)));
     AddSuffix("PATCHES", new Suffix <ListValue>(BuildPatchList));
 }