Example #1
0
        private void OnPartAttach(GameEvents.HostTargetAction <Part, Part> hostTarget)
        {
            Part part = hostTarget.host;

            if ((EditorLogic.fetch.ship.parts.Count >= partCounter) &&
                (EditorLogic.fetch.ship.parts.Count != partCounter))
            {
                if ((partCounter != 1) && (EditorLogic.fetch.ship.parts.Count != 1))
                {
                    foreach (var p in part.GetChildServos())
                    {
                        AddServo(p);
                    }
                    partCounter = EditorLogic.fetch.ship.parts.Count;
                }
            }
            if ((EditorLogic.fetch.ship.parts.Count == 0) && (partCounter == 0))
            {
                if ((partCounter != 1) && (EditorLogic.fetch.ship.parts.Count != 1))
                {
                    foreach (var p in part.GetChildServos())
                    {
                        AddServo(p);
                    }
                    partCounter = EditorLogic.fetch.ship.parts.Count;
                }
            }

            Logger.Log("[ServoController] OnPartAttach finished successfully", Logger.Level.Debug);
        }
Example #2
0
        private void OnPartRemove(GameEvents.HostTargetAction <Part, Part> hostTarget)
        {
            Part part = hostTarget.target;

            try
            {
                var servos = part.ToServos();
                foreach (var temp in servos)
                {
                    temp.Mechanism.Reset();
                }
            }
            catch (Exception ex)
            {
                Logger.Log("[ServoController] OnPartRemove Error: " + ex, Logger.Level.Debug);
            }

            foreach (var p in part.GetChildServos())
            {
                RemoveServo(p);
            }
            partCounter = EditorLogic.fetch.ship.parts.Count == 1 ? 0 : EditorLogic.fetch.ship.parts.Count;

            Logger.Log("[ServoController] OnPartRemove finished successfully", Logger.Level.Debug);
        }
        // add experimental parts from stub inside the new research tech nodes
        // not really usefull, i think addExpParts do the trick himself
        private void refreshExperimentalParts(GameEvents.HostTargetAction <RDTech, RDTech.OperationResult> newResearch)
        {
            //MerillData.log(" refreshExperimentalParts NOde:  " + newResearch.ToString()
            //	+ ", " + newResearch.host.name + " is " + newResearch.target);
            //MerillData.log(" refreshExperimentalParts date accepted:  " + this.dateAccepted);

            //if (newResearch.target == RDTech.OperationResult.Successful)
            //{
            //	MerillData.log(" refreshExperimentalParts accepted :  " + newResearch.host.partsPurchased.Count);
            //}
            //MerillData.log(" refreshExperimentalParts Assigned");
            foreach (AvailablePart aPart in newResearch.host.partsAssigned)
            {
                if (aPart.partPrefab != null && aPart.partPrefab.Modules != null)
                {
                    //MerillData.log(" refreshExperimentalParts find part" + aPart.name);

                    foreach (PartModule pm in aPart.partPrefab.Modules)
                    {
                        //MerillData.log(" refreshExperimentalParts find pm " + pm.name + ", " + pm.moduleName);
                        if (pm.moduleName.Equals("MerillMissionStub"))
                        {
                            //MerillData.log(" refreshExperimentalParts find pmmoduleName on part for mission " + this.GetType().Name);
                            //MerillData.log(" refreshExperimentalParts find pmmoduleName on part for mission " + ((MerillMissionStub)pm).missionName);
                            if (((MerillMissionStub)pm).missionName.Equals(this.GetType().Name))
                            {
                                //MerillData.log(" refreshExperimentalParts READY TO ADD " + aPart.name);
                                //add it to this
                                addExperimentalPart(((MerillMissionStub)pm).partUnlock);
                            }
                        }
                    }
                }
            }
        }
        private void HandleEditorPartDetach(GameEvents.HostTargetAction <Part, Part> hostTargetAction)
        {
            var partList = new List <Part> {
                hostTargetAction.target
            };

            foreach (var child in hostTargetAction.target.children)
            {
                child.RecursePartList(partList);
            }
            var movedModules = (from p in partList
                                where p.Modules.Contains(Config.Instance.ModuleName)
                                select p.Modules[Config.Instance.ModuleName] as ModuleActiveStrut).ToList();
            var movedTargets = (from p in partList
                                where p.Modules.Contains(Config.Instance.ModuleActiveStrutFreeAttachTarget)
                                select p.Modules[Config.Instance.ModuleActiveStrutFreeAttachTarget] as ModuleActiveStrutFreeAttachTarget)
                               .ToList();
            var vesselModules = (from p in Utilities.ListEditorParts(false)
                                 where p.Modules.Contains(Config.Instance.ModuleName)
                                 select p.Modules[Config.Instance.ModuleName] as ModuleActiveStrut).ToList();

            foreach (var module in movedModules)
            {
                module.Unlink();
            }
            foreach (var module in vesselModules.Where(module =>
                                                       (module.Target != null && movedModules.Any(m => m.ID == module.Target.ID) ||
                                                        (module.Targeter != null && movedModules.Any(m => m.ID == module.Targeter.ID))) ||
                                                       (module.IsFreeAttached && !module.StraightOutAttachAppliedInEditor &&
                                                        movedTargets.Any(t => t.ID == module.FreeAttachTarget.ID))))
            {
                module.Unlink();
            }
        }
        //private void HandleEvaStart(GameEvents.FromToAction<Part, Part> data)
        //{
        //    this.StartCoroutine(this.AddModuleToEva(data));
        //}

        public void HandleFlightPartAttach(GameEvents.HostTargetAction <Part, Part> hostTargetAction)
        {
            try
            {
                if (!FlightGlobals.ActiveVessel.isEVA)
                {
                    return;
                }
                foreach (var module in hostTargetAction.target.GetComponentsInChildren <ModuleActiveStrut>())
                {
                    if (module.IsTargetOnly)
                    {
                        module.UnlinkAllConnectedTargeters();
                    }
                    else
                    {
                        module.Unlink();
                    }
                }
            }
            catch (NullReferenceException)
            {
                //thrown on launch, don't know why
            }
        }
