private void doWeld(Part otherPort, SSTUWeldingDockingPort otherPortModule, Part otherWeld) { Part weld = getBasePart(); if (otherPort == null || otherPortModule == null || otherWeld == null || weld == null) { return; } AttachNode thisNode = weld.FindAttachNodeByPart(part); AttachNode otherNode = otherWeld.FindAttachNodeByPart(otherPort); decoupleFromBase(); otherPortModule.decoupleFromBase(); weld.Couple(otherWeld); setupPartAttachNodes(weld, otherWeld, thisNode, otherNode); //cleanup global data from all the changing of parts/etc FlightGlobals.ForceSetActiveVessel(weld.vessel); //if you don't de-activate the GUI it will null-ref because the active window belongs to one of the exploding parts below. UIPartActionController.Instance.Deactivate(); //but then we need to re-activate it to make sure that part-right clicking/etc doesn't break UIPartActionController.Instance.Activate(); //remove the welding docking ports //TODO find non-explosive way to do this? selfDestruct(); otherPortModule.selfDestruct(); }
private void doWeld(Part otherPort, SSTUWeldingDockingPort otherPortModule, Part otherWeld) { Part weld = getBasePart(); if (otherPort == null || otherPortModule == null || otherWeld == null || weld == null) { return; } decoupleFromBase(); otherPortModule.decoupleFromBase(); weld.Couple(otherWeld); //if you don't de-activate the GUI it will null-ref because the active window belongs to one of the exploding parts below. UIPartActionController.Instance.Deactivate(); //but then we need to re-activate it to make sure that part-right clicking/etc doesn't break UIPartActionController.Instance.Activate(); selfDestruct(); otherPortModule.selfDestruct(); }