Inheritance: kOS.Suffixed.SpecialValue
        // Required for all IDumpers for them to work, but can't enforced by the interface because it's static:
        public static GeoCoordinates CreateFromDump(SafeSharedObjects shared, Dump d)
        {
            var newObj = new GeoCoordinates();

            newObj.Shared = (SharedObjects)shared;
            newObj.LoadDump(d);
            return(newObj);
        }
Example #2
0
        public override void Execute(SharedObjects shared)
        {
            double longitude = GetDouble(shared.Cpu.PopValue());
            double latitude = GetDouble(shared.Cpu.PopValue());

            var result = new GeoCoordinates(shared, latitude, longitude);
            shared.Cpu.PushStack(result);
        }
Example #3
0
        /// <summary>
        /// Interpret the vector given as a 3D position, and return the altitude above terrain unless
        /// that terrain is below sea level on a world that has a sea, in which case return the sea
        /// level atitude instead, similar to how radar altitude is displayed to the player.
        /// </summary>
        /// <param name="position"></param>
        /// <returns></returns>
        public ScalarValue RadarAltitudeFromPosition(Vector position)
        {
            GeoCoordinates geo           = GeoCoordinatesFromPosition(position);
            ScalarValue    terrainHeight = geo.GetTerrainAltitude();
            ScalarValue    seaAlt        = AltitudeFromPosition(position);

            if (Body.ocean && terrainHeight < 0)
            {
                return(seaAlt);
            }
            else
            {
                return(seaAlt - terrainHeight);
            }
        }
Example #4
0
        public override void Execute(SharedObjects shared)
        {
            double longitude = GetDouble(PopValueAssert(shared));
            double latitude = GetDouble(PopValueAssert(shared));
            AssertArgBottomAndConsume(shared);

            var result = new GeoCoordinates(shared, latitude, longitude);
            ReturnValue = result;
        }
Example #5
0
        public ScalarValue BuildSeaLevelAltitude()
        {
            GeoCoordinates gCoord = BuildGeoCoordinates();

            return(gCoord.GetTerrainAltitude() + WrappedWaypoint.altitude);
        }
Example #6
0
        public double BuildSeaLevelAltitude()
        {
            GeoCoordinates gCoord = BuildGeoCoordinates();

            return(gCoord.GetTerrainAltitude() + WayPoint.altitude);
        }
Example #7
0
File: Addon.cs Project: KSP-KOS/KOS
 private void SetTarget(GeoCoordinates target)
 {
     if (shared.Vessel != FlightGlobals.ActiveVessel)
     {
         throw new KOSException("You may only call addons:TR:setTarget from the active vessel. Always check addons:tr:hasImpact");
     }
     if (Available())
     {
         TRWrapper.SetTarget(target.Latitude, target.Longitude, target.GetTerrainAltitude());
     }
     else
     {
         throw new KOSUnavailableAddonException("SETTARGET", "Trajectories");
     }
 }