public void Lock()
{
if (cableJoint) {
KAS_Shared.DebugLog("Lock(Winch) Removing spring joint");
Destroy(cableJoint);
}
KAS_Shared.SetPartLocalPosRotFrom(
headTransform, this.part.transform, headOrgLocalPos, headOrgLocalRot);
if (headState == PlugState.PlugDocked || headState == PlugState.PlugUndocked) {
KAS_Shared.DebugLog("Lock(Winch) Dock connected port");
// Save control state
Vessel originalVessel = this.vessel;
bool is_active = (FlightGlobals.ActiveVessel == this.vessel);
// Decouple and re-dock
KASModulePort tmpPortModule = connectedPortInfo.module;
UnplugHead(false);
KAS_Shared.MoveAlignLight(
tmpPortModule.part.vessel, tmpPortModule.portNode, part.vessel, headPortNode);
AttachDocked(tmpPortModule, originalVessel);
nodeConnectedPort = tmpPortModule;
tmpPortModule.nodeConnectedPart = this.part;
// Restore controls and focus
if (is_active) {
FlightGlobals.ForceSetActiveVessel(this.vessel);
FlightInputHandler.ResumeVesselCtrlState(this.vessel);
}
}
SetHeadToPhysic(false);
this.part.mass = orgWinchMass;
SetTubeRenderer(false);
motorSpeed = 0;
cableJoint = null;
headState = PlugState.Locked;
fxSndHeadLock.audio.Play();
}