Jump to content

[1.9-1.10] Configurable Containers


allista

Recommended Posts

when it happens again I will pay closer attention..  but basically you get a resource definition in a tank that cant be removed and cant be used.  and it will prevent you from adding in another of that type.  I am fairly sure it happened when I told it to put 2 food tanks on the same physical part. 

 

the only way I could fix it is to delete the physical tank and place a new one.

 

ok yes..  I add an LFO tank to a part.  then I add a new LFO tank to the same part.  once this is done there are now the 2 useless LFO entries on the part,  and you can't delete them.

Edited by Bit Fiddler
Link to comment
Share on other sites

1 hour ago, Bit Fiddler said:

ok yes..  I add an LFO tank to a part.  then I add a new LFO tank to the same part.  once this is done there are now the 2 useless LFO entries on the part,  and you can't delete them.

Thanks again! Found and fixed this.

Link to comment
Share on other sites

3 hours ago, LitaAlto said:

I'm not sure if it's even possible -- but it would be nifty to have a "wet workshop" option that replaces resources with crew.

How do you mean? A Jumbo-64 packed with kerbals? I'd say, we should add a blender there to increase storage capacity! :confused:

Seriously, dynamic crew capacity is possible (doesn't TweakScale deal with it already?), but I really don't understand the idea of a closed metal barrel with people.

Edited by allista
Link to comment
Share on other sites

6 minutes ago, allista said:

How do you mean? A Jumbo-64 packed with kerbals? I'd say, we should add a blender there to increase storage capacity! :confused:

Seriously, dynamic crew capacity is possible (doesn't TweakScale deal with it already?), but I really don't understand the idea of a closed metal barrel with people.

Doesn't that describe every space station ever? :wink:

More to the point, it'd be nice to be able to reproduce Skylab with stock parts. I don't believe TweakScale lets you do that...? FWIW I'm certainly not suggesting Infinite Kerbals in a Tube.

Edited by LitaAlto
Link to comment
Share on other sites

26 minutes ago, CraftyDwarf said:

Hey, I am trying to do some things with the Rock you get from some of theasteroid mods, Can you tell me how to add a resourcce to the group somewhere?

You need the GameData/ConfigurableContainers/TankTypes.cfg file. There, i suppose, you would want to add the Rock into the Soil tank type, like this:

@TANKTYPE[Soil]:NEEDS[OneAsteroidMod|AnotherAsteroidMod] //name the mods you know that use Rock, separated by | symbol
{ @PossibleResources ^= :$: Rock 0.7;: }

Note, that mod name in the NEEDS directive is generally not its public name, but a name of its .dll file. For example, USI-MKS is identified as KolonyTools.

And please, share the result with us, so I can add them to the mod.

28 minutes ago, LitaAlto said:

Doesn't that describe every space station ever? :wink:

More to the point, it'd be nice to be able to reproduce Skylab with stock parts. I don't believe TweakScale lets you do that...? FWIW I'm certainly not suggesting Infinite Kerbals in a Tube.

You have a point :D

Still, resources and crew capacity are so completely different in terms of KSP API, so I could not do it without core rewriting and It would be more appropriate to make it a separate mod.

Link to comment
Share on other sites

It appears to work, just your density of storage is different from the one existing storage item. I am looking  over how the densities work in your mod and others, and try to find a consensus of some sort.

you already had a soil item list for the KolonyTools, so I inserted it into the list. Looking at how number should be before I post my add.

Edited by CraftyDwarf
Left out detail requested.
Link to comment
Share on other sites

11 hours ago, allista said:

How do you mean? A Jumbo-64 packed with kerbals? I'd say, we should add a blender there to increase storage capacity! :confused:

Seriously, dynamic crew capacity is possible (doesn't TweakScale deal with it already?), but I really don't understand the idea of a closed metal barrel with people.

heh, this reminds me of the Kethane mod... You could turn Kerbals into kethane (for emergencies only of course).

 

Anywho, your mod is awesome.

One question though, is there anyway to specify separate empty masses for different resources? Xenon gas generally seems to have heavier empty tanks vs LFO for instance.

Edited by Nori
Link to comment
Share on other sites

Hmmm just thinking aloud here...

 

 

@PART
[*]:HAS[!RESOURCE[ElectricCharge],!RESOURCE[SolidFuel],@RESOURCE
[*],!MODULE[GPOSpeedPump]]:NEEDS[GPOSpeedFuelPump]
{
    MODULE
    {
        name = GPOSpeedPump
    }
}

could this be made to make your mod grab every "tank" in the game?  leaving out ElectricCharge and SolidFuel?  or even include ElectricCharge...  why not have batteries in the mix?

 

this way all those tank mods out there can benefit from this mod with very little effort on your part to try and add them all manually to your mod.

Link to comment
Share on other sites

15 minutes ago, Nori said:

heh, this reminds me of the Kethane mod... You could turn Kerbals into kethane (for emergencies only of course).

Anywho, your mod is awesome.

One question though, is there anyway to specify separate empty masses for different resources? Xenon gas generally seems to have heavier empty tanks vs LFO for instance.

Not yet. I somehow never thought of it. Different tank types utilize different amount of their space for resources and have different cost; but they don't modify mass. Which is strange :blush:

Link to comment
Share on other sites

3 minutes ago, Bit Fiddler said:

Hmmm just thinking aloud here...


@PART
[*]:HAS[!RESOURCE[ElectricCharge],!RESOURCE[SolidFuel],@RESOURCE
[*],!MODULE[GPOSpeedPump]]:NEEDS[GPOSpeedFuelPump]
{
    MODULE
    {
        name = GPOSpeedPump
    }
}

could this be made to make your mod grab every "tank" in the game?  leaving out ElectricCharge and SolidFuel?  or even include ElectricCharge...  why not have batteries in the mix?

this way all those tank mods out there can benefit from this mod with very little effort on your part to try and add them all manually to your mod.

Except that I need the code to convert resource amount to the Volume... hmm... but this kinda makes sense: theoretically, I could add the autoconfiguration code into the ModuleSwitchableTank and ModuleTankManager themselves. And it will calculate needed values based on the found resources and tank types. But then I will have to somehow remove resource definitions from the part prefabs, or the predefined resources would be added to parts on each load. And it's much less flexible than patches for particular parts. Also, not every mod needs/wants to be patched. Besides, I currently have a python script that generates patches for any set of containers with stock resources (Ore, Xenon, LF, Ox, LFO) in one go.

All in all, I won't make this a priority just yet. The dry mass problem buggs me much more...

Link to comment
Share on other sites

14 minutes ago, allista said:

Not yet. I somehow never thought of it. Different tank types utilize different amount of their space for resources and have different cost; but they don't modify mass. Which is strange :blush:

Well if it isn't too hard to do, I would appreciate something like that. It's my main complaint with other switching options. You have to manually specify mass for every tank which drives me crazy. If this mod had a config that did proper mass, I could just replace all the other switchers.  :)

 

edit:

2 minutes ago, allista said:

~snip~ The dry mass problem buggs me much more...

Opps.. :P

Edited by Nori
Link to comment
Share on other sites

Just now, Nori said:

Well if it isn't too hard to do, I would appreciate something like that. It's my main complaint with other switching options. You have to manually specify mass for every tank which drives me crazy. If this mod had a config that did proper mass, I could just replace all the other switchers.  :)

It's of moderate complexity. But I'll do it no matter, because I just can't understand why I didn't in the first place!

Link to comment
Share on other sites

maybe I do not understand the problem with removing...  but MM can remove lines as well as add them yes?  or is this at a point that MM is done and cant remove lines for you?

 

well even without this automated system the fact I can go in and make it work with any mod I want is ok by me even.  if the automated stuff is just not going to work, I have no problem making the modifications to various cfg files that I need to do on my own.  as @Nori said this mod is quickly going to replace any type of fuel / texture switching mod I use.

Edited by Bit Fiddler
Link to comment
Share on other sites

2 minutes ago, Bit Fiddler said:

maybe I do not understand the problem with removing...  but MM can remove lines as well as add them yes?  or is this at a point that MM is done and cant remove lines for you?

Exactly. What I mean is that I can't make MM to do the "units to volume based on TankTypes.cfg" math. So I need to make it inside my modules, when the game is already up and running. But then I would need to modify the compiled part prefabs. And I'm not sure what consequences will follow... 

Link to comment
Share on other sites

2 minutes ago, Bit Fiddler said:

maybe I do not understand the problem with removing...  but MM can remove lines as well as add them yes?  or is this at a point that MM is done and cant remove lines for you?

MM has a lot of options and can indeed delete RESOURCE and MODULE definitions.

CryoEngines has a patch to modify all tanks if they don't already have a switcher. This mod would be simpler though as you don't need to define the resources, just volume.

Spoiler

// Lifting tanks
@PART[*]:HAS[@RESOURCE[LiquidFuel],@RESOURCE[Oxidizer],!MODULE[InterstellarFuelSwitch],!MODULE[ModuleEnginesFX],!MODULE[ModuleEngines],!MODULE[FSfuelSwitch]]:NEEDS[!modularFuelTanks&!RealFuels]:FOR[zzz_CryoTanks]
{
	%LF = #$RESOURCE[LiquidFuel]/maxAmount$
	%OX = #$RESOURCE[Oxidizer]/maxAmount$
	
	%totalCap = #$RESOURCE[LiquidFuel]/maxAmount$
	@totalCap += #$RESOURCE[Oxidizer]/maxAmount$
	
	%massOffset = #$totalCap$
	@massOffset *= 0.000625 // standard dry mass per units of LF/OX
	@massOffset *= -1
	
	@LF *= #$@RESOURCE_DEFINITION[LiquidFuel]/unitCost$
	@OX *= #$@RESOURCE_DEFINITION[Oxidizer]/unitCost$
	
	%costOffset = #$LF$
	@costOffset += #$OX$
	@costOffset *= -1
	
	!RESOURCE[LiquidFuel] {}
	!RESOURCE[Oxidizer] {}
	
	MODULE
	{
		name = ModuleB9PartSwitch
		moduleID = fuelSwitch
		switcherDescription = Tank Type
		baseVolume = #$../totalCap$
		SUBTYPE
		{
			name = LF/O
			tankType = LFOX
			addedMass = #$../../massOffset$
			addedCost = #$../../costOffset$
		}
		
		SUBTYPE
		{
			name = LH2/O
			tankType = LH2O
			addedMass = #$../../massOffset$
			addedCost = #$../../costOffset$
		}
		SUBTYPE
		{
			name = LH2
			tankType = LH2
			addedMass = #$../../massOffset$
			addedCost = #$../../costOffset$
		}
		SUBTYPE
		{
			name = Oxidizer
			tankType = OX
			addedMass = #$../../massOffset$
			addedCost = #$../../costOffset$
		}
		SUBTYPE
		{
			name = LiquidFuel
			tankType = LF
			addedMass = #$../../massOffset$
			addedCost = #$../../costOffset$
		}
	}
	
	MODULE
	{
		name =  ModuleCryoTank
		FuelName = LqdHydrogen
		// in % per hr
		BoiloffRate = 0.05
	}
}
// ZBO tanks
@PART[*]:HAS[@RESOURCE[LqdHydrogen],!MODULE[InterstellarFuelSwitch],!MODULE[ModuleEnginesFX],!MODULE[ModuleEngines],!MODULE[FSfuelSwitch]]:NEEDS[!modularFuelTanks&!RealFuels]:FOR[zzz_CryoTanks]
{
	%LH2 = #$RESOURCE[LqdHydrogen]/maxAmount$
	
	%massOffset = #$LH2$
	@massOffset *= 0.00003125 // <- EDIT HERE (dry mass per unit LH2 capacity)
	@massOffset *= -1
	
	%costOffset = #$LH2$
	@costOffset *= #$@RESOURCE_DEFINITION[LqdHydrogen]/unitCost$
	@costOffset *= -1
	
	!RESOURCE[LqdHydrogen] {}
	
	MODULE
	{
		name = ModuleB9PartSwitch
		moduleID = fuelSwitch
		switcherDescription = Tank Type
		baseVolume = #$../LH2$
		@baseVolume *= 0.1
		
		SUBTYPE
		{
			name = LH2/O
			tankType = LH2OCryo
			addedMass = #$../../massOffset$
			addedCost = #$../../costOffset$
		}
		SUBTYPE
		{
			name = LH2
			tankType = LH2Cryo
			addedMass = #$../../massOffset$
			addedCost = #$../../costOffset$
		}
		SUBTYPE
		{
			name = Oxidizer
			tankType = OX
			addedMass = #$../../massOffset$
			addedCost = #$../../costOffset$
		}
		
	}
	
	MODULE
	{
		name =  ModuleCryoTank
		FuelName = LqdHydrogen
		// in % per hour
		BoiloffRate = 0.05
		// in Ec per 1000 units per second
		CoolingCost = 0.08
	}
}

 

 

Link to comment
Share on other sites

4 minutes ago, Nori said:

MM has a lot of options and can indeed delete RESOURCE and MODULE definitions.

CryoEngines has a patch to modify all tanks if they don't already have a switcher. This mod would be simpler though as you don't need to define the resources, just volume.

  Hide contents


// Lifting tanks
@PART[*]:HAS[@RESOURCE[LiquidFuel],@RESOURCE[Oxidizer],!MODULE[InterstellarFuelSwitch],!MODULE[ModuleEnginesFX],!MODULE[ModuleEngines],!MODULE[FSfuelSwitch]]:NEEDS[!modularFuelTanks&!RealFuels]:FOR[zzz_CryoTanks]
{
	%LF = #$RESOURCE[LiquidFuel]/maxAmount$
	%OX = #$RESOURCE[Oxidizer]/maxAmount$
	
	%totalCap = #$RESOURCE[LiquidFuel]/maxAmount$
	@totalCap += #$RESOURCE[Oxidizer]/maxAmount$
	
	%massOffset = #$totalCap$
	@massOffset *= 0.000625 // standard dry mass per units of LF/OX
	@massOffset *= -1
	
	@LF *= #$@RESOURCE_DEFINITION[LiquidFuel]/unitCost$
	@OX *= #$@RESOURCE_DEFINITION[Oxidizer]/unitCost$
	
	%costOffset = #$LF$
	@costOffset += #$OX$
	@costOffset *= -1
	
	!RESOURCE[LiquidFuel] {}
	!RESOURCE[Oxidizer] {}
	
	MODULE
	{
		name = ModuleB9PartSwitch
		moduleID = fuelSwitch
		switcherDescription = Tank Type
		baseVolume = #$../totalCap$
		SUBTYPE
		{
			name = LF/O
			tankType = LFOX
			addedMass = #$../../massOffset$
			addedCost = #$../../costOffset$
		}
		
		SUBTYPE
		{
			name = LH2/O
			tankType = LH2O
			addedMass = #$../../massOffset$
			addedCost = #$../../costOffset$
		}
		SUBTYPE
		{
			name = LH2
			tankType = LH2
			addedMass = #$../../massOffset$
			addedCost = #$../../costOffset$
		}
		SUBTYPE
		{
			name = Oxidizer
			tankType = OX
			addedMass = #$../../massOffset$
			addedCost = #$../../costOffset$
		}
		SUBTYPE
		{
			name = LiquidFuel
			tankType = LF
			addedMass = #$../../massOffset$
			addedCost = #$../../costOffset$
		}
	}
	
	MODULE
	{
		name =  ModuleCryoTank
		FuelName = LqdHydrogen
		// in % per hr
		BoiloffRate = 0.05
	}
}
// ZBO tanks
@PART[*]:HAS[@RESOURCE[LqdHydrogen],!MODULE[InterstellarFuelSwitch],!MODULE[ModuleEnginesFX],!MODULE[ModuleEngines],!MODULE[FSfuelSwitch]]:NEEDS[!modularFuelTanks&!RealFuels]:FOR[zzz_CryoTanks]
{
	%LH2 = #$RESOURCE[LqdHydrogen]/maxAmount$
	
	%massOffset = #$LH2$
	@massOffset *= 0.00003125 // <- EDIT HERE (dry mass per unit LH2 capacity)
	@massOffset *= -1
	
	%costOffset = #$LH2$
	@costOffset *= #$@RESOURCE_DEFINITION[LqdHydrogen]/unitCost$
	@costOffset *= -1
	
	!RESOURCE[LqdHydrogen] {}
	
	MODULE
	{
		name = ModuleB9PartSwitch
		moduleID = fuelSwitch
		switcherDescription = Tank Type
		baseVolume = #$../LH2$
		@baseVolume *= 0.1
		
		SUBTYPE
		{
			name = LH2/O
			tankType = LH2OCryo
			addedMass = #$../../massOffset$
			addedCost = #$../../costOffset$
		}
		SUBTYPE
		{
			name = LH2
			tankType = LH2Cryo
			addedMass = #$../../massOffset$
			addedCost = #$../../costOffset$
		}
		SUBTYPE
		{
			name = Oxidizer
			tankType = OX
			addedMass = #$../../massOffset$
			addedCost = #$../../costOffset$
		}
		
	}
	
	MODULE
	{
		name =  ModuleCryoTank
		FuelName = LqdHydrogen
		// in % per hour
		BoiloffRate = 0.05
		// in Ec per 1000 units per second
		CoolingCost = 0.08
	}
}

 

 

Cool! I've tried this earlier, but with no luck.

Still, I prefer conventional programming to MM wherever possible, because MM is much harder to debug, the syntax is heavy and not-so-intuitive, there's no tools to highlight it, let alone autocomplete stuff... quasi-languages are always a nightmare to me :blush:

Link to comment
Share on other sites

@PART[*]:HAS[@RESOURCE[LiquidFuel],@RESOURCE[Oxidizer],!MODULE[InterstellarFuelSwitch],!MODULE[ConfigurableContainers],!MODULE[ModuleEnginesFX],!MODULE[ModuleEngines],!MODULE[FSfuelSwitch]]:NEEDS[!modularFuelTanks&!RealFuels]:FOR[ConfigurableContainers]
{
    MODULE
    {
        name = ModuleTankManager
        Volume = #$RESOURCE[LiquidFuel] * 0.013717
        DoCostPatch = True
        TANK
        {
            name = LFO
            Volume = 100.0
        }
    }
	!RESOURCE[LiquidFuel] {}
	!RESOURCE[Oxidizer] {}
}

I believe something like that would work. I'll try it tonight.

Link to comment
Share on other sites

Would you be able to add a default TankType for LH2 and LH2O? CryoEngines and a few other mods use these.

Assuming that you get 0.45LF and 0.55OX per 1 volume, a LH2 tank would give you 10LH2 units per volume. A LH2O would give you 6LH2 and 0.4Ox per volume.

Link to comment
Share on other sites

So  all I did so far is alter the line you had, saying:


@TANKTYPE[Soil]:NEEDS[KolonyTools]
{ @PossibleResources ^= :$: Dirt 0.7; Mulch 0.7; Fertilizer 0.7; ExoticMinerals 0.7; MetallicOre 0.7;  Rock 0.7;: }

now there isn't much consensus between this mod and most others about much but liquid fuel and ox, but even that varies some. Way more than I want to deal with right now.

However, I am reporting that I may, and I am not definite on this yet, be starting an engine mod that I have been thinking about, and evidently I wasn't alone, as I read today.  Basically, E.LF. engines, Standing for Electrodeless Lorentz Force.

This works like the mass driver from USI, but takes one more step. Heat material to near plasma, then ionize and and use like you would Xenon, Plus a bit. Because you use rock, you have a high matter density. but also a high energy cost to approach plasma. So, initially, it uses Rock for mass, but eventually anything, the denser the (generally) better. Not everything takes the same engergy to reach the right state. So I am starting with a quartz model of usage.

Link to comment
Share on other sites

Ok, here it is. This will take any LFO tank and convert it to Configurable Containers. Took a hour to get it all working right.

@PART[*]:HAS[@RESOURCE[LiquidFuel],@RESOURCE[Oxidizer],!MODULE[InterstellarFuelSwitch],!MODULE[ConfigurableContainers],!MODULE[ModuleEnginesFX],!MODULE[ModuleEngines],!MODULE[FSfuelSwitch]]:NEEDS[!modularFuelTanks&!RealFuels]:FOR[ConfigurableContainers]
{
    %LF = #$RESOURCE[LiquidFuel]/maxAmount$
    @LF *= 0.013717
    MODULE
    {
        name = ModuleTankManager
        Volume = #$../LF$
        DoCostPatch = True
        TANK
        {
            name = LFO
            Volume = 100.0
        }
    }
	!RESOURCE[LiquidFuel] {}
	!RESOURCE[Oxidizer] {}
}

 

Link to comment
Share on other sites

and this could then be easily ported to water, Monoprop, KerbalJuice(from my blender part), etc?  so it can grab all those tanks from this or that mod that are not specifically LFO?

 

 

and sort of related to this...   can we get ElectricCharge added in to the resources?  I guess I can do this myself but just thinking it could be there by default.   the reason I ask is the "Procedural Parts" mod allows EC as a resource type...  so ya just thinking aloud again.  I will add that patch above into my MM patch folder and give it a go.

 

 

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...