public void CreateAiNonAtcAircraft(string szContainerTitle, SIMCONNECT_DATA_INITPOSITION initPos, uint request)
 {
     if (simConnect == null)
     {
         return;
     }
     simConnect.AICreateNonATCAircraft(szContainerTitle, "N123", initPos, (REQUEST)request);
 }
Beispiel #2
0
        private void buttonCreateAIObjects_Click(object sender, EventArgs e)
        {
            SIMCONNECT_DATA_INITPOSITION Init;

            // Add a parked museum aircraft, just west of the runway

            Init.Altitude  = 433.0;                     // Altitude of Sea-tac is 433 feet
            Init.Latitude  = 47 + (25.97 / 60);         // Convert from 47 25.97 N
            Init.Longitude = -122 - (18.51 / 60);       // Convert from 122 18.51 W
            Init.Pitch     = 0.0;
            Init.Bank      = 0.0;
            Init.Heading   = 90.0;
            Init.OnGround  = 1;
            Init.Airspeed  = 0;
            simconnect.AICreateSimulatedObject("Mooney Bravo", Init, DATA_REQUESTS.REQUEST_MOONEY);

            // Initialize Maule M7 aircraft just in front of user aircraft, at 47 25.89 N, 122 18.48 W

            Init.Altitude  = 433.0;                     // Altitude of Sea-tac is 433 feet
            Init.Latitude  = 47 + (25.91 / 60);         // Convert from 47 25.90 N
            Init.Longitude = -122 - (18.48 / 60);       // Convert from 122 18.48 W
            Init.Pitch     = 0.0;
            Init.Bank      = 0.0;
            Init.Heading   = 360.0;
            Init.OnGround  = 1;
            Init.Airspeed  = 1;

            simconnect.AICreateNonATCAircraft("Maule M7 260C paint2", "N1001", Init, DATA_REQUESTS.REQUEST_MAULE);

            // Initialize truck just in front of user aircraft
            // User aircraft is at 47 25.89 N, 122 18.48 W

            Init.Altitude  = 433.0;                     // Altitude of Sea-tac is 433 feet
            Init.Latitude  = 47 + (25.91 / 60);         // Convert from 47 25.90 N
            Init.Longitude = -122 - (18.47 / 60);       // Convert from 122 18.48 W
            Init.Pitch     = 0.0;
            Init.Bank      = 0.0;
            Init.Heading   = 360.0;
            Init.OnGround  = 1;
            Init.Airspeed  = 0;

            simconnect.AICreateSimulatedObject("VEH_jetTruck", Init, DATA_REQUESTS.REQUEST_TRUCK);

            displayText("Request to create objects sent...");
            setButtons(false, false, true, true, true);
        }
Beispiel #3
0
        public uint Spawn(string aircraftTitle, AircraftPositionStruct position)
        {
            var requestID = DATA_REQUESTS.AI_SPAWN + requestCount;

            requestCount = (requestCount + 1) % 10000;
            lock (lockObj)
            {
                logger.LogDebug("Spawing new aircraft. Request ID {requestId}.", (uint)requestID);
                simconnect?.AICreateNonATCAircraft(aircraftTitle, "REPLAY", new SIMCONNECT_DATA_INITPOSITION
                {
                    Latitude  = position.Latitude,
                    Longitude = position.Longitude,
                    Altitude  = position.Altitude,
                    Pitch     = position.Pitch,
                    Bank      = position.Bank,
                    Heading   = position.TrueHeading,
                    OnGround  = position.IsOnGround,
                    Airspeed  = 0
                }, requestID);
            }
            return((uint)requestID);
        }