Created
October 24, 2015 23:45
-
-
Save jberkman/6f79a396d088a28ed8b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Code by Badsector, Nertea and veryinky | |
@PART[*]:HAS[@RESOURCE[LiquidFuel],@RESOURCE[Oxidizer],!MODULE[FSfuelSwitch]] { | |
%LF = #$RESOURCE[LiquidFuel]/maxAmount$ | |
%OX = #$RESOURCE[Oxidizer]/maxAmount$ | |
%totalCap = #$RESOURCE[LiquidFuel]/maxAmount$ | |
@totalCap += #$RESOURCE[Oxidizer]/maxAmount$ | |
%tempVar = 0 | |
%dryCost = 0 | |
@dryCost = #$cost$ | |
%LFCost = 0 | |
%OXCost = 0 | |
%mixLFCost = 0 | |
// compute cost of stock tank fuel | |
@tempVar = #$RESOURCE[LiquidFuel]/maxAmount$ | |
@tempVar *= 0.8 | |
@mixLFCost += #$tempVar$ | |
@tempVar = #$RESOURCE[Oxidizer]/maxAmount$ | |
@tempVar *= 0.18 | |
@mixLFCost += #$tempVar$ | |
@dryCost -= #$mixLFCost$ | |
@cost -= #$mixLFCost$ | |
// Cost 2 * LF + OX | |
%mixLFCost2 = 0 | |
%LF2 = #$LF$ | |
@LF2 *= 2 | |
@tempVar = #$LF2$ | |
@tempVar *= 0.8 | |
@mixLFCost2 += #$tempVar$ | |
%OX2 = #$totalCap$ | |
@OX2 -= #$LF2$ | |
@tempVar = #$OX2$ | |
@tempVar *= 0.18 | |
@mixLFCost2 += #$tempVar$ | |
// Cost LF only | |
@tempVar = #$totalCap$ | |
@tempVar *= 0.18 | |
@LFCost += #$tempVar$ | |
// Cost OX only | |
@tempVar = #$totalCap$ | |
@tempVar *= 0.18 | |
@OXCost += #$tempVar$ | |
@tempVar = 0 | |
MODULE { | |
name = FSfuelSwitch | |
resourceNames = LiquidFuel,Oxidizer;LiquidFuel,Oxidizer;LiquidFuel;Oxidizer | |
resourceAmounts = #$../LF$,$../OX$;$../LF2$,$../OX2$;$../totalCap$;$../totalCap$ | |
tankCost = #$../mixLFCost$;$../mixLFCost2$;$../LFCost$;$../OXCost$ | |
displayCurrentTankCost = true | |
hasGUI = true | |
showInfo = true | |
availableInFlight = false | |
availableInEditor = true | |
basePartMass = #$../mass$ | |
tankMass = 0;0;0;0;0 | |
} | |
!RESOURCE[LiquidFuel] {} | |
!RESOURCE[Oxidizer] {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment