Exemple #1
0
    public void UpdatePartsGruping(bool disablePartToPartDamage, Vessel vessel)
    {
        bool flag = this.parts.Count > 0 && this.parts[0] != null && this.parts[0].gameObject.activeSelf;

        if (flag)
        {
            this.ResetsParts();
            List <Part> list = new List <Part>(this.parts);
            this.GetConnectedParts(this.parts[0], vessel);
            List <Part> list2 = new List <Part>();
            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].vessel == null)
                {
                    list2.Add(list[i]);
                }
            }
            List <Vessel> list3 = Ref.controller.CreateVesselsFromParts(list2, this.rb2d.velocity, this.rb2d.angularVelocity, vessel.throttle, vessel.vesselAchievements);
            if (Ref.mainVessel == vessel)
            {
                Ref.controller.RepositionFuelIcons();
            }
            if (disablePartToPartDamage)
            {
                this.DisablePartToPartDamage(0.1f);
                for (int j = 0; j < list3.Count; j++)
                {
                    list3[j].partsManager.DisablePartToPartDamage(0.1f);
                }
            }
        }
        else
        {
            vessel.DisasembleVessel();
        }
    }