Example #6
0
 private void OnPartAttach(GameEvents.HostTargetAction <Part, Part> hta)
 {
     if (HighLogic.LoadedScene == GameScenes.FLIGHT)
     {
         HandleVessel(hta.host.vessel);
     }
 }
Example #7
0
 private void onPartRemove(GameEvents.HostTargetAction <Part, Part> action)
 {
     if (!action.target.isEngine())
     {
         reset();
     }
 }
Example #8
0
        void TechResearched(GameEvents.HostTargetAction <RDTech, RDTech.OperationResult> data)
        {
            if (data.target != RDTech.OperationResult.Successful)
            {
                return;
            }

            // collect unique configure-related unlocks
            HashSet <string> labels = new HashSet <string>();

            foreach (AvailablePart p in PartLoader.LoadedPartsList)
            {
                foreach (Configure cfg in p.partPrefab.FindModulesImplementing <Configure>())
                {
                    foreach (ConfigureSetup setup in cfg.Setups())
                    {
                        if (setup.tech == data.host.techID)
                        {
                            labels.Add(Lib.BuildString(setup.name, " in ", cfg.title));
                        }
                    }
                }

                // add unique configure-related unlocks
                foreach (string label in labels)
                {
                    Message.Post
                    (
                        "<color=#00ffff><b>PROGRESS</b></color>\nOur scientists just made a breakthrough",
                        Lib.BuildString("We now have access to <b>", label, "</b>")
                    );
                }
            }
        }
Example #9
0
 void onPartAttach(GameEvents.HostTargetAction <Part, Part> host_target)
 {
     //Part p = host_target.host;
     //foreach (var servo in p.Modules.OfType<MuMechToggle>()) {
     //    add_servo(servo);
     //}
     //EditorLogic.fetch.ship.Parts.Count
     if ((EditorLogic.fetch.ship.parts.Count >= partCounter) && (EditorLogic.fetch.ship.parts.Count != partCounter))
     {
         Part part = host_target.host;
         if ((partCounter != 1) && (EditorLogic.fetch.ship.parts.Count != 1))
         {
             foreach (var p in part.GetComponentsInChildren <MuMechToggle>())
             {
                 add_servo(p);
             }
             partCounter = EditorLogic.fetch.ship.parts.Count;
         }
     }
     if ((EditorLogic.fetch.ship.parts.Count == 0) && (partCounter == 0))
     {
         Part part = host_target.host;
         if ((partCounter != 1) && (EditorLogic.fetch.ship.parts.Count != 1))
         {
             foreach (var p in part.GetComponentsInChildren <MuMechToggle>())
             {
                 add_servo(p);
             }
             partCounter = EditorLogic.fetch.ship.parts.Count;
         }
     }
 }
 // Remove experimental parts when a tech is researched
 private void OnTechResearched(GameEvents.HostTargetAction <RDTech, RDTech.OperationResult> hta)
 {
     foreach (AvailablePart p in hta.host.partsAssigned)
     {
         ResearchAndDevelopment.RemoveExperimentalPart(p);
     }
 }
        protected void OnVesselAssociation(GameEvents.HostTargetAction <Vessel, string> hta)
        {
            // If it's the tracked vessel
            if (define == hta.target)
            {
                if (trackedVessel != hta.host)
                {
                    // It's the new tracked vessel
                    trackedVessel     = hta.host;
                    trackedVesselGuid = hta.host.id;

                    // Try it out
                    UpdateState(hta.host);
                }
            }
            // If it's a vessel we're looking for
            else if (vesselList.Contains(hta.target))
            {
                // Try it out
                UpdateState(hta.host);

                // Potentially force a title update
                GetTitle();
            }
        }
