Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config tool for resources #122

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
226 changes: 226 additions & 0 deletions GameData/KerbalismConfig/ConfigTool.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
@PART:HAS[@ROKConfigTool]:FINAL
dgfl-gh marked this conversation as resolved.
Show resolved Hide resolved
{
// ##############################
// Resources that are handled
// ##############################
// Food
// Water
// Oxygen
// Waste
// Waste Water
//
// LiOH if wanted
// KO2 if wanted
// CO2 tanks for Vacuum scrubber if wanted

// ##############################
// Values that can be set:
// ##############################
// Crew = int - Defaults to CrewCapacity, number fo crewmembers
// Days = int - Number of days of supplies
// Scrubber = LiOH, KO2, Vacuum
// OxygenProduction = True - Oxygen provided by LOX to GOX converter or Electrolyzer
// WaterProduction = True - Water provided by Fuel cells or other process
// AppendDescription = True - Adds "Supports X crew for Y days." to description
// ReuseVolume = True - Do not add volume to the MFT

// Default consumption rates and values
// Rates per kerbal-day
@ROKConfigTool
{
// Default values / Set up variables
&Crew = #$/CrewCapacity$
&Days = 0
Volume = 0
Waste = 0
// Rates
Food = 5.84928
Oxygen = 591.84
Water = 3.87072
}

@ROKConfigTool:HAS[#Scrubber[LiOH]]
{
LiOH = 1.027296
@LiOH *= #$Crew$
@LiOH *= #$Days$
@Volume += #$LiOH$

LiOHWaste = 1.397088
@LiOHWaste *= #$Crew$
@LiOHWaste *= #$Days$
@Waste += #$LiOHWaste$
}

@ROKConfigTool:HAS[#Scrubber[KO2]]
{
KO2 = 1.155168
@KO2 *= #$Crew$
@KO2 *= #$Days$
@Volume += #$KO2$

KO2Waste = 1.80225
@KO2Waste *= #$Crew$
@KO2Waste *= #$Days$
@Waste += #$KO2Waste$
// More oxygen than consumed is returned, set flag to true
%OxygenProduction = True
}

@ROKConfigTool:HAS[#Scrubber[Vacuum]]
{
CO2 = 591.84
@CO2 *= 1 // Store 1 days worth of CO2
@CO2 *= #$Crew$
// CO2 is a gas, divide tank volume by 1000
CO2Volume = #$CO2$
@CO2Volume /= 1000
@Volume += #$CO2Volume$
}

@ROKConfigTool:HAS[#OxygenProduction[?rue]]
{
// Oxygen production exists, limit storage to 1 day
@Oxygen *= 1
@Oxygen *= #$Crew$
}

@ROKConfigTool:HAS[~OxygenProduction[?rue]]
{
@Oxygen *= #$Crew$
@Oxygen *= #$Days$
}

@ROKConfigTool:HAS[#WaterProduction[?rue]]
{
// Water production exists, limit storage to 1 day
@Water *= 1
@Water *= #$Crew$
}

@ROKConfigTool:HAS[~WaterProduction[?rue]]
{
@Water *= #$Crew$
@Water *= #$Days$
}

@ROKConfigTool
{
@Food *= #$Crew$
@Food *= #$Days$
@Volume += #$Food$

WasteWater = 3.87072
@WasteWater *= 1 //Store 1 days worth of waste water
@WasteWater *= #$Crew$
@Volume += #$WasteWater$

// Oxygen is a gas, divide needed tank volume by 1000
OxygenVolume = #$Oxygen$
@OxygenVolume /= 1000
@Volume += #$OxygenVolume$

@Volume += #$Water$
@Volume += #$Waste$
}
}

@PART:HAS[@ROKConfigTool:HAS[~Food[0],~ReuseVolume[?rue]]]:FINAL
{
%MODULE[ModuleFuelTanks]
{
&volume = 0
@volume += #$/ROKConfigTool/Volume$
}
}

@PART:HAS[@ROKConfigTool:HAS[~Food[0]]]:FINAL
{
@MODULE[ModuleFuelTanks]
{
TANK
{
name = Food
amount = #$/ROKConfigTool/Food$
maxAmount = #$/ROKConfigTool/Food$
}

TANK
{
name = Oxygen
amount = #$/ROKConfigTool/Oxygen$
maxAmount = #$/ROKConfigTool/Oxygen$
}

TANK
{
name = Water
amount = #$/ROKConfigTool/Water$
maxAmount = #$/ROKConfigTool/Water$
}

TANK
{
name = Waste
amount = 0
maxAmount = #$/ROKConfigTool/Waste$
}

TANK
{
name = WasteWater
amount = 0
maxAmount = #$/ROKConfigTool/WasteWater$
}
}
}

@PART:HAS[@ROKConfigTool:HAS[#LiOH]]:FINAL
{
@MODULE[ModuleFuelTanks]
{
TANK
{
name = LithiumHydroxide
amount = #$/ROKConfigTool/LiOH$
maxAmount = #$/ROKConfigTool/LiOH$
}
}
}

@PART:HAS[@ROKConfigTool:HAS[#KO2]]:FINAL
{
@MODULE[ModuleFuelTanks]
{
TANK
{
name = PotassiumSuperoxide
amount = #$/ROKConfigTool/KO2$
maxAmount = #$/ROKConfigTool/KO2$
}
}
}

@PART:HAS[@ROKConfigTool:HAS[#CO2]]:FINAL
{
@MODULE[ModuleFuelTanks]
{
TANK
{
name = CarbonDioxide
amount = 0
maxAmount = #$/ROKConfigTool/CO2$
}
}
}

@PART:HAS[@ROKConfigTool:HAS[#AppendDescription[?rue]]]:FINAL
{
@description = #$description$ Supports a crew of $/ROKConfigTool/Crew$ for $/ROKConfigTool/Days$ days.
}

// Cleanup
@PART:HAS[@ROKConfigTool]:FINAL
{
!ROKConfigTool {}
}