コード例 #1
0
        public void Start()
        {
            animationStates = SetUpAnimation(animationName, this.part);
            //if (part.stagingIcon == "")
            //    part.stagingIcon = "DECOUPLER_HOR";

            List <ModuleDecouplerBase> decouplers = new List <ModuleDecouplerBase>();

            decouplers = this.GetComponents <ModuleDecouplerBase>().ToList();
            foreach (ModuleDecouplerBase d in decouplers)
            {
                if (d.explosiveNodeID == decouplerNodeID)
                {
                    decoupler = d;
                    decoupler.Actions["DecoupleAction"].active = false;
                    decoupler.Events["Decouple"].active        = false;
                    decoupler.Events["ToggleStaging"].active   = false;
                    if (HighLogic.LoadedSceneIsFlight && decoupler.ExplosiveNode.attachedPart != null)
                    {
                        animPosition = 0;
                        animSpeed    = 0;
                    }
                }
                else if (payloadDecouplerNodeID != "" && d.explosiveNodeID == payloadDecouplerNodeID)
                {
                    payloadDecoupler = d;
                    payloadDecoupler.Events["Decouple"].guiName             = "Decouple Payload";
                    payloadDecoupler.Actions["DecoupleAction"].guiName      = "Decouple Payload";
                    payloadDecoupler.Fields["ejectionForcePercent"].guiName = "Force Percent (Payload)";
                    if (HighLogic.LoadedSceneIsFlight)
                    {
                        payloadDecoupler.isEnabled = animPosition >= waitForAnimation;
                    }
                }
            }
            if (decoupler == null)
            {
                Debug.LogErrorFormat("[{0}] A '{1}' node decoupler was not found.", moduleID, decouplerNodeID);
            }
            if (payloadDecouplerNodeID != "" && payloadDecoupler == null)
            {
                Debug.LogErrorFormat("[{0}] A '{1}' node decoupler was not found.", moduleID, payloadDecouplerNodeID);
            }

            SetAnimation(animPosition, 0);
            if (animSpeed != 0)
            {
                PlayAnimation(animSpeed);
            }

            Events["Decouple"].active               = animPosition == 0;
            Events["Decouple"].guiName              = flightGUIName;
            Actions["DecoupleAction"].guiName       = flightGUIName;
            Events["ToggleAnimationEditor"].guiName = editorGUIName;
        }
コード例 #2
0
        private void RunVesselJointUpdateFunction(Vessel v)
        {
            if (KJRJointUtils.debug)
            {
                Debug.Log("KJR: Processing vessel " + v.id + " (" + v.GetName() + "); root " +
                          v.rootPart.partInfo.name + " (" + v.rootPart.flightID + ")");
            }

            bool bReinforced = false;

#if IncludeAnalyzer
            if (WindowManager.Instance.ReinforceExistingJoints)
            {
#endif

            foreach (Part p in v.Parts)
            {
                if (KJRJointUtils.reinforceAttachNodes)
                {
                    if ((p.parent != null) && (p.physicalSignificance == Part.PhysicalSignificance.FULL))
                    {
                        bReinforced = true;
                        ReinforceAttachJoints(p);
                    }
                }

                if (KJRJointUtils.reinforceDecouplersFurther)
                {
#if Compatible
                    if (p.parent && (p.children.Count > 0))
                    {
                        for (int i = 0; i < p.Modules.Count; i++)
                        {
                            if (KJRJointUtils.IsOfClass(p.Modules[i], ModuleDecoupleType))
                            {
                                if (!(bool)isDecoupledField.GetValue(p.Modules[i]))
                                {
                                    bReinforced = true;
                                    ReinforceDecouplers(p);
                                    goto continue_;
                                }
                            }
                        }
                    }
#endif

#if !Compatible
                    ModuleDecouplerBase d = p.GetComponent <ModuleDecouplerBase>();                    // FEHLER, wieso nicht auch ModuleDockingNode ??

                    if (p.parent && (p.children.Count > 0) && d && !d.isDecoupled)
                    {
                        bReinforced = true;
                        ReinforceDecouplers(p);
                        continue;
                    }
#endif
                }

                if (KJRJointUtils.reinforceLaunchClampsFurther)
                {
                    if (p.parent && p.GetComponent <LaunchClamp>())
                    {
                        ReinforceLaunchClamps(p);
                    }
                }
                continue_ :;
            }

#if IncludeAnalyzer
        }
#endif

            if (bReinforced && !updatedVessels.Contains(v))
            {
                updatedVessels.Add(v);
            }

            if (KJRJointUtils.reinforceAttachNodes && KJRJointUtils.multiPartAttachNodeReinforcement)
            {
                MultiPartJointTreeChildren(v);
            }
        }