Example #12
0
        public void TechUnlockEvent(GameEvents.HostTargetAction <RDTech, RDTech.OperationResult> ev)
        {
            if (!KCT_GameStates.settings.enabledForSave)
            {
                return;
            }
            if (ev.target == RDTech.OperationResult.Successful)
            {
                KCT_TechItem tech = new KCT_TechItem(ev.host);
                if (!KCT_GameStates.settings.InstantTechUnlock && !KCT_GameStates.settings.DisableBuildTime)
                {
                    tech.DisableTech();
                }
                if (!tech.isInList())
                {
                    ++KCT_GameStates.TotalUpgradePoints;
                    var message = new ScreenMessage("[KCT] Upgrade Point Added!", 4.0f, ScreenMessageStyle.UPPER_LEFT);
                    ScreenMessages.PostScreenMessage(message, true);

                    if (!KCT_GameStates.settings.InstantTechUnlock && !KCT_GameStates.settings.DisableBuildTime)
                    {
                        KCT_GameStates.TechList.Add(tech);
                        message = new ScreenMessage("[KCT] Node will unlock in " + KCT_Utilities.GetFormattedTime(tech.TimeLeft), 4.0f, ScreenMessageStyle.UPPER_LEFT);
                        ScreenMessages.PostScreenMessage(message, true);
                    }
                }
                else
                {
                    ResearchAndDevelopment.Instance.Science += tech.scienceCost;
                    var message = new ScreenMessage("[KCT] This node is already being researched!", 4.0f, ScreenMessageStyle.UPPER_LEFT);
                    ScreenMessages.PostScreenMessage(message, true);
                }
            }
        }
        protected void OnVesselDisassociation(GameEvents.HostTargetAction <Vessel, string> hta)
        {
            // If it's a vessel we're looking for, and it's tracked
            if (vesselList.Contains(hta.target) && define == hta.target)
            {
                waiting           = false;
                trackedVessel     = null;
                trackedVesselGuid = Guid.Empty;

                // Try out the active vessel
                UpdateState(FlightGlobals.ActiveVessel);

                // Active vessel didn't work out - force the children to be incomplete
                if (trackedVessel == null)
                {
                    SetChildState(null);

                    // Fire the parameter change event to account for all the changed child parameters.
                    // We don't fire it for the child parameters, as any with a failed state will cause
                    // the contract to fail, which we don't want.
                    ContractConfigurator.OnParameterChange.Fire(this.Root, this);

                    // Manually run the OnParameterStateChange
                    OnParameterStateChange(this);
                }
            }
        }
        protected override void OnPartAttach(GameEvents.HostTargetAction <Part, Part> e)
        {
            base.OnPartAttach(e);

            if (HighLogic.LoadedScene == GameScenes.EDITOR || e.host.vessel == null || e.target.vessel == null)
            {
                return;
            }

            LoggingUtil.LogVerbose(this, "OnPartAttach");
            Vessel v1 = null;
            Vessel v2 = null;

            if (Parent is VesselParameterGroup)
            {
                v1 = ((VesselParameterGroup)Parent).TrackedVessel ?? FlightGlobals.ActiveVessel;
                v2 = vessels.Count > 0 ? ContractVesselTracker.Instance.GetAssociatedVessel(vessels[0]) : null;

                // No vessel association
                if (vessels.Count > 0 && v2 == null)
                {
                    return;
                }
            }
            else
            {
                v1 = ContractVesselTracker.Instance.GetAssociatedVessel(vessels[0]);
                v2 = vessels.Count > 1 ? ContractVesselTracker.Instance.GetAssociatedVessel(vessels[1]) : null;

                // No vessel association
                if (v1 == null || vessels.Count > 1 && v2 == null)
                {
                    return;
                }
            }

            LoggingUtil.LogVerbose(this, "v1 = {0}", (v1 == null ? "null" : v1.id.ToString()));
            LoggingUtil.LogVerbose(this, "v2 = {1}", (v2 == null ? "null" : v2.id.ToString()));
            LoggingUtil.LogVerbose(this, "e.host.vessel = {0}", e.host.vessel.id.ToString());
            LoggingUtil.LogVerbose(this, "e.target.vessel = {0}", e.target.vessel.id.ToString());

            // Check for match
            bool forceStateChange = false;

            if (e.host.vessel == (v1 ?? e.host.vessel) && e.target.vessel == (v2 ?? e.target.vessel) ||
                e.host.vessel == (v2 ?? e.host.vessel) && e.target.vessel == (v1 ?? e.target.vessel))
            {
                LoggingUtil.LogVerbose(this, "Setting e.host.vessel to complete");
                forceStateChange |= SetState(e.host.vessel, ParameterState.Complete);

                LoggingUtil.LogVerbose(this, "Setting e.target.vessel to complete");
                forceStateChange |= SetState(e.target.vessel, ParameterState.Complete);

                dockedVessels[0] = e.host.vessel;
                dockedVessels[1] = e.target.vessel;
            }

            CheckVessel(FlightGlobals.ActiveVessel, forceStateChange);
        }
