Jump to content

[1.9-1.10] Configurable Containers


allista

Recommended Posts

Configurable Containers

Requirements

Download from SpaceDock

For Players

This mod converts fuel tanks and resource containers so that you can change the resource(s) they hold in Editor and in Flight.

Supported Mods

Configurable Containers support many part packs and mods:

  • TweakScale
  • ProceduralParts
  • Parts with stock resources converted:
    • Stock
    • KW Rocketry
    • Mk2 Expansion
    • Mk3 Expansion
    • SpaceY-Lifters
    • SpaceY-Expanded
    • Fuel Tanks Plus
    • Modular Rocket Systems
    • Standard Propulsion Systems
    • Near Future Propulsion
    • Spherical and Toroidal Tank Pack
    • OPT Spaceplane Parts (made by octarine-noise)
    • Dodo Labs - Stockalike Electron
    • Mk2 Hypersonic Systems
    • Mk-X
    • Hyper Propulsion
    • …more will come.
  • Supported resources:
    • Stock
    • TAC Life Support
    • Extrapalentary Launchapads
    • Near Future Propulsion
    • All USI
    • All KSPIE
    • …more will come.

Types of the Containers

Tank Type is a set of resources that, gamewise, have something in common. For example gases, or liquid chemicals, or metals. There are also two kinds of configurable containers.

  • Simple containers belong to a single Tank Type (which can be changed in Editor) and can hold only a single resource. In flight this resource may be changed only if the container is empty, and only within its Tank Type.
  • Compound containers are in fact collections of simple containers inside of a single part. In Editor you can partition the inside space of such part, creating as many simple containers as you need. The only restriction imposed by KSP is that a part cannot have two identical resources stored. So if you have two containers for liquid chemicals in a part, only one of them can hold Liquid Fuel.

Compound containers have a dedicated user interface so as not to clutter part menu:

TankManager GUI

For Modders

Source Code

CC is a part of the AT_Utils framework.

It provides the SwitchableTank module that allows for creation of container parts for predefined sets of resources switchable in-flight. Sets are configured in a separate .cfg file and are intended to contain similar things like gases (one set), liquid chemicals (another) and so on.

Another module Configurable Containers provide is the TankManager which enables in-editor partitioning of a container, effectively converting it into a set of independent SwitchableTanks.

The third, utility module named SimpleTextureSwitcher allows you to cycle through a predefined set of textures for the model or a part of the model, so a container may be easily identified. It is now part of the main AT_Utils.dll, not the CC itself.

Acknowledgments

My patrons on Patreon. Thank you for your support!

 

  • Kevin Casey
  • Bob Palmer
  • Ryan Rasmussen
  • Matthew Zaleski
  • Bart Blommaerts
  • eL.Dude
  • Layne Benofsky
  • Igor Zavoychinskiy
  • Issarlk
  • Meiyo
  • BP
  • Jenna Mitchell
  • Squiddy
  • Ted Achenbach
  • SCESW
  • Patrice Hédé
  • Steve Victory
Edited by allista
New version released
Link to comment
Share on other sites

I love it! Does this work with the procedural parts (tanks) mod?

13 minutes ago, BigFatStupidHead said:

This looks very nice! Is there a way to set internal tanks to a given ratio? (ie: if I want a tank with 3 parts Liquidfuel to 1.4 parts oxidizer)

Modular Fuel Tanks has this option. It was looking at installed engines and provided the right fuel mix at the press of a button.

Link to comment
Share on other sites

1 hour ago, BigFatStupidHead said:

This looks very nice! Is there a way to set internal tanks to a given ratio? (ie: if I want a tank with 3 parts Liquidfuel to 1.4 parts oxidizer)

