public void Deploy(bool delayPhysics = false)
{
KAS_Shared.DebugLog("Deploy(Winch) - Return head to original pos");
KAS_Shared.SetPartLocalPosRotFrom(
headTransform, this.part.transform, headOrgLocalPos, headOrgLocalRot);
SetHeadToPhysic(true, delayPhysics);
orgWinchMass = this.part.mass;
float newMass = this.part.mass - headMass;
if (newMass > 0) {
this.part.mass = newMass;
} else {
KAS_Shared.DebugWarning("Deploy(Winch) - Mass of the head is greater than the winch !");
}
KAS_Shared.DebugLog("Deploy(Winch) - Create spring joint");
cableJoint = this.part.gameObject.AddComponent<SpringJoint>();
cableJoint.connectedBody = headTransform.GetComponent<Rigidbody>();
cableJoint.maxDistance = 0;
cableJoint.minDistance = 0;
cableJoint.spring = cableSpring;
cableJoint.damper = cableDamper;
cableJoint.breakForce = 999;
cableJoint.breakTorque = 999;
cableJoint.anchor = winchAnchorNode.localPosition;
if (nodeConnectedPort) {
KAS_Shared.DebugLog("Deploy(Winch) - Connected port detected, plug head in docked mode...");
nodeConnectedPort.nodeConnectedPart = null;
PlugHead(nodeConnectedPort, PlugState.PlugDocked, alreadyDocked: true);
} else {
KAS_Shared.DebugLog("Deploy(Winch) - Deploy connector only...");
headState = PlugState.Deployed;
}
nodeConnectedPort = null;
KAS_Shared.DebugLog("Deploy(Winch) - Enable tube renderer");
SetTubeRenderer(true);
}