Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix payload fairing thickness calculation #46

Merged
merged 2 commits into from
Aug 17, 2023

Conversation

FioraAeterna
Copy link

@FioraAeterna FioraAeterna commented Jun 25, 2023

When the middle of the payload fairing is wider than the base, fairing thickness was incorrectly calculated. This allowed players to effectively cheese the thickness by making the base arbitrarily small, allowing for arbitrarily thin fairings.

Now, the fairing thickness should be based on the maximum width of the fairing instead of the base.

A little bit of refactoring was required to make this work, since we need the scan data earlier to determine the correct payload fairing width.

Note to maintainers:

  1. I have not heavily tested this, just confirmed that it seems to do the right thing on a few of my rockets. Please at least look it over to make sure the code passes your smell test. I also only tested payload fairings.

  2. This will make some fairings heavier and more expensive than before. If this effect is too large, it may be worth revisiting the minimum thickness calculations. But do note, I did not actually change the thickness formula; I simply made it apply consistently.

  3. I had to refactor a few things to make this work (e.g. pre-calculating the scan to avoid doing it twice). If you don't like how I did it, please feel free to change the order of things.

Source/ProceduralFairings/FairingBase.cs Outdated Show resolved Hide resolved
Source/ProceduralFairings/FairingBase.cs Outdated Show resolved Hide resolved
Source/ProceduralFairings/FairingBase.cs Outdated Show resolved Hide resolved
Source/ProceduralFairings/FairingBase.cs Show resolved Hide resolved
@FioraAeterna
Copy link
Author

updated per comments above

@FioraAeterna
Copy link
Author

Looks like there might be some potential issues running this patch in flight scene; note to self to track those down.

@FioraAeterna
Copy link
Author

Okay, hopefully this should make it work without problems in flight as well

@@ -94,6 +94,8 @@ public enum BaseMode { Payload, Adapter, Plate, Other }
[KSPField] public float decouplerMassMult = 1; // Mass multiplier
[KSPField] public float decouplerMassBase = 0; // Flat additional mass (0.001 = 1kg)

[KSPField] public float maxFairingSize = 0; // the "real" maximum width of the fairing, the bulge in the middle
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs isPersistant = true for the field value to get saved into the craft file / sfs.

@NathanKell
Copy link
Member

Any updates on this?

@NathanKell
Copy link
Member

@FioraAeterna checking in again :)

When the middle of the payload fairing is wider than the base, fairing
thickness was incorrectly calculated. This allowed players to
effectively cheese the thickness by making the base arbitrarily small,
allowing for arbitrarily thin fairings.

Now, the fairing thickness should be based on the maximum width of the
fairing instead of the base.

A little bit of refactoring was required to make this work, since
we need the scan data earlier to determine the correct payload fairing
width.
@NathanKell
Copy link
Member

@siimav good to go?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants