/// <summary>
        /// Removes the vessel from the dictionaries
        /// </summary>
        private void RemoveVesselFromSystem(Vessel vesselToRemove)
        {
            try
            {
                vesselToRemove.OnFlyByWire -= FlyByWireDictionary[vesselToRemove.id];
            }
            catch (Exception)
            {
                // ignored
            }

            FlyByWireDictionary.Remove(vesselToRemove.id);
            FlightStatesDictionary.TryRemove(vesselToRemove.id, out _);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Removes the vessel from the dictionaries
        /// </summary>
        public void RemoveVesselFromSystem(Vessel vesselToRemove)
        {
            if (vesselToRemove == null)
            {
                return;
            }

            try
            {
                vesselToRemove.OnFlyByWire -= FlyByWireDictionary[vesselToRemove.id];
            }
            catch (Exception)
            {
                // ignored
            }

            if (FlyByWireDictionary.ContainsKey(vesselToRemove.id))
            {
                FlyByWireDictionary.Remove(vesselToRemove.id);
            }
            FlightStatesDictionary.TryRemove(vesselToRemove.id, out _);
        }