Ejemplo n.º 1
0
 void  zAwake()
 {
     GetSymList();
     defaultCrossfeedType = CrossfeedType;
     SetCrossfeedType(CrossfeedType);
     //Log.Info("zAwake, CrossfeedType: " + CrossfeedType + "   crossfeedToggleModule.crossfeedStatus: " + crossfeedToggleModule.crossfeedStatus);
 }
Ejemplo n.º 2
0
 public void ToggleBiDirectional()
 {
     Log.Info("CrossfeedType: " + CrossfeedType);
     CrossfeedType++;
     if (CrossfeedType > FuelFlowtype.uniDirectional)
     {
         CrossfeedType = FuelFlowtype.none;
     }
     //SetCrossfeedType(CrossfeedType);
     for (int i = 0; i < radialSymParts.Count; i++)
     {
         radialSymParts[i].SetCrossfeedType(CrossfeedType);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// run whenever part is created (used in editor), which in the editor is as soon as part list is clicked or symmetry count increases
        /// </summary>
        void Start()
        {
            crossfeedToggleModule = part.FindModuleImplementing <ModuleToggleCrossfeed>();
            if (crossfeedToggleModule == null)
            {
                Log.Info("Missing ModuleToggleCrossfeed in part: " + this.part.partInfo.title);

                Events["ToggleBiDirectional"].active          = false;
                Events["ToggleBiDirectional"].guiActive       = false;
                Events["ToggleBiDirectional"].guiActiveEditor = false;
                return;
            }
            isActive = true;
            if (crossfeedToggleModule.crossfeedStatus)
            {
                crossfeedToggleModule.ToggleEvent();
            }
            GameEvents.onEditorShipModified.Add(onEditorShipModified);
            GameEvents.onVesselWasModified.Add(onVesselWasModified);

#if true
            crossfeedToggleModule.Events["ToggleEvent"].guiActive = false;
            crossfeedToggleModule.Events["ToggleEvent"].active    = false;
            crossfeedToggleModule.Actions["ToggleAction"].active  = false;
            crossfeedToggleModule.Actions["EnableAction"].active  = false;
            crossfeedToggleModule.Actions["DisableAction"].active = false;
#endif

            if (!HighLogic.LoadedSceneIsEditor)
            {
                return;
            }

            zAwake();
            this.part.OnEditorAttach += new Callback(UpdateOnEditorAttach);
            this.part.OnEditorDetach += new Callback(UpdateOnEditorDetach);

            if (base.part.partInfo == null || base.part.partInfo.partPrefab == null)
            {
                this.defaultCrossfeedType = FuelFlowtype.none;
            }

            if (!this.moduleIsEnabled)
            {
                CrossfeedType = defaultCrossfeedType;
            }
        }
Ejemplo n.º 4
0
        void SetCrossfeedType(FuelFlowtype newCrossfeedType)
        {
            CrossfeedType = newCrossfeedType;
            if (crossfeedToggleModule != null)
            {
                switch (newCrossfeedType)
                {
                case FuelFlowtype.none:
                    Events["ToggleBiDirectional"].guiName = "Crossfeed disabled";
                    if (crossfeedToggleModule.crossfeedStatus)
                    {
                        crossfeedToggleModule.ToggleEvent();
                    }
                    //crossfeedToggleModule.defaultCrossfeedStatus = false;

                    break;

                case FuelFlowtype.biDirectional:
                    Events["ToggleBiDirectional"].guiName = "Bi-Directional Crossfeed";
                    if (!crossfeedToggleModule.crossfeedStatus)
                    {
                        crossfeedToggleModule.ToggleEvent();
                    }
                    //crossfeedToggleModule.defaultCrossfeedStatus = true;

                    break;

                case FuelFlowtype.uniDirectional:
                    Events["ToggleBiDirectional"].guiName = "UniDirectional Crossfeed";
                    if (!crossfeedToggleModule.crossfeedStatus)
                    {
                        crossfeedToggleModule.ToggleEvent();
                    }
                    //crossfeedToggleModule.defaultCrossfeedStatus = true;

                    break;
                }
            }
            //else
            //    Log.Error("Part: " + this.part.partInfo.title + " missing crossfeedToggleModule");
        }