diff --git a/GameData/CryoTanks/Parts/HydrogenTanks/hydrogen-inline/hydrogen-375-2.mu b/GameData/CryoTanks/Parts/HydrogenTanks/hydrogen-inline/hydrogen-375-2.mu index 52ad31f..2cfe599 100644 Binary files a/GameData/CryoTanks/Parts/HydrogenTanks/hydrogen-inline/hydrogen-375-2.mu and b/GameData/CryoTanks/Parts/HydrogenTanks/hydrogen-inline/hydrogen-375-2.mu differ diff --git a/GameData/CryoTanks/Patches/CryoTanksISRU_patch.cfg b/GameData/CryoTanks/Patches/CryoTanksISRU_patch.cfg index 0ef0e66..b00d876 100644 --- a/GameData/CryoTanks/Patches/CryoTanksISRU_patch.cfg +++ b/GameData/CryoTanks/Patches/CryoTanksISRU_patch.cfg @@ -1,6 +1,8 @@ //===================================================================================== // adds LH2, LH2Ox, LCH4, LCH4Ox Converters to parts, that are in CryoTanksISRU_Opt-In -// an invariant mass was used to calculate the values +// Converts appropriately into the resources conserving mass for each fuel type, e.g. +// 1 ore (10 kg/u) -> 2 LF (5 kg/u) +// 1 ore (10 kg/u) -> 141 LH2 (0.07085 kg/u) //===================================================================================== // --------------------------------------------------------------------------- @@ -210,24 +212,19 @@ @MODULE[ModuleResourceConverter]:HAS[#Tag[CryoTanks_Hydrogen]],* { - @INPUT_RESOURCE:HAS[@ResourceName[ElectricCharge]] + @INPUT_RESOURCE:HAS[#ResourceName[ElectricCharge]] { - @Ratio *= #$/CryoTanks_EC_Hydrogen$ + @Ratio *= #$../../CryoTanks_EC_Hydrogen$ } } @MODULE[ModuleResourceConverter]:HAS[#Tag[CryoTanks_Methane]],* { - @INPUT_RESOURCE:HAS[@ResourceName[ElectricCharge]] + @INPUT_RESOURCE:HAS[#ResourceName[ElectricCharge]] { - @Ratio *= #$/CryoTanks_EC_Methane$ + @Ratio *= #$../../CryoTanks_EC_Methane$ } } - - -CryoTanks_Converter = none - -CryoTanks_EC_Hydrogen = none - -CryoTanks_EC_Methane = none - } @@ -237,12 +234,21 @@ { @INPUT_RESOURCE:HAS[~ResourceName[ElectricCharge]],* { - @Ratio *= #$/CryoTanks_Power$ + @Ratio *= #$../../CryoTanks_Power$ } @OUTPUT_RESOURCE,* { - @Ratio *= #$/CryoTanks_Power$ + @Ratio *= #$../../CryoTanks_Power$ } } +} + + +@PART:HAS[#CryoTanks_Converter[Set]]:FOR[CryoTanks] +{ + -CryoTanks_Converter = none -CryoTanks_Power = none -} \ No newline at end of file + -CryoTanks_EC_Hydrogen = none + -CryoTanks_EC_Methane = none +} + diff --git a/GameData/CryoTanks/Patches/CryoTanksProceduralFuelTanks.cfg b/GameData/CryoTanks/Patches/CryoTanksProceduralFuelTanks.cfg index ff83941..3e5e38c 100644 --- a/GameData/CryoTanks/Patches/CryoTanksProceduralFuelTanks.cfg +++ b/GameData/CryoTanks/Patches/CryoTanksProceduralFuelTanks.cfg @@ -1,56 +1,154 @@ // Procedural Fuel Tanks Patch -// Most recent author: Ve +// Most recent author: Scialytic -@PART[procedural*Liquid]:NEEDS[ProceduralParts&!RealFuels&!ModularFuelTanks]:FOR[CryoTanks] +// ProceduralParts seems to recommend using unitsPerT rather than unitsPerKL. +// ref: https://github.com/KSP-RO/ProceduralParts/wiki/Calculation-of-tank-config-parameters +// Their rationale about mass ratios being more important than drag seems solid, so I'll stick with unitsPerT. + +// Reminder: Avoid using dryDensity to derive other values. It's not consistent even between stock parts. + +// The costMultiplier values inside the TANK_TYPE_OPTIONs below are set to roughly match the cost of equivalent stock/cryo tanks. +// This way it's easy to scale them all up as judged appropriate using priceMultiplier. + +CT_PROCEDURAL_TAX +{ + priceMultiplier = 1.1 +} + +!CT_PROCEDURAL_TAX:LAST[CryoTanks] {} + +@PART[procedural*Liquid]:NEEDS[CryoTanks&ProceduralParts&!RealFuels&!ModularFuelTanks] { @MODULE[TankContentSwitcher] { + // Values calculated using CryoTanks' B9_TANK_TYPE definitions + // unitsPerT = unitsPerVolume / tankMass + // Note: tankMass is "the mass that this tank type has, per unit of volume" so really it's more of a tankDensity but ¯\_(ツ)_/¯ + // ref: https://github.com/post-kerbin-mining-corporation/CryoTanks/blob/master/GameData/CryoTanks/Patches/CryoTanksFuelTankTypes.cfg + + ratioPPDDtoB9TM = 174.24 // Magic number? I'd love to know what it logically represents + + // Stock resources configured by ProceduralParts + !TANK_TYPE_OPTION[Mixed] {} + !TANK_TYPE_OPTION[LiquidFuel] {} + !TANK_TYPE_OPTION[Oxidizer] {} TANK_TYPE_OPTION { - name = LqdHydrogen - dryDensity = 0.0187 - costMultiplier = 1.61 + name = #LOC_CryoTanks_switcher_fuel_lfox + dryDensity = #$@B9_TANK_TYPE[LFOX]/tankMass$ + @dryDensity *= #$../ratioPPDDtoB9TM$ + costMultiplier = 0.313 RESOURCE { - name = LqdHydrogen - // 1303.79733/0.0187 - unitsPerT = 69721.78235 + name = LiquidFuel + unitsPerT = #$@B9_TANK_TYPE[LFOX]/RESOURCE[LiquidFuel]/unitsPerVolume$ + @unitsPerT /= #$@B9_TANK_TYPE[LFOX]/tankMass$ + } + RESOURCE + { + name = Oxidizer + unitsPerT = #$@B9_TANK_TYPE[LFOX]/RESOURCE[Oxidizer]/unitsPerVolume$ + @unitsPerT /= #$@B9_TANK_TYPE[LFOX]/tankMass$ } } TANK_TYPE_OPTION { - name = HydroOxi - dryDensity = 0.0487 - costMultiplier = 1.35 + name = #LOC_CryoTanks_switcher_fuel_lf + dryDensity = #$@B9_TANK_TYPE[LF]/tankMass$ + @dryDensity *= #$../ratioPPDDtoB9TM$ + costMultiplier = 0.526 + RESOURCE + { + name = LiquidFuel + unitsPerT = #$@B9_TANK_TYPE[LF]/RESOURCE[LiquidFuel]/unitsPerVolume$ + @unitsPerT /= #$@B9_TANK_TYPE[LF]/tankMass$ + } + } + TANK_TYPE_OPTION + { + name = #LOC_CryoTanks_switcher_fuel_ox + dryDensity = #$@B9_TANK_TYPE[OX]/tankMass$ + @dryDensity *= #$../ratioPPDDtoB9TM$ + costMultiplier = 0.313 + RESOURCE + { + name = Oxidizer + unitsPerT = #$@B9_TANK_TYPE[OX]/RESOURCE[Oxidizer]/unitsPerVolume$ + @unitsPerT /= #$@B9_TANK_TYPE[OX]/tankMass$ + } + } + // CryoTanks + TANK_TYPE_OPTION + { + name = #LOC_CryoTanks_switcher_fuel_lh2ox + dryDensity = #$@B9_TANK_TYPE[LH2OCryo]/tankMass$ + @dryDensity *= #$../ratioPPDDtoB9TM$ + costMultiplier = 0.7624 RESOURCE { name = LqdHydrogen - unitsPerKL = 868.32902 + unitsPerT = #$@B9_TANK_TYPE[LH2OCryo]/RESOURCE[LqdHydrogen]/unitsPerVolume$ + @unitsPerT /= #$@B9_TANK_TYPE[LH2OCryo]/tankMass$ } RESOURCE { name = Oxidizer - unitsPerKL = 57.8886 + unitsPerT = #$@B9_TANK_TYPE[LH2OCryo]/RESOURCE[Oxidizer]/unitsPerVolume$ + @unitsPerT /= #$@B9_TANK_TYPE[LH2OCryo]/tankMass$ } } TANK_TYPE_OPTION { - name = MethaOxi - dryDensity = 0.0909 - costMultiplier = 1.3 + name = #LOC_CryoTanks_switcher_fuel_lh2 + dryDensity = #$@B9_TANK_TYPE[LH2Cryo]/tankMass$ + @dryDensity *= #$../ratioPPDDtoB9TM$ + costMultiplier = 0.9047 + RESOURCE + { + name = LqdHydrogen + unitsPerT = #$@B9_TANK_TYPE[LH2Cryo]/RESOURCE[LqdHydrogen]/unitsPerVolume$ + @unitsPerT /= #$@B9_TANK_TYPE[LH2Cryo]/tankMass$ + } + } + TANK_TYPE_OPTION + { + name = #LOC_CryoTanks_switcher_fuel_methalox + dryDensity = #$@B9_TANK_TYPE[LMOx]/tankMass$ + @dryDensity *= #$../ratioPPDDtoB9TM$ + costMultiplier = 0.7624 RESOURCE { name = LqdMethane - unitsPerKL = 325.94933 + unitsPerT = #$@B9_TANK_TYPE[LMOx]/RESOURCE[LqdMethane]/unitsPerVolume$ + @unitsPerT /= #$@B9_TANK_TYPE[LMOx]/tankMass$ } RESOURCE { name = Oxidizer - unitsPerKL = 108.64977 + unitsPerT = #$@B9_TANK_TYPE[LMOx]/RESOURCE[Oxidizer]/unitsPerVolume$ + @unitsPerT /= #$@B9_TANK_TYPE[LMOx]/tankMass$ } } + TANK_TYPE_OPTION + { + name = #LOC_CryoTanks_switcher_fuel_methane + dryDensity = #$@B9_TANK_TYPE[LM]/tankMass$ + @dryDensity *= #$../ratioPPDDtoB9TM$ + costMultiplier = 0.8478 + RESOURCE + { + name = LqdMethane + unitsPerT = #$@B9_TANK_TYPE[LM]/RESOURCE[LqdMethane]/unitsPerVolume$ + @unitsPerT /= #$@B9_TANK_TYPE[LM]/tankMass$ + } + } + // Scale up all costMultiplier values as configured at the top + @TANK_TYPE_OPTION,* + { + @costMultiplier *= #$@CT_PROCEDURAL_TAX/priceMultiplier$ + } } - + MODULE { name = ModuleCryoTank @@ -73,70 +171,119 @@ } } -@PART[proceduralTankLiquid]:NEEDS[SMURFF&ProceduralParts&!RealFuels&!ModularFuelTanks]:FOR[CryoTanks] +// Prep work before SMURFF's patches run +@PART[procedural*Liquid]:NEEDS[SMURFF&ProceduralParts&!RealFuels&!ModularFuelTanks]:FOR[CryoTanks] { @MODULE[TankContentSwitcher] { - // This runs before SMURFF. - // Hydrogen is already patched well by SMURFF - @TANK_TYPE_OPTION[HydroOxi] + @TANK_TYPE_OPTION:HAS[@RESOURCE[LiquidFuel]&@RESOURCE[Oxidizer]] { - // 1/unitsPerT - lh2mass = 0.00001417 - @lh2mass *= #$RESOURCE[LqdHydrogen]/unitsPerKL$ + @name = Mixed + } + @TANK_TYPE_OPTION:HAS[@RESOURCE[LiquidFuel]&!RESOURCE[Oxidizer]] + { + @name = LiquidFuel + } + @TANK_TYPE_OPTION:HAS[!RESOURCE[LiquidFuel]&@RESOURCE[Oxidizer]] + { + @name = Oxidizer + } + @TANK_TYPE_OPTION:HAS[@RESOURCE[LqdHydrogen]&@RESOURCE[Oxidizer]] + { + @name = HydroOxi + // SMURFF has its own ideas about the LH2/Ox tank mass ratio + // ref: https://github.com/Kerbas-ad-astra/SMURFF/blob/505112a488b1ebf74ff655d4680f3b29f0d7fafd/GameData/SMURFF/SMURFF.cfg#L955 + // Therefore, reconfigure the LH2/Ox TANK_TYPE_OPTION to behave consistently with SMURFF's version of the LH2OCryo B9_TANK_TYPE + lh2mass = #$@B9_TANK_TYPE[LH2Cryo]/tankMass$ + @lh2mass *= #$@B9_TANK_TYPE[LH2OCryo]/RESOURCE[LqdHydrogen]/unitsPerVolume$ + @lh2mass /= #$@B9_TANK_TYPE[LH2Cryo]/RESOURCE[LqdHydrogen]/unitsPerVolume$ @lh2mass /= #$@SMURFFCONFIG/lh2zbofactor$ - - oxmass = 0.000625 - @oxmass *= #$RESOURCE[Oxidizer]/unitsPerKL$ + + oxmass = #$@B9_TANK_TYPE[OX]/tankMass$ + @oxmass *= #$@B9_TANK_TYPE[LH2OCryo]/RESOURCE[Oxidizer]/unitsPerVolume$ + @oxmass /= #$@B9_TANK_TYPE[OX]/RESOURCE[Oxidizer]/unitsPerVolume$ @oxmass /= #$@SMURFFCONFIG/lfofactor$ - - @dryDensity = #$lh2mass$ - @dryDensity += #$oxmass$ - - -lh2mass = delete - -oxmass = delete + + tankMassSMURFF = #$lh2mass$ + @tankMassSMURFF += #$oxmass$ + + @dryDensity = #$tankMassSMURFF$ + @dryDensity *= #$../ratioPPDDtoB9TM$ + @RESOURCE[LqdHydrogen] + { + @unitsPerT = #$@B9_TANK_TYPE[LH2OCryo]/RESOURCE[LqdHydrogen]/unitsPerVolume$ + @unitsPerT /= #$../tankMassSMURFF$ + } + @RESOURCE[Oxidizer] + { + @unitsPerT = #$@B9_TANK_TYPE[LH2OCryo]/RESOURCE[Oxidizer]/unitsPerVolume$ + @unitsPerT /= #$../tankMassSMURFF$ + } } - @TANK_TYPE_OPTION[MethaOxi] + @TANK_TYPE_OPTION:HAS[@RESOURCE[LqdHydrogen]&!RESOURCE[Oxidizer]] { - // (B9_TANK_TYPE[LM]/tankMass) - lh2mass = 0.000070935 - @lh2mass *= #$RESOURCE[LqdMethane]/unitsPerKL$ - @lh2mass /= #$@SMURFFCONFIG/lfofactor$ - - oxmass = 0.000625 - @oxmass *= #$RESOURCE[Oxidizer]/unitsPerKL$ - //TODO: maybe a factor in between LFO and LH2 should be used, isnt this too good? - @oxmass /= #$@SMURFFCONFIG/lfofactor$ - - @dryDensity = #$lh2mass$ - @dryDensity += #$oxmass$ - - -lh2mass = delete - -oxmass = delete + @name = LqdHydrogen } - } -} - -// Rename HydroOxi back after SMURFF runs -@PART[proceduralTankLiquid]:NEEDS[SMURFF&ProceduralParts&!RealFuels&!ModularFuelTanks]:AFTER[zzz_SMURFF] -{ - @MODULE[TankContentSwitcher] - { - @TANK_TYPE_OPTION[HydroOxi] + @TANK_TYPE_OPTION:HAS[@RESOURCE[LqdMethane]&@RESOURCE[Oxidizer]] { - @name = LqdHydrogen+Oxidizer + @name = MethaOxi + @dryDensity /= #$@SMURFFCONFIG/lfofactor$ + @RESOURCE[LqdMethane] + { + @unitsPerT *= #$@SMURFFCONFIG/lfofactor$ + } + @RESOURCE[Oxidizer] + { + @unitsPerT *= #$@SMURFFCONFIG/lfofactor$ + } + } + @TANK_TYPE_OPTION:HAS[@RESOURCE[LqdMethane]&!RESOURCE[Oxidizer]] + { + @name = LqdMethane + @dryDensity /= #$@SMURFFCONFIG/lfofactor$ + @RESOURCE[LqdMethane] + { + @unitsPerT *= #$@SMURFFCONFIG/lfofactor$ + } } } } -// Rename HydroOxi back in case SMURFF was not installed -@PART[proceduralTankLiquid]:NEEDS[!SMURFF&ProceduralParts&!RealFuels&!ModularFuelTanks]:FOR[CryoTanks] +// Rename TANK_TYPE_OPTIONs and clean up after SMURFF runs +@PART[procedural*Liquid]:NEEDS[SMURFF&ProceduralParts&!RealFuels&!ModularFuelTanks]:AFTER[zzz_SMURFF] { @MODULE[TankContentSwitcher] { - @TANK_TYPE_OPTION[HydroOxi] + @TANK_TYPE_OPTION:HAS[@RESOURCE[LiquidFuel]&@RESOURCE[Oxidizer]] + { + @name = #LOC_CryoTanks_switcher_fuel_lfox + } + @TANK_TYPE_OPTION:HAS[@RESOURCE[LiquidFuel]&!RESOURCE[Oxidizer]] + { + @name = #LOC_CryoTanks_switcher_fuel_lf + } + @TANK_TYPE_OPTION:HAS[!RESOURCE[LiquidFuel]&@RESOURCE[Oxidizer]] + { + @name = #LOC_CryoTanks_switcher_fuel_ox + } + @TANK_TYPE_OPTION:HAS[@RESOURCE[LqdHydrogen]&@RESOURCE[Oxidizer]] + { + @name = #LOC_CryoTanks_switcher_fuel_lh2ox + !lh2mass = delete + !oxmass = delete + !tankMassSMURFF = delete + } + @TANK_TYPE_OPTION:HAS[@RESOURCE[LqdHydrogen]&!RESOURCE[Oxidizer]] + { + @name = #LOC_CryoTanks_switcher_fuel_lh2 + } + @TANK_TYPE_OPTION:HAS[@RESOURCE[LqdMethane]&@RESOURCE[Oxidizer]] + { + @name = #LOC_CryoTanks_switcher_fuel_methalox + } + @TANK_TYPE_OPTION:HAS[@RESOURCE[LqdMethane]&!RESOURCE[Oxidizer]] { - @name = LqdHydrogen+Oxidizer + @name = #LOC_CryoTanks_switcher_fuel_methane } } } diff --git a/GameData/CryoTanks/Patches/CryoTanksProceduralWings.cfg b/GameData/CryoTanks/Patches/CryoTanksProceduralWings.cfg index 9406c04..b885a37 100644 --- a/GameData/CryoTanks/Patches/CryoTanksProceduralWings.cfg +++ b/GameData/CryoTanks/Patches/CryoTanksProceduralWings.cfg @@ -1,8 +1,59 @@ -@ProceduralWingFuelSetups:NEEDS[CryoTanks&B9_Aerospace_WingStuff|pWings&!ModularFuelTanks] +// Procedural Wings Patch +// Most recent author: Scialytic + +// Nuke the existing FuelSets for ordering purposes (PWing's selector only provides "Next" so order is important for player convenience) +// Therefore, run ASAP to avoid causing problems for any other mods/patches that add FuelSets +@ProceduralWingFuelSetups:FIRST:NEEDS[CryoTanks&B9_Aerospace_WingStuff|pWings&!ModularFuelTanks] { + !FuelSet,* {} + FuelSet + { + name = Str + } + FuelSet + { + name = #LOC_CryoTanks_switcher_fuel_lf + Resource + { + name = LiquidFuel + ratio = 1 + } + } + FuelSet + { + name = #LOC_CryoTanks_switcher_fuel_lfox + Resource + { + name = LiquidFuel + ratio = 9 + } + Resource + { + name = Oxidizer + ratio = 11 + } + } + FuelSet + { + name = #LOC_CryoTanks_switcher_fuel_ox + Resource + { + name = Oxidizer + ratio = 1 + } + } + FuelSet + { + name = Mono + Resource + { + name = MonoPropellant + ratio = 1 + } + } FuelSet { - name = LH2 + name = #LOC_CryoTanks_switcher_fuel_lh2 Resource { name = LqdHydrogen @@ -11,11 +62,34 @@ } FuelSet { - name = LH2O + name = #LOC_CryoTanks_switcher_fuel_lh2ox Resource { name = LqdHydrogen - ratio = 15 + ratio = 3 // Yes, 3 not 15. Don't worry, it will be 15:1 units in game. LqdHydrogen has "volume = 1" in CommunityResourcePack's resource definitions, which changes how PWings calculates unitsPerVolume. + } // see: https://github.com/B9-Procedural-Wings/B9-PWings-Modified/blob/baf739d7ee217622710ce668825bf4db030fcc39/B9_PWings_Fork/WingTankResource.cs#L28 for details. + Resource + { + name = Oxidizer + ratio = 1 + } + } + FuelSet + { + name = #LOC_CryoTanks_switcher_fuel_methane + Resource + { + name = LqdMethane + ratio = 1 + } + } + FuelSet + { + name = #LOC_CryoTanks_switcher_fuel_methalox + Resource + { + name = LqdMethane + ratio = 0.6 // 3/5 is needed here because LqdMethane is 1 L/Unit whereas stock fuels are 5 L/Unit. } Resource { @@ -25,18 +99,34 @@ } } +// Unfortunately LqdMethane lacks "volume = 1" in CommunityResourcePack's resource definitions. That means PWings assumes it's a 5 L/Unit resource. +// Carrying only 20% of the fuel they should be would make the LqdMethane options practically useless. +// AFAICS there's no other way to communicate this info to PWings. +@RESOURCE_DEFINITION[LqdMethane] +{ + %volume = 1 +} + @PART[B9_Aero_Wing_Procedural_TypeA,Proceduralwing*]:NEEDS[CryoTanks&!ModularFuelTanks] { MODULE { name = ModuleCryoTank - CoolingCost = 0.09 - CoolingEnabled = False + // in Ec per 1000 units per second + CoolingEnabled = True BOILOFFCONFIG { FuelName = LqdHydrogen // in % per hr BoiloffRate = 0.05 + CoolingCost = 0.09 + } + BOILOFFCONFIG + { + FuelName = LqdMethane + // in % per hr + BoiloffRate = 0.005 + CoolingCost = 0.045 } } } diff --git a/GameData/CryoTanks/Versioning/CryoTanks.version b/GameData/CryoTanks/Versioning/CryoTanks.version index 8e37fc9..8c9599b 100644 --- a/GameData/CryoTanks/Versioning/CryoTanks.version +++ b/GameData/CryoTanks/Versioning/CryoTanks.version @@ -6,14 +6,14 @@ { "MAJOR":1, "MINOR":6, - "PATCH":4, + "PATCH":5, "BUILD":0 }, "KSP_VERSION": { "MAJOR":1, "MINOR":12, - "PATCH":2 + "PATCH":3 }, "KSP_VERSION_MIN":{ "MAJOR":1, diff --git a/changelog.txt b/changelog.txt index 76069dd..8582f38 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,8 @@ +v1.6.5 +------ +- Fixed shader on 3.75m hydrogen tank +- Update Procedural Parts patches (Scialytic) + v1.6.4 ------ - Bugfixes diff --git a/readme.txt b/readme.txt index 20845cc..abb11b0 100644 --- a/readme.txt +++ b/readme.txt @@ -1,5 +1,5 @@ ================= -Cryo Tanks v1.6.3 +Cryo Tanks v1.6.5 ================= A mod pack for Kerbal Space Program, specifically supporting my other mods Kerbal Atomics (https://github.com/ChrisAdderley/KerbalAtomics) and Cryogenic Engines (https://github.com/ChrisAdderley/CryoEngines), dealing with cryogenic fuels, their storage and their properties.