/// <summary>
 /// Updates the position and enable/disable status of the SSTUNodeFairing (if present). <para/>
 /// </summary>
 private void updateFairing(bool userInput)
 {
     SSTUNodeFairing fairing = part.GetComponent<SSTUNodeFairing>();
     if (fairing == null) { return; }
     bool enable = !currentMountData.modelDefinition.fairingDisabled;
     AttachNode node = part.FindAttachNode("top");
     // this was an attempt to fix fairing interaction between tanks and engines;
     // unfortunately it results in the engine fairing being permanently disabled
     // whenever it is mounted below a tank regardless of the tanks current fairing
     // status; rendering the fairings completely unusable for the engines even when
     // they are using a mount that should have fairings enabled.
     //if (node != null && node.attachedPart != null)
     //{
     //    Part p = node.attachedPart;
     //    SSTUNodeFairing[] fs = p.GetComponents<SSTUNodeFairing>();
     //    int len = fs.Length;
     //    for (int i = 0; i < len; i++)
     //    {
     //        //TODO find lowest node and check for that rather than static bottom reference ?
     //        if (fs[i].nodeName == "bottom" && fs[i].snapToSecondNode)//if it watches bottom node and is set to snap to second node; i.e. it would shroud this engine, so disable the engines' own shroud.
     //        {
     //            enable = false;
     //            break;
     //        }
     //    }
     //}
     fairing.canDisableInEditor = enable;
     FairingUpdateData data = new FairingUpdateData();
     data.setTopY(fairingTopY);
     data.setTopRadius(currentMountDiameter * 0.5f);
     if (userInput)
     {
         data.setBottomRadius(currentMountDiameter * 0.5f);
     }
     data.setEnable(enable);
     fairing.updateExternal(data);
 }
 private void updateFairing(bool userInput)
 {
     SSTUNodeFairing fairing = part.GetComponent<SSTUNodeFairing>();
     if (fairing == null) { return; }
     fairing.canDisableInEditor = true;
     FairingUpdateData data = new FairingUpdateData();
     data.setTopY(mainModelData.currentHeight * 0.5f);
     data.setTopRadius(currentDiameter * 0.5f);
     if (userInput)
     {
         data.setBottomRadius(currentDiameter * 0.5f);
     }
     data.setEnable(true);
     fairing.updateExternal(data);
 }
Пример #3
0
 public void updateExternal(FairingUpdateData data)
 {
     externalUpdateData = data;
 }
Пример #4
0
 private void updateFromExternalData(FairingUpdateData eData)
 {
     //MonoBehaviour.print("Updating fairing from external interaction ");
     if (fairingParts == null)
     {
         MonoBehaviour.print("ERROR: Fairing parts are null for external update");
     }
     foreach (SSTUNodeFairingData data in fairingParts)
     {
         if (eData.hasTopY && data.canAdjustTop)
         {
             if (eData.topY != data.topY)
             {
                 needsRebuilt = fairingCreated;
             }
             data.topY = eData.topY;
         }
         if (eData.hasBottomY && data.canAdjustBottom)
         {
             if (eData.bottomY != data.bottomY)
             {
                 needsRebuilt = fairingCreated;
             }
             data.bottomY = eData.bottomY;
         }
         if (eData.hasTopRad && data.canAdjustTop)
         {
             if (eData.topRadius != data.topRadius)
             {
                 needsRebuilt = fairingCreated;
             }
             data.topRadius = eData.topRadius;
             guiTopDiameter = data.topRadius * 2f;
             //MonoBehaviour.print("Set top rad: " + eData.topRadius);
         }
         if (eData.hasBottomRad && data.canAdjustBottom)
         {
             if (eData.bottomRadius != data.bottomRadius)
             {
                 needsRebuilt = fairingCreated;
             }
             data.bottomRadius = eData.bottomRadius;
             guiBottomDiameter = data.bottomRadius * 2f;
             // MonoBehaviour.print("Set bot rad: " + eData.bottomRadius);
         }
     }
     if (eData.hasEnable)
     {
         fairingForceDisabled = !eData.enable;
     }
     else
     {
         fairingForceDisabled = false;//default to NOT force disabled
     }
     if (fairingCreated && fairingForceDisabled)
     {
         needsRebuilt = false;
         destroyFairing();
     }
     else
     {
         needsStatusUpdate = true;
     }
     needsGuiUpdate     = true;
     externalUpdateData = null;
 }
Пример #5
0
 private void updateFromExternalData(FairingUpdateData eData)
 {
     if (fairingParts == null) { MonoBehaviour.print("ERROR: Fairing parts are null for external update"); }
     foreach (SSTUNodeFairingData data in fairingParts)
     {
         if (eData.hasTopY && data.canAdjustTop)
         {
             if (eData.topY != data.topY)
             {
                 needsRebuilt = true;
             }
             data.topY = eData.topY;
         }
         if (eData.hasBottomY && data.canAdjustBottom)
         {
             if (eData.bottomY != data.bottomY)
             {
                 needsRebuilt = true;
             }
             data.bottomY = eData.bottomY;
         }
         if (eData.hasTopRad && data.canAdjustTop)
         {
             if (eData.topRadius != data.topRadius)
             {
                 needsRebuilt = true;
             }
             data.topRadius = eData.topRadius;
         }
         if (eData.hasBottomRad && data.canAdjustBottom)
         {
             if (eData.bottomRadius != data.bottomRadius)
             {
                 needsRebuilt = true;
             }
             data.bottomRadius = eData.bottomRadius;
         }
     }
     if (eData.hasEnable)
     {
         fairingForceDisabled = !eData.enable;
     }
     else
     {
         fairingForceDisabled = false;//default to NOT force disabled
     }
     updateEditorFields(true);
     needsGuiUpdate = true;
     externalUpdateData = null;
 }
Пример #6
0
 public void updateExternal(FairingUpdateData data)
 {
     externalUpdateData = data;
 }