// You can set specific patches to false to disable them.
// It is recommended to do so using a ModuleManager patch.
// See the KSPCF_UserSettings.cfg.extra file in the "Extras" folder for an example.

KSP_COMMUNITY_FIXES
{
  // ##########################
  // Major bugfixes
  // ##########################
  
  // Vessel recovery funds properly account for modules implementing IPartCostModifier
  RefundingOnRecovery = true

  // Fix the whole kerbal inventory persistence system being inactive in 1.12.2
  // This cause multiple issues, like being able to bypass kerbal inventories mass/volume
  // limits, and various cargo part duplication / disappearance issues when EVAing / boarding.
  KerbalInventoryPersistence = true

  // Prevent unrecoverable part position drift of Breaking Grounds DLC robotic parts and their
  // children parts.
  RoboticsDrift = true

  // Multiple fixes for the KSP 1.12.3 docking port rotation feature, including rotation induced
  // part position drift.
  DockingPortRotationDriftAndFixes = true

  // Stock autostruts are creating joints between the parts at their current in-physics position, 
  // essentially "freezing" the current vessel deformation in place and making them fight against 
  // the regular part joints. This patch change the autostrut joints to target the vessel original 
  // pristine part positions instead. This improve the overall physics stability when using 
  // autostruts and prevent weird deformations following vessel modification events (decoupling, 
  // docking/undocking, fairing separation...)
  AutoStrutDrift = true

  // Prevent modules persisted state from being lost in existing saves/ships following
  // a mod installation/uninstallation/update
  ModuleIndexingMismatch = true

  // Fix part rotations not being reset to their pristine value when a non-landed is packed,
  // resulting in permanent part rotation drift when docking and other minor/cosmetic issues.
  PackedPartsRotation = true

  // Prevent potential order of execution issues during part initialization. 
  // This fixes the root cause of the "FlightSceneLoadKraken" issue (vessel deformation and kraken 
  // events on scene load) in a more consistent way, and also prevent similar kraken issues when 
  // placing parts with EVA construction.
  PartStartStability = true

  // ##########################
  // Minor bugfixes
  // ##########################

  // Fix the expanded/retracted state of Part Action Window groups being reset
  // when the PAW is internally rebuilt (especially frequent in the editor).
  PAWGroupMemory = true

  // Fix PAW item position randomly changing and flickering 
  PAWItemsOrder = true

  // Fix the kerbals tooltip giving wrong "Max sustainable G" information
  KerbalTooltipMaxSustainedG = true

  // Fix a bug causing the ROC manager to crash during loading with Kopernicus modified systems 
  ROCValidationOOR = true

  // Fix reaction wheels reporting incorrect available torque when the "Wheel Authority" 
  // tweakable is set below 100%. This fix instability issues with the stock SAS and other 
  // attitude controllers from various mods.
  ReactionWheelsPotentialTorque = true

  // Make the stock alarm to respect the day/year length defined by mods like
  // Kronometer. Fix the underlying AppUIMemberDateTime UI widget API to use the
  // custom IDateTimeFormatter if implemented.
  StockAlarmCustomFormatterDate = true

  // Stock alarm preserve line breaks (and tabs) in the description field
  StockAlarmDescPreserveLineBreak = true

  // Fix deployable parts (antennas, solar panels, radiators...) always starting in the extended 
  // state when the model isn't exported in the retracted state. Affect parts from various mods.
  ExtendedDeployableParts = true
  
  // Fix the delta V data (and info panels) on stage UI elements showing
  // when the delta V app and delta V calculations are disabled.
  // Also hide extended burn time info on the navball in this case, because
  // it depends on the stock delta V implementation.
  DeltaVHideWhenDisabled = true

  // Fixes an issue where if a vessel starts out splashed, and decouples from its only
  // splashed parts, it will never leave the splashed state.
  // This also fixes an issue where Splashed overrides Prelaunch as a Situation.
  StickySplashedFixer = true

  // Fix the asteroid/comet spawner generating non-unique Part.flightId identifiers. This has 
  // a few minor side effects in stock (mainly incorrect science bonuses), but this field is 
  // heavily relied upon by various mods and this can cause major issues for them.
  AsteroidSpawnerUniqueFlightId = true
  CometSpawnerUniqueFlightId = true

  // Fix editor tooltip part icons not spinning anymore after hovering on a greyed out surface
  // attachable only part while the editor is empty.
  PartListTooltipIconSpin = true

  // Fix a bunch of bugs with upgrades.
  // Fix upgrades breaking when a PartStatsUpgradeModule is present
  // and fix upgrades not applying properly in the editor
  // (This also fixes InitializeModules not being run on root parts)
  // Fix upgrade cost not being applied to part cost, partupgrades
  // not displaying their correct extended info (in the RnD screen),
  // FindUpgrades finding unlocked but disabled upgrades, UpgradesAvailable 
  // *applying* rather than just reporting about upgrades, and upgrade cost
  // not being added to part cost.
  UpgradeBugs = true

  // Fix applying upgrades directly to the prefab part
  // when creating the PartListTooltip
  // Note: REQUIRES UpgradeBugs to be enabled
  PartTooltipUpgradesApplyToSubstituteParts = false

  // Fix incorrect terrain scatter distribution when a partial longitude range is defined in the
  // PQSLandControl definition.
  ScatterDistribution = true

  // Fix audio source not being centered/aligned with the current vessel after scene switches,
  // causing loss of vessel effects audio and random volume or left/right channel weirdness.
  LostSoundAfterSceneSwitch = true

  // Fix DoubleCurve flattening the tangents of the first keyframe regardless of whether tangents are supplied.
  DoubleCurvePreserveTangents = true

  // Fix recovery of EVAing kerbals either causing their inventory to be recovered twice or the
  // science data they carry not being recovered, depending on the EVA kerbal variant/suit.
  EVAKerbalRecovery = true

  // Fix rescaled servo parts propagating their scale to childrens after actuating the servo in the editor
  RescaledRoboticParts = true

  // Fix engine plates causing the part attached above them to be incorrectly shielded from airstream
  EnginePlateAirstreamShieldedTopPart = true

  // Fix asteroid/comet mass being restored to 100% when reloading after having mined it down to 0%
  AsteroidInfiniteMining = true

  // Fix mass of comets not actually reducing when mining them, despite the PAW saying so.
  CometMiningNotRemovingMass = true

  // Fix Strategies not using Duration settings
  // Note that many stock strategies do have these set, but the code was broken.
  // For this reason this defaults to off, since otherwise it would change
  // stock gameplay.
  StrategyDuration = false

  // Fix Planetarium.GetUniversalTime() returning wrong values in the editor
  // Because while Planetarium's instance is live, it has bad data
  FixGetUnivseralTime = true
  
  // Fix biome and heightmap texture wrapping from pole to pole
  // Avoids big spikes on the poles and incorrect biomes where the oles have disparate biomes.
  MapSOCorrectWrapping = true
  // The Mohole is a result of the bug the MapSOCorrectWrapping patch is fixing. If set to
  // true, the patch won't apply to the stock Moho height/biome maps
  MapSOCorrectWrappingIgnoreMoho = true

  // Fix spread angle still being applied after decoupling symmetry-placed parachutes.
  ChutePhantomSymmetry = true

  // Fix FlagDecalBackground module always using the same drag cube for all model sizes
  // Implements a cache of autogenerated drag cubes and switch the part default drag cube
  CorrectDragForFlags = true

  // Fix for the stock "Kelus-LV Bay Mobility Enhancer" light being always active even when the 
  // ladder is retracted, and implements manual control of the light.
  LadderToggleableLight = true

  // Disable the stock behavior of altering surface attachment nodes on re-rooting, which is 
  // unnecessary and doesn't work correctly, leading to permanently borked attachement nodes.
  ReRootPreserveSurfaceAttach = true

  // Fix leaking a camera and spotlight created by the thumbnail system on certain failures
  ThumbnailSpotlight = true

  // Fix Propellant's GetFlowModeDescription (used when generating ModuleEngines ModuleInfo
  // where it describes propellants) to use the propellant's flow mode, not the base resource
  // flow mode.
  PropellantFlowDescription = true

  // Make docking ports converve momentum by averaging acquire forces between the two ports.
  // Notably, docking port Kraken drives will no longer work.
  DockingPortConserveMomentum = true

  // Fix IVA & crew portrait not spawning/despawning when ModuleAnimateGeneric is used to 
  // change the part crew capacity. Notably affect the stock inflatable airlock.
  ModuleAnimateGenericCrewModSpawnIVA = true

  // Fix active vessel orbit moving randomly when engaging timewarp while under heavy CPU load.
  TimeWarpOrbitShift = true

  // Fixes mass and volume of parts stored in inventories, especially when part variants or 
  // non-default resource amounts are used.
  // Prevents changing the variant of parts in inventory if it can modify the cost or mass.
  // Fixes the part info tooltip so that it shows the stored part's data instead of the prefab.
  InventoryPartMass = true

  // Fixes bugs related to part mass changing during EVA construction
  EVAConstructionMass = true

  // If respawning is enabled, starts the respawn timer for dead kerbals on game load, changing 
  // them to "missing."  There appears to be a bug in the stock game where sometimes Kerbals are 
  // set to "dead" instead of "missing" when they die, even when the respawn option is enabled.
  RespawnDeadKerbals = true

  // Fixes an issue where parts in tech nodes that have zero science cost become unusable
  ZeroCostTechNodes = true

  // Fixes a bug where ModulePartVariants does not alter attachnode positions when resuming a
  // vessel in flight.  This can lead to different part joint behaviors depending on whether the
  // vessel was spawned directly from the editor or loaded from the saved game.
  ModulePartVariantsNodePersistence = true

  // Fix disabled renderers by mesh switchers (B9PartSwitch...) still being considered for part
  // bounds evaluation, resulting in various issues like parts not being occluded from drag in
  // cargo bays, wrong vessel size being reported, etc...
  PartBoundsIgnoreDisabledTransforms = true

  // ##########################
  // Obsolete bugfixes
  // ##########################

  // Prevent kraken events on flight scene load
  // Disabled by default, the PartStartStability patch implement a better fix for that issue.
  FlightSceneLoadKraken = false

  // ##########################
  // Quality of life fixes
  // ##########################

  // Altimeter widget horizontal position tweakable in the pause menu settings
  AltimeterHorizontalPosition = true

  // Part Action Window inventory UI widgets in a collapsed group by default
  PAWCollapsedInventories = true
  
  // Part Action Window groups for a selection of stock modules
  PAWStockGroups = true

  // Allow tweaking the autostrut mode of wheels/landing legs
  TweakableWheelsAutostrut = true

  // Autostruts can be controlled with action groups
  AutostrutActions = true

  // Allow numeric input ("#" button) in "float edit" PAW items
  UIFloatEditNumericInput = true

  // Add an option to the "ESC" settings menu to disable the stock maneuver/trip planner tool
  DisableManeuverTool = true

  MANEUVER_TOOL_DEFAULTS
  {
    // Set to false to disable the stock maneuver/trip planner by default. 
    // The user can still re-enable it from the "ESC" settings menu.
    ManeuverToolEnabledByDefault = true

    // Set to true to forcefully disable the stock maneuver/trip planner.
    // The user won't be be given the option to enable it.
    ManeuverToolAlwaysDisabled = false
  }

  // Make the "Fairing Expansion" state persistent 
  FairingMouseOverPersistence = true

  // Append "[Auto-Saved Craft]" when relevant to the craft name in the Launchpad / Runway UI
  AutoSavedCraftNameAtLaunch = true
  
  // Show date a contract finished when displaying info on a finished contract in Mission Control
  ShowContractFinishDates = true

  // Disable the "intro" popups appearing in the space center, VAB/SPH and tracking station
  // upon creating a new career game. Disabled by default.
  DisableNewGameIntro = false

  // Add a button for hiding/showing the stock toolbar. Also allow accessing the toolbar while
  // in the space center facilities windows (mission control, admin building, R&D...).
  ToolbarShowHide = true

  // Add part actions for locking/unlocking part resources flow state.
  ResourceLockActions = true

  // Invert the editor undo state capturing logic so part tweaks aren't lost when undoing.
  BetterEditorUndoRedo = true

  // Allow to disable the Making History DLC mission editor and additional launch sites features
  // to decrease memory usage and increase loading speed. The Making History parts will still be 
  // available. Can be toggled from the KSPCF in-game settings (requires a restart).
  OptionalMakingHistoryDLCFeatures = true

  // Optional MM-patcheable toggle to always disable the MH features
  OptionalMakingHistoryDLCFeaturesAlwaysDisable = false

  // ##########################
  // Performance tweaks
  // ##########################

  // Reduce scene loading time by caching the current save in memory instead of loading it from disk
  SceneLoadSpeedBoost = true

  // Prevent the buoyancy integrator from eating CPU cycles when the vessel isn't submerged
  OnDemandPartBuoyancy = true

  // Prevent huge memory allocations and resulting occasional stutter on PQS creation happening
  // when moving around near a body surface
  PQSUpdateNoMemoryAlloc = true

  // Prevent KSP from spawning multiple PQS update coroutines for the same PQS after scene switches and
  // and on other occasions, wasting a ton of CPU processing time.
  PQSCoroutineLeak = true

  // Remove unused ProgressTracking update handlers. Provides a very noticeable performance uplift in 
  // career games having a large amount of celestial bodies and/or vessels.
  ProgressTrackingSpeedBoost = true

  // Disable the update of orbit lines and markers in flight when the map view isn't shown. Provides
  // decent performance gains in games having a large amount of celestial bodies and/or vessels.
  DisableMapUpdateInFlight = true

  // Reduce constant overhead of ModuleAsteroidDrill and ModuleCometDrill by using the cached 
  // asteroid/comet part lookup results from ModuleResourceHarvester. Improves performance with 
  // large part count vessels having at least one drill part.
  AsteroidAndCometDrillCache = true

  // Fix a bunch of managed memory leaks, mainly by proactively removing GameEvents delegates 
  // originating from destroyed UnityEngine.Object instances. Will log detected leaks and memory
  // usage on scene switches.
  MemoryLeaks = true

  // Additional debugging options for the MemoryLeaks patch. This doesn't provide any user-facing
  // benefit, it just enable extra logging options that are useful to track down memory leaks.
  MEMORY_LEAKS_DEBUGGING
  {
    // Set to true if you want a more accurate figure for the managed memory usage logged by KSPCF 
    // on scene switches.
    ForceGCCollect = false

    // Enable detailed logging of GameEvents delegate leaks detected on scene switches. This only cover
    // leaks originating from destroyed UnityEngine.Object derivatives.
    LogDestroyedUnityObjectGameEventsLeaks = true

    // This will compare alive GameEvents delegates between the last and current scene switch for a given
    // scene, and log detailed information about classes that have an increasing amount of delegates for
    // the same GameEvent. Note that this doesn't include destroyed UnityEngine.Object instances leaks, use
    // the LogDestroyedUnityObjectGameEventsLeaks option to detect those.
    AdvancedGameEventsLeakDetection = false

    // Enable detailed logging of all GameEvents delegates remaining after scene destruction.
    // By comparing the results between two scene switches, this allow hunting down classes that are
    // leaking GameEvent subscriptions.
    LogGameEventsSubscribers = false
  }

  // Fix CommNet update throttling mechanism that exists in stock but doesn't work correctly.
  // This is supposed to prevent full CommNet network updates from happening every frame, but instead to
  // to happen at a regular real-world time interval of 5 seconds while in flight. Enabling this throttling
  // mechanism has an detrimental impact on the precision of the simulation, so this patch isn't enabled by
  // default to avoid issues in mods relying on the stock behavior. Enabling this can provide a decent 
  // performance uplift in games having a large amount of celestial bodies and/or vessels.
  CommNetThrottling = false

  // Interval in real-world seconds between full CommNet network updates.
  COMMNET_THROTTLING_SETTINGS
  {
    unpackedInterval = 5 // interval when the active vessel is not timewarping
    packedInterval = 0.5 // interval when the active vessel is timewarping
  }

  // This tweak eliminates KSP's stock behavior of saving every time
  // you exit a UI-only space center building (AC, MC, etc)
  // and every time you delete a vessel in the Tracking Station
  FewerSaves = false

  // This tweak will skip writing indents when saving craft files and
  // savegames (sfs files). This will speed up writing (and slightly
  // speed up reading) at the cost of human readability.
  SkipIndentsOnSavesAndCraftFiles = false

  // After using physics warp, Unity's max physics dt will never be returned to the value specified in 
  // game settings which can degrade performance in some cases
  RestoreMaxPhysicsDT = true

  // Prevent performance drops when there are in-progress comet sample or rover construction contracts
  ContractProgressEnumCache = true

  // Faster and more reliable implementation of drag cube generation. Improves overall loading times (both game 
  // load and scene/vessel/ship load times), prevent occasional lag spikes (in the editor mostly) and fix some 
  // issues causing incorrect drag cubes to be generated (notable examples are the stock inflatable heat shield,
  // the 1.25m and 2.5m nose cones and the Mainsail shroud). Note that by design, this patch results in a small 
  // deviation from the stock behavior for buyoancy, aerodynamics and thermodynamics, as the generated drag cubes 
  // will be slightly different.
  DragCubeGeneration = true

  // Faster and minimal-allocation replacements for the Localizer.Format() methods, can provide
  // significant speedup for GUI-heavy mods using localized strings.
  LocalizerPerf = true

  // Prevent non-visible crew portraits from being rendered after a switch back from the map view 
  // (and other cases), causing a significant perf hit when there are many kerbals in the vessel.
  DisableHiddenPortraits = true

  // Eliminate structural GC allocations and reduce performance overhead of OnGUI() methods.
  // Can provide significant performance gains when having many mods using IMGUI heavily.
  IMGUIOptimization = true

  // 3-4 times faster update of parts inter-collision state, significantly reduce stutter on 
  // docking, undocking, decoupling and joint failure events.
  CollisionManagerFastUpdate = true

  // Allow a min value of 0.02 instead of 0.03 for the "Max Physics Delta-Time Per Frame" main menu setting.
  LowerMinPhysicsDTPerFrame = true

  // Improve engine exhaust damage and solar panel line of sight raycasts performance by avoiding extra physics
  // state synchronization and caching solar panels scaled space raycasts results.
  OptimizedModuleRaycasts = true

  // ##########################
  // Modding
  // ##########################

  // Fire GameEvents.onRoboticPartLockChanging and GameEvents.onRoboticPartLockChanged 
  // respectively before and after calls to ModuleDockingNode.ModifyLocked(), following
  // a modification of the ModuleDockingNode.nodeIsLocked field.
  // Disabled by default, you can enable it with a MM patch.
  DockingPortLockedEvents = false

  // Change the UI_Control.onSymmetryFieldChanged callback to behave identically to the
  // UI_Control.onFieldChanged callback :
  // - The callback will only be called when the field value has actually been modified.
  // - The "object" argument will contain the previous field value (instead of the new value).
  // Disabled by default, you can enable it with a MM patch.
  OnSymmetryFieldChanged = false

  // Implement `IConfigNode` members marked as `[Persistent]` serialization support when using 
  // the `CreateObjectFromConfig()`, `LoadObjectFromConfig()` and `CreateConfigFromObject()` methods.
  // Disabled by default, you can enable it with a MM patch.
  // Also adds support for [Persistent] tags on System.Guid
  // Features a full rewrite of ReadObject/WriteObject for performance and lower GC impact
  // and to fix some exisiting stock bugs.
  PersistentIConfigNode = true

  // Fix Admin Building not using HeadImage if that is defined for a Department
  DepartmentHeadImage = true

  // Stores mod versions in sfs and craft files, and uses those versions for the SaveUpgradePipeline,
  // so mods can do versioning based on their own version numbers and not have to always run their
  // upgrade scripts.
  ModUpgradePipeline = false

  // ##########################
  // Localization tools
  // ##########################

  // Uncomment the next line and set it to the desired language code to generate a localization 
  // template on next KSP launch. The file will be created in the KSPCommunityFixes\Localization 
  // directory.
  // - if set to "en-us", this will generate the default localization file based on the source 
  //   code (english) strings.
  // - if set to another language, this will generate a localization file with the english 
  //   localization strings as comments. If a localization file for this language already exists, 
  //   the generated template will reuse existing translated strings.

  // GenerateLocTemplate = en-us
}
