void GetOtherPart(IStageSeparator separator, ConnectedPartSet cp) { AttachNode node = null; if (separator is ModuleAnchoredDecoupler) { node = (separator as ModuleAnchoredDecoupler).ExplosiveNode; } else if (separator is ModuleDecouple) { node = (separator as ModuleDecouple).ExplosiveNode; } else if (separator is ModuleDockingNode) { // if referenceNode.attachedPart is not null, then the port // was attached in the editor and may be separated later, // otherwise, need to check for the port having been docked. // if referenceNode itself is null, then the port cannot be // docked in the editor (eg, inline docking port) var port = separator as ModuleDockingNode; Part otherPart = null; if (partMap.TryGetValue(port.dockedPartUId, out otherPart)) { if (port.vesselInfo != null) { var vi = port.vesselInfo; cp.Add(otherPart, vi.name); return; } } node = port.referenceNode; if (node == null) { //Debug.LogFormat ("[RMResourceManager] docking port null"); return; } } if (node == null) { // separators detach on both ends (and all surface attachments?) // and thus don't keep track of the node(s), so return the parent Part p = (separator as PartModule).part; if (p.parent != null) { cp.Add(p.parent, "separator"); } return; } if (node.attachedPart != null) { cp.Add(node.attachedPart, "decoupler"); } }
void GetOtherPart(ModuleGrappleNode grapple, ConnectedPartSet cp) { // The claw is a very unfriendly part. All the important fields // private. AttachNode grappleNode = (AttachNode)grappleNodeField.GetValue(grapple); if (grappleNode != null && grappleNode.attachedPart != null) { var vi = grapple.vesselInfo; cp.Add(grappleNode.attachedPart, vi.name); } }
void GetOtherPart(KASModuleStrut strut, ConnectedPartSet cp) { Part otherPart = null; if (partMap.TryGetValue(strut.dockedPartID, out otherPart)) { if (strut.vesselInfo != null) { var vi = strut.vesselInfo; cp.Add(otherPart, vi.name); } } }
void GetOtherPart(ELLaunchpad pad, ConnectedPartSet cp) { // no need to worry about something attached via a node as // hopefully that part is a decoupler of some sort, otherwise // the pad is probably unusable, and surface attached parts // don't matter too much, either. // if pad.control is ever null, bigger problems are afoot if (pad.control.craftRoot != null) { var vi = pad.control.vesselInfo; cp.Add(pad.control.craftRoot, vi.name); } }
void GetOtherPart(KASJointCableBase joint, ConnectedPartSet cp) { if (joint.isLinked) { var srcVessel = joint.linkSource.part.vessel; var dstVessel = joint.linkTarget.part.vessel; if (srcVessel == dstVessel && joint.persistedTgtVesselInfo != null) { cp.Add(joint.linkTarget.part, joint.persistedTgtVesselInfo.name); } } }