void OnVesselGoOffRails(Vessel vess)
{
if (!fromSave || vessel.packed || (connectedPortInfo.module
&& connectedPortInfo.module.vessel.packed)) {
return;
}
// From save
if (headState == PlugState.Deployed && fromSave) {
KAS_Shared.DebugLog("OnVesselGoOffRails(Winch) Head deployed or docked and no cable joint"
+ " exist, re-deploy and set head position");
Deploy(delayPhysics: true);
KAS_Shared.SetPartLocalPosRotFrom(headTransform, this.part.transform,
headCurrentLocalPos, headCurrentLocalRot);
cableJointLength = cableRealLenght;
fromSave = false;
}
if (headState == PlugState.PlugUndocked && fromSave) {
KAS_Shared.DebugLog("OnVesselGoOffRails(Winch) From save, Plug (undocked) to : {0}",
connectedPortInfo.module.part.partInfo.title);
PlugHead(connectedPortInfo.module, PlugState.PlugUndocked, true, false);
fromSave = false;
}
if (headState == PlugState.PlugDocked && fromSave) {
KAS_Shared.DebugLog("OnVesselGoOffRails(Winch) From save, Plug (docked) to : {0}",
connectedPortInfo.module.part.partInfo.title);
PlugHead(connectedPortInfo.module, PlugState.PlugDocked, true, false, true);
fromSave = false;
}
// Just in case
fromSave = false;
}