Skip to content

Commit

Permalink
Fix #244: fix conflicts in autopassthrough system when RO is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyOThan committed Jun 29, 2023
1 parent 9c70e56 commit 289a49a
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions GameData/FreeIva/Patches/AutoPassThrough.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ B9_TANK_TYPE
FreeIva_AutoPassThrough_StructuralVariant = true
}

// step 3: if there is no fuel switch moduleID, add one
@PART:HAS[#FreeIva_AutoPassThrough[true]&~FreeIva_AutoPassThrough_FuelSwitchID]:FOR[zzz_FreeIva]
// step 3: if there is no fuel switch moduleID, add one (as long as there's at least one RESOURCE - RO will remove resources from certain parts)
@PART:HAS[#FreeIva_AutoPassThrough[true]&~FreeIva_AutoPassThrough_FuelSwitchID&@RESOURCE]:FOR[zzz_FreeIva]
{
FreeIva_AutoPassThrough_FuelSwitchID = FreeIva_fuelSwitch
FreeIva_AutoPassThrough_TankTypes = true
Expand All @@ -133,6 +133,31 @@ B9_TANK_TYPE
}
}
// step 3.1: if the part doesn't have resources, just set it up directly for passthrough
// with passthrough...
@PART:HAS[#FreeIva_AutoPassThrough[true]&~FreeIva_AutoPassThrough_FuelSwitchID&!RESOURCE&~FreeIva_AutoPassThrough_InternalName]:FOR[zzz_FreeIva]
{
MODULE
{
name = ModuleFreeIva
passThroughNodeA = top
passThroughNodeB = bottom
}
}
// ...or with a named internal
@PART:HAS[#FreeIva_AutoPassThrough[true]&~FreeIva_AutoPassThrough_FuelSwitchID&!RESOURCE&#FreeIva_AutoPassThrough_InternalName]:FOR[zzz_FreeIva]
{
MODULE
{
name = ModuleFreeIva
}

%INTERNAL
{
%name = #$/FreeIva_AutoPassThrough_InternalName$
}
}

// step 3.5: calculate the volume and fuel types for the tanks we added
// LFO
@PART:HAS[#FreeIva_AutoPassThrough_TankTypes[true]&@RESOURCE[LiquidFuel]&@RESOURCE[Oxidizer]]:FOR[zzz_FreeIva]
Expand Down Expand Up @@ -261,7 +286,7 @@ B9_TANK_TYPE


// step 4.A: add the b9ps module for freeiva - but not if there is a structural variant available
@PART:HAS[#FreeIva_AutoPassThrough[true]&~FreeIva_AutoPassThrough_StructuralVariant[true]]:FOR[zzz_FreeIva]
@PART:HAS[#FreeIva_AutoPassThrough[true]&~FreeIva_AutoPassThrough_StructuralVariant[true]&!MODULE[ModuleFreeIva]]:FOR[zzz_FreeIva]
{
%FreeIva_AutoPassThrough_VolumePercent = #$/FreeIva_AutoPassThrough_VolumeScalar$
@FreeIva_AutoPassThrough_VolumePercent *= -100 // volumeScalar is negative
Expand Down Expand Up @@ -306,7 +331,7 @@ B9_TANK_TYPE
}

// step 4.B: add the FreeIva module for the structural variant case
@PART:HAS[#FreeIva_AutoPassThrough[true]&#FreeIva_AutoPassThrough_StructuralVariant[true]]:FOR[zzz_FreeIva]
@PART:HAS[#FreeIva_AutoPassThrough[true]&#FreeIva_AutoPassThrough_StructuralVariant[true]&!MODULE[ModuleFreeIva]]:FOR[zzz_FreeIva]
{
MODULE
{
Expand Down

0 comments on commit 289a49a

Please sign in to comment.