Skip to content

Commit

Permalink
Add height and diameter fields to fairing side
Browse files Browse the repository at this point in the history
  • Loading branch information
siimav committed Jun 3, 2024
1 parent dbf0f01 commit 6545fe1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Source/ProceduralFairings/FairingSide.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ public class ProceduralFairingSide : PartModule, IPartCostModifier, IPartMassMod
[UI_Toggle(disabledText = "Disabled", enabledText = "Enabled", affectSymCounterparts = UI_Scene.All)]
public bool hingeEnabled = false;

[KSPField] public float diameter;
[KSPField] public float height;
[KSPField] public float decouplerCostMult = 1; // Mult to costPerTonne when decoupler is enabled
[KSPField] public float decouplerCostBase = 0; // Flat additional cost when decoupler is enabled
[KSPField] public float decouplerMassMult = 1; // Mass multiplier
Expand Down Expand Up @@ -523,8 +525,10 @@ private void BuildColliderRow(Vector3 p, Vector3 cp, Vector3 normal, Vector3 siz
}
}

private void UpdatePartParameters(double area)
private void UpdatePartParameters(double area, float topY)
{
diameter = (Math.Max(baseRad, maxRad) + sideThickness) * 2f;
height = inlineHeight > 0 ? topY : topY + sideThickness;
float volume = Convert.ToSingle(area * sideThickness);
fairingMass = volume * density;
float totalMass = ApplyModuleMassModifier(fairingMass);
Expand Down Expand Up @@ -633,7 +637,7 @@ public void rebuildMesh(bool updateDragCubes = true)
}
area *= Mathf.PI / numSideParts;

UpdatePartParameters(area);
UpdatePartParameters(area, topY);
UpdateMassAndCostDisplay();

float anglePerPart = 360f / numSideParts;
Expand Down

0 comments on commit 6545fe1

Please sign in to comment.