Example #15
0
 protected void OnVesselDisassociation(GameEvents.HostTargetAction <Vessel, string> hta)
 {
     // Force a title update if it's the vessel we're looking at
     if (vesselKey == hta.target)
     {
         GetTitle();
     }
 }
Example #16
0
 /// <summary>
 /// Reloads the collection of items that can used by kerbals.
 /// </summary>
 private void ItemRefresh(GameEvents.HostTargetAction <RDTech, RDTech.OperationResult> data)
 {
     if (data.target == RDTech.OperationResult.Successful)
     {
         $"Refreshing items due to new technologies".Debug();
         _items.RefreshItems();
     }
 }
Example #17
0
 private void onPartAttach(GameEvents.HostTargetAction <Part, Part> action)
 {
     if (Tools._debug == true)
     {
         Tools.LogFormatted("onPartAttach");
     }
     attachcounter = 1;
 }
 private void OnVesselDisassociation(GameEvents.HostTargetAction <Vessel, string> hta)
 {
     LoggingUtil.LogVerbose(this, "OnVesselDisassociation");
     if (vesselIdentifier != null && hta.target == vesselIdentifier.identifier)
     {
         // Force a call to GetTitle to update the contracts app
         GetTitle();
     }
 }
Example #19
0
 protected void OnVesselAssociation(GameEvents.HostTargetAction <Vessel, string> hta)
 {
     // If it's a vessel we're looking for
     if (vesselList.Contains(hta.target))
     {
         // Try it out
         UpdateState(hta.host);
     }
 }
Example #20
0
        public void onEditorVesselPartRemoved(GameEvents.HostTargetAction <Part, Part> p)
        {
            Utils.Log("Editor: Vessel PART REMOVE, recalculate all parts");
            if (!HighLogic.LoadedSceneIsEditor)
            {
                return;
            }

            RecalculateEditorShip(EditorLogic.fetch.ship);
        }
 private void OnPartRemoved(GameEvents.HostTargetAction <Part, Part> e)
 {
     if (this.symmetryEditorWindow.Visible)
     {
         if (PartWizard.IsSibling(e.target, this.symmetryEditorWindow.Part))
         {
             this.symmetryEditorWindow.Part = null;
         }
     }
 }
Example #22
0
 public void researchDone(GameEvents.HostTargetAction <RDTech, RDTech.OperationResult> research)
 {
     //obligé que l'on a changé de tech
     if (research.target == RDTech.OperationResult.Successful)
     {
         //allTechResearched.Add(research.host.title);
         allTechResearched.Add(research.host.techID);
         reloadAndUpgrade();
     }
 }
Example #23
0
        public void TechnologyResearched(GameEvents.HostTargetAction <RDTech, RDTech.OperationResult> data)
        {
            if (System.IgnoreEvents || data.target != RDTech.OperationResult.Successful)
            {
                return;
            }

            LunaLog.Log($"Relaying unlocked tech: {data.host.techID}");
            System.MessageSender.SendTechnologyMessage(data.host);
        }
        private void TechnologyResearched(GameEvents.HostTargetAction <RDTech, RDTech.OperationResult> Data)
        {
            if (Data.target == RDTech.OperationResult.Successful)
            {
//					_logger.Trace( "Callback: TechnologyResearched" );
                ScheduleExperimentUpdate(true);
            }
//				else
//					_logger.Trace( "Callback: Technology Research Failed" );
        }
Example #25
0
        public void TechUnlockEvent(GameEvents.HostTargetAction <RDTech, RDTech.OperationResult> ev)
        {
            const string logBlockName = nameof(KCTEvents) + "." + nameof(TechUnlockEvent);

            using (EntryExitLogger.EntryExitLog(logBlockName, EntryExitLoggerOptions.All))
            {
                //TODO: Check if any of the parts are experimental, if so, do the normal KCT stuff and then set them experimental again
                if (!KCT_PresetManager.Instance.ActivePreset.generalSettings.Enabled)
                {
                    return;
                }
                if (ev.target == RDTech.OperationResult.Successful)
                {
                    KCT_TechItem tech = new KCT_TechItem();
                    if (ev.host != null)
                    {
                        tech = new KCT_TechItem(ev.host);
                    }

                    foreach (AvailablePart expt in ev.host.partsPurchased)
                    {
                        if (ResearchAndDevelopment.IsExperimentalPart(expt))
                        {
                            GameStates.ExperimentalParts.Add(expt);
                        }
                    }

                    //if (!KCT_GameStates.settings.InstantTechUnlock && !KCT_GameStates.settings.DisableBuildTime) tech.DisableTech();
                    if (!tech.isInList())
                    {
                        if (KCT_PresetManager.Instance.ActivePreset.generalSettings.TechUpgrades)
                        {
                            ScreenMessages.PostScreenMessage("[KCT] Upgrade Point Added!", 4.0f, ScreenMessageStyle.UPPER_LEFT);
                        }

                        if (KCT_PresetManager.Instance.ActivePreset.generalSettings.TechUnlockTimes && KCT_PresetManager.Instance.ActivePreset.generalSettings.BuildTimes)
                        {
                            GameStates.TechList.Add(tech);
                            foreach (KCT_TechItem techItem in GameStates.TechList)
                            {
                                techItem.UpdateBuildRate(GameStates.TechList.IndexOf(techItem));
                            }
                            double timeLeft = tech.BuildRate > 0 ? tech.TimeLeft : tech.EstimatedTimeLeft;
                            ScreenMessages.PostScreenMessage("[KCT] Node will unlock in " + MagiCore.Utilities.GetFormattedTime(timeLeft), 4.0f, ScreenMessageStyle.UPPER_LEFT);
                        }
                    }
                    else
                    {
                        ResearchAndDevelopment.Instance.AddScience(tech.scienceCost, TransactionReasons.RnDTechResearch);
                        ScreenMessages.PostScreenMessage("[KCT] This node is already being researched!", 4.0f, ScreenMessageStyle.UPPER_LEFT);
                        ScreenMessages.PostScreenMessage("[KCT] It will unlock in " + MagiCore.Utilities.GetFormattedTime((GameStates.TechList.First(t => t.techID == ev.host.techID)).TimeLeft), 4.0f, ScreenMessageStyle.UPPER_LEFT);
                    }
                }
            }
        }
