diff --git a/GameData/ProceduralFairings/Parts/Payload/fairing_sides.cfg b/GameData/ProceduralFairings/Parts/Payload/fairing_sides.cfg index 302e86b..5d6909c 100644 --- a/GameData/ProceduralFairings/Parts/Payload/fairing_sides.cfg +++ b/GameData/ProceduralFairings/Parts/Payload/fairing_sides.cfg @@ -51,7 +51,6 @@ PART usePreset = true shapePreset = Egg - density = 0.1 decouplerCostMult = 1 costPerTonne = 5000 specificBreakingForce = 2000 diff --git a/Source/ProceduralFairings/FairingSide.cs b/Source/ProceduralFairings/FairingSide.cs index d9e4c35..e52ca46 100644 --- a/Source/ProceduralFairings/FairingSide.cs +++ b/Source/ProceduralFairings/FairingSide.cs @@ -16,7 +16,9 @@ namespace Keramzit { public class ProceduralFairingSide : PartModule, IPartCostModifier, IPartMassModifier { + private static readonly Dictionary AllPresets = new Dictionary(); internal ColliderPool colliderPool; + [KSPField] public float minBaseConeAngle = 20; [KSPField] public float colliderShaveAngle = 5; [KSPField] public Vector4 baseConeShape = new Vector4(0, 0, 0, 0); @@ -52,7 +54,7 @@ public class ProceduralFairingSide : PartModule, IPartCostModifier, IPartMassMod [KSPField(isPersistant = true, guiActiveEditor = true, guiName = "Density", groupName = PFUtils.PAWGroup, groupDisplayName = PFUtils.PAWName)] [UI_FloatRange(minValue = 0.01f, maxValue = 1.0f, stepIncrement = 0.01f)] - public float density = 0.2f; + public float density = -1f; [KSPField] public float minDensity = 0.01f; [KSPField] public float maxDensity = 1.0f; @@ -136,6 +138,7 @@ public class ProceduralFairingSide : PartModule, IPartCostModifier, IPartMassMod [KSPField] public float hingeCostBase = 0; // Flat additional cost when hinge is enabled [KSPField] public float hingeMassMult = 1; // Mass multiplier [KSPField] public float hingeMassBase = 0.0001f; // Flat additional mass (0.001 = 1kg) + public ModifierChangeWhen GetModuleCostChangeWhen() => ModifierChangeWhen.FIXED; public ModifierChangeWhen GetModuleMassChangeWhen() => ModifierChangeWhen.FIXED; public float GetModuleCost(float defcost, ModifierStagingSituation sit) => ApplyModuleCostModifier(fairingMass * costPerTonne) - defcost; @@ -148,7 +151,6 @@ public class ProceduralFairingSide : PartModule, IPartCostModifier, IPartMassMod private float totalCostBase => (DecouplerEnabled ? decouplerCostBase : 0) + (hingeEnabled ? hingeCostBase : 0); private float totalMassMult => (DecouplerEnabled ? decouplerMassMult : 1) * (hingeEnabled ? hingeMassMult : 1); private float totalMassBase => (DecouplerEnabled ? decouplerMassBase : 0) + (hingeEnabled ? hingeMassBase : 0); - private static readonly Dictionary AllPresets = new Dictionary(); [KSPEvent(active = true, guiActiveEditor = true, groupName = PFUtils.PAWGroup, guiName = "Toggle Open/Closed")] public void ToggleOpenClosed() @@ -199,6 +201,11 @@ public override void OnLoad(ConfigNode node) public override void OnStart(StartState state) { + if (HighLogic.LoadedSceneIsEditor && density == -1f) + { + density = minDensity; + } + HingeAnimation = part.FindModuleImplementing(); colliderPool = new ColliderPool(part.FindModelComponent("model"));