Esempio n. 1
0
        void Awake()
        {
            windVectorWS = Vector3.zero;

            check_settings();
            //Initialize weather api
            _wx_api = new weather_api();

            //Register with FAR
            haveFAR = CheckFAR();

            //Initialize vel data
            for (int i = 0; i < nvars; i++)
            {
                vel_list.Add(0);
            }

            //Initialize Wx list 2D
            for (int i = 0; i < nsvars + 2; i++)
            {
                wx_list2d.Add(0);
            }

            //Initialize Wx list 3D
            for (int i = 0; i < nvars + 1; i++)
            {
                wx_list3d.Add(0);
            }
        }
        void Start()
        {
            //Check if KWP is enabled by default
            wx_enabled = HighLogic.CurrentGame.Parameters.CustomParams <KerbalWxCustomParams>().WxEnabled;
            //Util.Log("MFI: wx_enabled: " + wx_enabled);
            //Determine MPAS data set
            use_climo = Util.useCLIM();
            use_point = Util.useWX();
            aero      = Util.allowAero();
            thermo    = Util.allowThermo();

            //Check if FAR is available
            haveFAR = RegisterWithFAR();
            //Get instance of climate api
            _clim_api = new climate_api();
            _wx_api   = new weather_api();

            _clim_wx  = new KerbalWxClimo();
            _point_wx = new KerbalWxPoint();

            if (!haveFAR)
            {
                Vessel v = FlightGlobals.ActiveVessel;

                //Override KSP's FlightIntegrator using the ModularFlightIntegrator
                Util.Log("Register Modular FlightIntegrator");
                if (aero)
                {
                    ModularFI.ModularFlightIntegrator.RegisterUpdateAerodynamicsOverride(UpdateAerodynamics);
                }
                if (thermo)
                {
                    ModularFI.ModularFlightIntegrator.RegisterUpdateThermodynamicsPre(UpdateThermodynamicsPre);
                }

                if ((aero) || (thermo))
                {
                    //Util.Log("MFI On");
                    Util.setMFI(true);
                }
            }
            GameObject.Destroy(this);
        }