Example #26
0
        } // OnDestroy

        void onPartAttach(GameEvents.HostTargetAction <Part, Part> AttachedPart)
        {
            Debug.Log("SAFix.onPartAttach(): Host = " + AttachedPart.host.name + " |  Target = " + AttachedPart.target.name
                      + "  |  Symmetry Count = " + AttachedPart.host.symmetryCounterparts.Count);

            // If the target is the root part, attach the highlighter starting at the root.
            if (AttachedPart.target == EditorLogic.RootPart)
            {
                HighlighterHook(AttachedPart.target);
            }
            else
            {
                HighlighterHook(AttachedPart.host);
            }

            // Check if symmetry is set to 1x, and set default behavior according to SPH/VAB.
            if (0 == EditorLogic.fetch.symmetryMode)
            {
                // Debug.LogWarning("symmetryMode " + EditorLogic.fetch.symmetryMode);
                if (EditorDriver.editorFacility == EditorFacility.SPH)
                {
                    Debug.Log("SAFix.onPartAttach(): 1x symmetry in SPH detected. Mirror symmetry set.");
                    AttachedPart.host.symMethod = SymmetryMethod.Mirror;
                }
                else // EditorDriver.editorFacility == EditorFacility.VAB
                {
                    Debug.Log("SAFix.onPartAttach(): 1x symmetry in VAB detected. Radial symmetry set.");
                    AttachedPart.host.symMethod = SymmetryMethod.Radial;
                }
                return;
            }

            if (0 == AttachedPart.host.symmetryCounterparts.Count)
            {
                // This part has no symmetric siblings parts. No need to copy the action groups.
                return;
            }

            //if (null == AttachedPart.host.symmetryCounterparts[0].parent)
            //{
            //    // This part is the first part. No need to copy the action groups.
            //    // Debug.LogError("Null Parent 0");
            //    return;
            //}

            UpdatePartAndChildren(AttachedPart.host.symmetryCounterparts[0], AttachedPart.host,
                                  AttachedPart.host.symmetryCounterparts[0].symMethod);

            // This is needed because the editor logic will bug out if the symmetry multiplier is left at more than 8x.
            // Debug.Log("SAFix.onPartAttach(): symmetryMode = " + EditorLogic.fetch.symmetryMode);
            if (EditorLogic.fetch.symmetryMode > 7)
            {
                EditorLogic.fetch.symmetryMode = 7;
            }
        }
Example #27
0
        public void OnPartAttach(GameEvents.HostTargetAction <Part, Part> eventData)
        {
            PartType partType = GetPartType(eventData.host);

            if (partType == PartType.AirBreatherEngine || partType == PartType.Intake || partType == PartType.IntakeAndEngine)
            {
                eventData.host.AddOnMouseEnter(OnMouseEnter);
                eventData.host.AddOnMouseExit(OnMouseExit);
                Utils.DebugLog("Added events for part: {0}", eventData.host.name);
            }
        }
Example #28
0
        private void OnPartRemove(GameEvents.HostTargetAction <Part, Part> data)
        {
            // host is null, target is the child part.
            SendAsyncProxy <PartParentChanged>(this, data.target, new object[] { null });
            SendAsyncProxy <PartChildDetached>(this, data.target.parent, data.target);

            if (data.target.attachMode == AttachModes.SRF_ATTACH)
            {
                data.target.srfAttachNode.attachedPart = null;
            }
        }
Example #29
0
        void onPartRemove(GameEvents.HostTargetAction <Part, Part> host_target)
        {
            Part part = host_target.target;

            try
            {
                if (part.Modules.OfType <MuMechToggle>().Any())
                {
                    var temp = part.Modules.OfType <MuMechToggle>().First();

                    if (temp.rotateJoint)
                    {
                        if (!temp.part.name.Contains("IR.Rotatron.OffAxis"))
                        {
                            temp.part.transform.Find("model/" + temp.fixedMesh).Rotate(temp.rotateAxis, temp.rotation);
                            temp.rotation      = 0;
                            temp.rotationEuler = 0;
                        }
                    }
                    else if (temp.translateJoint)
                    {
                        temp.part.transform.Find("model/" + temp.fixedMesh).position = temp.part.transform.position;
                        temp.translation = 0;
                    }
                }
            }
            catch { }


            foreach (var p in part.GetComponentsInChildren <MuMechToggle>())
            {
                remove_servo(p);
            }
            if (EditorLogic.fetch.ship.parts.Count == 1)
            {
                partCounter = 0;
            }
            else
            {
                partCounter = EditorLogic.fetch.ship.parts.Count;
            }

            if (part.Modules.OfType <MuMechToggle>().Any())
            {
                var temp1 = part.Modules.OfType <MuMechToggle>().First();
                if (temp1.part.name.Contains("IR.Rotatron.OffAxis"))
                {
                    temp1.rotation      = 0;
                    temp1.rotationEuler = 0;
                    temp1.transform.Find("model/" + temp1.fixedMesh).eulerAngles = temp1.transform.eulerAngles;
                }
            }
        }
        private void refreshExperimentalParts(GameEvents.HostTargetAction <RDTech, RDTech.OperationResult> data)
        {
            if (data.host.partsPurchased.Contains(part.partInfo))
            {
                MerillData.log(" research done, and " + part.name + " is going to make an evolve on " + PartLoader.getPartInfoByName(initialPart));

                AvailablePart partToEvolve = PartLoader.getPartInfoByName(initialPart);
                if (partToEvolve != null && partToEvolve.partPrefab != null)
                {
                    evolve(partToEvolve);
                }
            }
        }