Exemple #1
0
 public static void DestroyJoint(Part.Joint jointToDestroy, bool disablePartToPartDamage)
 {
     jointToDestroy.fromPart.joints.Remove(jointToDestroy);
     jointToDestroy.toPart.joints.Remove(jointToDestroy);
     jointToDestroy.fromPart.UpdateConnected();
     jointToDestroy.toPart.UpdateConnected();
     jointToDestroy.fromPart.vessel.partsManager.UpdatePartsGruping(disablePartToPartDamage, jointToDestroy.fromPart.vessel);
 }
Exemple #2
0
 public static int GetToPartIndex(Part.Joint joint, List <Part> parts)
 {
     for (int i = 0; i < parts.Count; i++)
     {
         if (parts[i] == joint.toPart)
         {
             return(i);
         }
     }
     return(-1);
 }
Exemple #3
0
 public void TransferJoints(int transferSurfaceId, Part transferToPart, int toSurfaceId)
 {
     for (int i = 0; i < this.part.joints.Count; i++)
     {
         Part.Joint joint = this.part.joints[i];
         bool       flag  = joint.fromPart == this.part;
         if (((!flag) ? joint.toSurfaceIndex : joint.fromSurfaceIndex) == transferSurfaceId)
         {
             if (flag)
             {
                 joint.fromPart         = transferToPart;
                 joint.fromSurfaceIndex = toSurfaceId;
             }
             else
             {
                 joint.toPart         = transferToPart;
                 joint.toSurfaceIndex = toSurfaceId;
             }
             transferToPart.joints.Add(joint);
             this.part.joints.RemoveAt(i);
             i--;
         }
     }
 }