Exemplo n.º 1
0
        public void Start()
        {
            this.Log("KKController Start");
            //AYPresent = AYClient.AYInstalled;
            AYPresent = AssemblyLoader.loadedAssemblies.Any(a => a.assembly.GetName().Name == "AmpYear");

            this.Log("Checked for mods");
            if (AYPresent)
            {
                this.Log("AmpYear present");
                AYWrapper.InitAYWrapper();
                if (AYWrapper.APIReady)
                {
                    KabinKraziness.Instance.debugging = AYWrapper.AYactualAPI.DeBugging;
                }
                else
                {
                    this.Log("AmpYear NOT present or Failed to Initialize");
                    KabinKraziness.Instance.debugging = true;
                }
            }
            else
            {
                this.Log("AmpYear NOT present");
                KabinKraziness.Instance.debugging = true;
            }

            this.Log("KKController Start complete");
        }
Exemplo n.º 2
0
        private void FixedUpdate()
        {
            if (Time.timeSinceLevelLoad < 2.0f) // Check not loading level
            {
                return;
            }
            mode = Utilities.SetModeFlag();
            if (mode == GameState.EVA)
            {
                return;
            }

            if (HighLogic.LoadedSceneIsFlight && timewarpIsValid) // Only execute Update in Flight
            {
                if ((FlightGlobals.ready && FlightGlobals.ActiveVessel != null))
                {
                    //this.Log_Debug("KabinKraziness FixedUpdate mode == " + mode);
                    if (AYWrapper.APIReady)
                    {
                        for (int i = 0; i < AYWrapper.AYactualAPI.CrewablePartList.Count; i++)
                        {
                            var crewed_part = AYWrapper.AYactualAPI.CrewablePartList[i];
                            for (int j = 0; j < crewed_part.Modules.Count; j++)
                            {
                                if (crewed_part.Modules[j].moduleName == "KKCrewPart")
                                {
                                    if (mode == GameState.FLIGHT)
                                    {
                                        CalcPartCraziness(FlightGlobals.ActiveVessel, crewed_part, crewed_part.Modules[j],
                                                          TimeWarp.fixedDeltaTime);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        AYWrapper.InitAYWrapper();
                    }
                }
            }
        }