Initially, you can only set exact volumes of internal tanks (I'll think of adding ratio control as well). But once you have the desired configuration, you can name it, save (see the lower row of controls in the UI) and use as if it was another Tank Type. This configuration will contain ratios and will partition the volume you give it accordingly. The stock LFO configuration is already there.

55 minutes ago, Kolago said:

I love it! Does this work with the procedural parts (tanks) mod?

Modular Fuel Tanks has this option. It was looking at installed engines and provided the right fuel mix at the press of a button.

Not yet. And I don't know right now if I can make them work together. There's two issues I see: first, procedural parts should have their own way of scaling amounts of resources, which will interfere with CC; second, CC should somehow get the volume of a procedural part.

As far as I know (correct me if I'm wrong), a significant difference between CC and MFT is that CC allows resource switching in flight. When I first created this framework as a part of the Hangar mod, this was the prime reason.

Link to comment
Share on other sites

5 minutes ago, allista said:

Not yet. And I don't know right now if I can make them work together. There's two issues I see: first, procedural parts should have their own way of scaling amounts of resources, which will interfere with CC; second, CC should somehow get the volume of a procedural part.

As far as I know (correct me if I'm wrong), a significant difference between CC and MFT is that CC allows resource switching in flight. When I first created this framework as a part of the Hangar mod, this was the prime reason.

MFT some how managed to get the size of PP tanks and tweakscale. May you can take a look at the source of MFT at github.

https://github.com/NathanKell/ModularFuelSystem

I opened a request for the "switching in flight function" there, but as of now, it is not realized.

Link to comment
Share on other sites

26 minutes ago, Kolago said:

MFT some how managed to get the size of PP tanks and tweakscale. May you can take a look at the source of MFT at github.

https://github.com/NathanKell/ModularFuelSystem

I opened a request for the "switching in flight function" there, but as of now, it is not realized.

I'll look into it, yea.

The thing is, CC was not originally created as a framework for patching parts from other mods, but to create new parts and add its functionality to mods that use it as a library. In the Hangar, for example, CC allows dynamic creation of resource tanks inside hollowed asteroids. But since it went public, I will of course try to provide support for mods with resource tanks.

Edited by allista
Link to comment
Share on other sites

On 10/16/2016 at 0:39 AM, Kolago said:

MFT some how managed to get the size of PP tanks and tweakscale. May you can take a look at the source of MFT at github.

https://github.com/NathanKell/ModularFuelSystem

I opened a request for the "switching in flight function" there, but as of now, it is not realized.

I've added initial support of ProceduralParts (including a patch), but I'll have to wait for PP to be updated to 1.2 to test it.

I've also added TweakScale support. Will need to test it too.

Edited by allista
Link to comment
Share on other sites

This does not seem to work with TAC-LS

I see this section in your config file...

 

TANKTYPE:NEEDS[TacLifeSupport|KolonyTools]
{
	name = Food
	UsefulVolumeRatio = 0.95 //cargo needs additional fixation and compartmetalization
	TankCostPerSurface = 2 //pressurized
	PossibleResources = 
}
@TANKTYPE[Food]:NEEDS[TacLifeSupport]
{ @PossibleResources = Food 0.8; }
@TANKTYPE[Food]:NEEDS[KolonyTools]
{ @PossibleResources = Supplies 0.8; }

However the tank when set to "Food" only shows "Supplies" so TAC-LS does not see it as a food source... 

the above code looks like it should work to me, so I am not sure what is going on.  I am no MM syntax expert however, so I could be wrong.

 

I can just remove the ref. to KolonyTools I guess and see if that works, but just passing this along so you are aware.

 

 

EDIT: Oh right it is because the USI section is in the list second so it over writes the TAC section.  The thing is I do not have USI-LS installed.  the MM config here says to do this if "KolonyTools" is installed but this is installed with MKS/OKS even if you do not use USI-LS.  you need to change this section to trigger on USI-LS instead.

 

 

 

EDIT:  After using this a bit I have a request.  the UI is great but it needs a way to "edit" a tank.  after I go in and divide up the tank into smaller bits there is not a way (that I can see) to go back and easily change these values.  You must delete the original resource definition and then go in and make a new one.  you have a button that "sets the tank to all remaining space" instread if this button would just pop up a numeric entry box and allow us to type a new number and then have the little arrows to the sides for ticking up and down that would be nice.  or maybe the text entry box and a slider control or something...

and as a secondary request it also would be nice if you had a tank setup as "TAC-LS" or any other LS mod for that matter and it would put in "Food", "Water", and  "Oxygen" in the correct ratios that make them all come out to the same number of days for us.  so we could just type in the box the number of days of LS we want and it will make the tanks for us.  This is due to the idea of I plan a mission to Duna.  I know it will take a certain number of days to get there, and do what ever and then come back.  therefor I would like to be able to just tell the tank setup to give me X number of days of LS rather than fiddle with the values to try and make them all come out to the right number.  this is a very specific request I know, so I do not know if you are interested in doing this.  but if so I am sure there are other mods out there that could benefit from this sort of a tank setup.

Edited by Bit Fiddler
Link to comment
Share on other sites

4 hours ago, Bit Fiddler said:

This does not seem to work with TAC-LS

I see this section in your config file...

 


TANKTYPE:NEEDS[TacLifeSupport|KolonyTools]
{
	name = Food
	UsefulVolumeRatio = 0.95 //cargo needs additional fixation and compartmetalization
	TankCostPerSurface = 2 //pressurized
	PossibleResources = 
}
@TANKTYPE[Food]:NEEDS[TacLifeSupport]
{ @PossibleResources = Food 0.8; }
@TANKTYPE[Food]:NEEDS[KolonyTools]
{ @PossibleResources = Supplies 0.8; }

However the tank when set to "Food" only shows "Supplies" so TAC-LS does not see it as a food source... 

the above code looks like it should work to me, so I am not sure what is going on.  I am no MM syntax expert however, so I could be wrong.

EDIT: Oh right it is because the USI section is in the list second so it over writes the TAC section.  The thing is I do not have USI-LS installed.  the MM config here says to do this if "KolonyTools" is installed but this is installed with MKS/OKS even if you do not use USI-LS.  you need to change this section to trigger on USI-LS instead.

Thanks for the report! The bug is indeed in that the KolonyTools are overwriting TAC-LS edit. And you right of course about KolonyTools vs USI-LS part. The correct code is, so you can just replace the corresponding lines:

@TANKTYPE[Food]:NEEDS[TacLifeSupport]
{ @PossibleResources ^= :$: Food 0.8;: }
@TANKTYPE[Food]:NEEDS[USILifeSupport]
{ @PossibleResources ^= :$: Supplies 0.8;: }

*I'll answer the second part in a bit

Link to comment
Share on other sites

4 hours ago, Bit Fiddler said:

EDIT:  After using this a bit I have a request.  the UI is great but it needs a way to "edit" a tank.  after I go in and divide up the tank into smaller bits there is not a way (that I can see) to go back and easily change these values.  You must delete the original resource definition and then go in and make a new one.  you have a button that "sets the tank to all remaining space" instread if this button would just pop up a numeric entry box and allow us to type a new number and then have the little arrows to the sides for ticking up and down that would be nice.  or maybe the text entry box and a slider control or something...

and as a secondary request it also would be nice if you had a tank setup as "TAC-LS" or any other LS mod for that matter and it would put in "Food", "Water", and  "Oxygen" in the correct ratios that make them all come out to the same number of days for us.  so we could just type in the box the number of days of LS we want and it will make the tanks for us.  This is due to the idea of I plan a mission to Duna.  I know it will take a certain number of days to get there, and do what ever and then come back.  therefor I would like to be able to just tell the tank setup to give me X number of days of LS rather than fiddle with the values to try and make them all come out to the right number.  this is a very specific request I know, so I do not know if you are interested in doing this.  but if so I am sure there are other mods out there that could benefit from this sort of a tank setup.

First request -- granted! Will do in the next release.

Second... is tricky:

  • The first part (a configuration that uses right proportions) is already there: you can create the needed tank setup once, then save it and use as a new tank type from now on. I can even add such tank type into distributive, but then I will have to track the changes in corresponding mods.
  • The second part (using days instead of volume), though, is hard: for that I either need to somehow tap into the LS mod and get corresponding units/day ratios; or I can manually search the code/configs of the mod and then hard-code these ratios. The former may result in a complex reflection implementation; and both will be susceptible to the mod's API change.

I thought about implementing some sort of automatic tank setups discovery (like the one described above for MFT), but that will require some sort of part filtering: CC is not about fuel tanks, so scanning only engines won't do; on the other hand, scanning ALL parts will produce too many tank setups that nobody will ever use. And there's also a matter of fuzzy definitions: you would want to define a tank setup by ratios, right? But 45/55 may not be exactly the same as 90/110, because of the floating-point error. But, I still inclined to try to implement this.

Link to comment
Share on other sites

so if I set up a tankratio that gives me the same number of days for food water oxygen and save it as a tank type...

 

I then recall that tank type the ratios will be intact and scale the current tank to be full with this ratio?

 

I mean lets say I start off with a 5l. tank.  get all the ratios correct and  save it.   I then apply this type to a 100l. tank I will get the full 100 liter tank with the correct ratios? 

Link to comment
Share on other sites

1 minute ago, Bit Fiddler said:

so if I set up a tankratio that gives me the same number of days for food water oxygen and save it as a tank type...

 

I then recall that tank type the ratios will be intact and scale the current tank to be full with this ratio?

 

I mean lets say I start off with a 5l. tank.  get all the ratios correct and  save it.   I then apply this type to a 100l. tank I will get the full 100 liter tank with the correct ratios? 

Correct!

Link to comment
Share on other sites

ah well this does help somewhat assuming I just need to pack in as much LS as possible.   but what about if I then want to use that "type" but only use 50 liters of that 100?  is this possible?

 

with all this math in mind....  we now only have 3 decimal places to work with in the volume field...   could you open this up to more for finer tuning of the ratios?  maybe even as many as 10...  this may be over kill, 5 or 6 may be plenty...

 

also   again a bug maybe?  but I have found some tanks where the "edit tank setup" button is not there.  but I can still cycle it with all the predefined tank types...

Link to comment
Share on other sites

4 minutes ago, Bit Fiddler said:

ah well this does help somewhat assuming I just need to pack in as much LS as possible.   but what about if I then want to use that "type" but only use 50 liters of that 100?  is this possible?

with all this math in mind....  we now only have 3 decimal places to work with in the volume field...   could you open this up to more for finer tuning of the ratios?  maybe even as many as 10...  this may be over kill, 5 or 6 may be plenty...

When you have a saved tank setup, you may apply it to a portion of a volume like any other tank type: you just define the volume you need, choose the setup in the list of tank types and Add the "tank". As a result, several real tanks will be added, dividing given volume by using saved ratios.

Hmm... I'll try to think something up. Too many digits will eat up GUI space and may frighten some users)

Link to comment
Share on other sites

well the ability to apply the tank type to a sub division fixes all that hassle with the ratio bit...  so no need to worry about automating that unless it turns out to be an easy addition.   and as for the editing maybe only show the "larger field" if you hit that edit button.  and just leave it at 3 in the standard input at the top of the GUI.

 

 

however armed with this new knowledge..  if I was to edit the cfg files for a tank type can I put more than 3 decimal places?   if this is possible it is fine ill do the math and just edit the values into a MM patch for my custom tank type...

I think now that I understand this mod's inner working a bit more that I really like it.  it will be a must have mod for me from now on.  I used to use modular fuel tanks and interstellar fuel switch etc.  but this one is talking me in new directions I really like with the on the fly changing and the ability to save tank types..   

 

 

keep up the good work.:prograde:

Link to comment
Share on other sites

3 minutes ago, Bit Fiddler said:

well the ability to apply the tank type to a sub division fixes all that hassle with the ratio bit...  so no need to worry about automating that unless it turns out to be an easy addition.   and as for the editing maybe only show the "larger field" if you hit that edit button.  and just leave it at 3 in the standard input at the top of the GUI.

however armed with this new knowledge..  if I was to edit the cfg files for a tank type can I put more than 3 decimal places?   if this is possible it is fine ill do the math and just edit the values into a MM patch for my custom tank type...

Thanks for the suggestion, this may work.

You don't even need the MM patch: custom tank setups are saved in the GameData/ConfigurableContainers/VolumeConfigs.user file. You can edit it all you want, it won't be overwritten on update, and the setups you have there will be available through all your saves and games.

Link to comment
Share on other sites

3 minutes ago, Bit Fiddler said:

but can I use more than 3 decimal places in the cfg file?  or am I limited to 3 there as well?

Sorry :blush: You can.

Saved values are floats so you have 7 digit precision, wherever the decimal point is (123.4567, 0.123456, etc.).

Also, the Volumes in a saved tank setup are arbitrary: when you apply a setup they are divided by their sum. And the saved total Volume is not used, so you don't need to edit it.

Link to comment
Share on other sites

cool thanks...    going to see if I can get the correct ratios for TAC now and make a custom tank cfg.   I will post back here what I find so you can either include it in your mod or atleast let others see the values.

well since this all we care about are ratios...

 

FoodConsumptionRate = 1.6927083333E-05

WaterConsumptionRate = 1.1188078704E-05

OxygenConsumptionRate = 0.001713537562385

 

can read this right out of the mods configuration file.  so can easily make a tank setup.  not sure what time hack is used here to figure out a per day or per hour value.  but the ratios are here

 

 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...