示例#1
0
        /// <summary>
        /// This is the combined FuelStackSearch and FuelStackReSearch. It should be a bit more reliable as well as preventing me from updating one segment of code and not the other (which would likley lead to autonomus explosions)
        /// So this sub basically finds all the valid fuel sources for the booster segment, it should work fine.
        /// </summary>
        /// <param name="pl"></param>
        public void FuelStackSearcher(System.Collections.Generic.List<Part> pl)
        {
            fullStackFuelMass = 0;

            pl.Clear();
            i = 0;
            bEndofFuelSearch = false;

            p = this.part;
            AttachNode n = new AttachNode();

            AdvSRBSegment SRB = new AdvSRBSegment();

            p = this.part;
            n = p.findAttachNode(topNode);

            if (p.Modules.Contains("AdvSRBSegment"))
            {
                if (pl.Contains(p) != true)
                {
                    pl.Add(p);

                    p.GetComponent<AdvSRBSegment>().startLoadedFuelMass = p.GetComponent<AdvSRBSegment>().calcStartFuelLoadMass(resourceName);

                    fullStackFuelMass += p.GetComponent<AdvSRBSegment>().startLoadedFuelMass;
                }

                SRB = p.GetComponent<AdvSRBSegment>();

                if (SRB.endOfStack)
                    goto Leave;
            }

            do
            {
                if (n.attachedPart.Modules.Contains("AdvSRBSegment"))
                {
                    p = n.attachedPart;

                    if (pl.Contains(p) != true)
                    {
                        pl.Add(p);

                        p.GetComponent<AdvSRBSegment>().startLoadedFuelMass = p.GetComponent<AdvSRBSegment>().calcStartFuelLoadMass(resourceName);

                        fullStackFuelMass += p.GetComponent<AdvSRBSegment>().startLoadedFuelMass;
                    }

                    SRB = p.GetComponent<AdvSRBSegment>();

                    if (SRB.endOfStack != true)
                    {
                        foreach (AttachNode k in p.attachNodes)
                        {
                            if (k.id == SRB.topNode)
                            {
                                n = k;
                                goto Finish;
                            }
                        }

                    Finish:

                        if (n.attachedPart == null)
                        {
                            bEndofFuelSearch = true;
                        }
                    }
                    else
                    {
                        bEndofFuelSearch = true;
                    }
                }
                else
                    bEndofFuelSearch = true;

                i += 1;

            } while (bEndofFuelSearch == false && i < 250);

            if (i == 250) //I hope to hell no one builds a rocket such that 250 iterations is restricting an otherwise valid design. Because damn.
            {
                print("SolidBoosterNozzle: Forced out of loop");
                print("SolidBoosterNozzle: Loop executed 250 times");
            }

            Leave:
            ;
        }
示例#2
0
 public void DrawGUIHeating(AdvSRBSegment s)
 {
 }