Jump to content

[1.12] KIFA Kerbal Inventory for All - adds stock inventory to mod containers, put all mod parts in stock containers!


Atlas Gaming

Recommended Posts

KIFA - Kerbal Inventory for All

  • Simple Mod that adds Kerbal 1.12 Inventories to all Command Pods including 3rd party mod Command Pods, Station Hubs, and Bases
  • Adds inventories to any parts which already have a KIS Inventory - both from KIS mod and other mods which add KIS inventories (like USI mods
  • Also allows other MOD parts to be put into stock inventory. This can be disabled by deleting the AllowModPartsInStock.cfg file.

This will only add the function if the mod author has not added  stock inventory themselves.

As other Mod authors update their mods to include Stock inventory support from Kerbal 1.11. this mod will automatically skip the newly updated mods and only add Inventory to mods that do not natively support them. The same for allowing mod parts to go into stock inventory. As mod authors update their mods, this will skip over them.

Download: https://spacedock.info/mod/2592/Kerbal Inventory for All

Latest version always on CKAN 

REQUIRES: Module Manager  (version 4.1.4 or above works fine with 1.11 even if CKAN doesn't say so)

Example of both stock and mod content in stock inventory of modded items. 

Image of use below:

Spoiler

KIFAInventory.jpg

 

License: MIT 

Changelog:

----------------------------------------
    v1.2.1 - 2021/02/10
    * Minor fixes
    * For KSP 1.11.1

----------------------------------------
    v1.2 - 2021/01/10
    * Bugfix for external seat

----------------------------------------
    v1.1 - 2020/12/31
    * Bugfix for Probe Cores

----------------------------------------
    v1.0 - 2020/12/23
    * Bugfix for USI and Kerbal Planetary Base Systems compatibility

----------------------------------------
    v0.99 - 2020/12/23
    * Updated Weight to Volume calculation for .2 average density 
    * Added stock inventory to Bases and Stations based on crew size
----------------------------------------
    v0.95 - 2020/12/22
    * Added functionality for any mod parts to be able to be put into stock inventory
----------------------------------------
    v0.9 - 2020/12/20
    * For KSP 1.11.x
    * Initial Release
----------------------------------------

 

Edited by Atlas Gaming
Link to comment
Share on other sites

Just going to say this before a mod gets here, but you’ll need to put your license in your post, as per the add-on posting rules. Spacedock says MIT, so you’ll be just fine if you type LICENSE: MIT.

This is a great little utility! Thanks for posting. I hope the stock inventory gets implemented into mods quickly, and that we get a small utility (based on KIS code?) to calculate volumes.

 

Link to comment
Share on other sites

12 hours ago, Clamp-o-Tron said:

Just going to say this before a mod gets here, but you’ll need to put your license in your post, as per the add-on posting rules. Spacedock says MIT, so you’ll be just fine if you type LICENSE: MIT.

This is a great little utility! Thanks for posting. I hope the stock inventory gets implemented into mods quickly, and that we get a small utility (based on KIS code?) to calculate volumes.

 

My mod does use KIS volume to set up the Stock volume for all KIS enabled containers.

Default for modded capsules is 200m (which may need to be reduced based on feedback)

11 hours ago, Z3R0_0NL1N3 said:

Excellent work, this is definitely needed!

I'm not sure how the code here works, though. Does it use MM to search for KIS inventory and replace it with the stock system, or does it need compatibility for certain mods?

Yes, but it does not replace KIS, it duplicated the same size and slot number using stock for any items than have a KIS defined. For capsules I add 6 slots and 200m for now.

Link to comment
Share on other sites

27 minutes ago, Atlas Gaming said:

New version released with added functionality of making all mod parts now fit into stock inventory!

I know this might be beyond the scope of the Mod, but have you considered adding cargo tags to parts that dont have them to further the use of these command pods? I realize there would be some logic in calculating volume for said parts (or rough volume)

"Bill the mainsail isn't igniting!"

"Look under that there seat Jeb!"

Link to comment
Share on other sites

Just now, Atlas Gaming said:

Not sure I follow... give me an example of use

Somehow blanket adding:     

MODULE
{
	name = ModuleCargoPart
	packedVolume = ****
}

for every part with some sort of logic. So if a container is big enough, you could even put some very large parts in it that aren't set up as cargo parts in the base game.

Link to comment
Share on other sites

1 minute ago, Atlas Gaming said:

Not sure I follow... give me an example of use

 

I think he wants the option - given a big enough container - to store a Mainsail engine in an inventory slot. From what I understand that is impossible right now due to some internal flag not being set? I've not poked around in the files yet, too busy futzing in the game.

Also cool mod, This may become a must-install :)

Link to comment
Share on other sites

Yes that's already in the current version :) did you not install it?

Just now, MadArkael said:

for every part with some sort of logic. So if a container is big enough, you could even put some very large parts in it that aren't set up as cargo parts in the base game

Every part - including mod parts - CAN be put in a container... but no one has yet built containers to house mainsails :)

Edited by Atlas Gaming
Link to comment
Share on other sites

Just now, Atlas Gaming said:

Yes that's already in the current version :) did you not install it?

 

@PART[*]:HAS[!MODULE[ModuleCargoPart],#mass] 
{
	MODULE
	{
		name = ModuleCargoPart
		packedVolume = #$../mass$
		@packedVolume *= #$../mass$
		@packedVolume *= 12000
		stackableQuantity = 1
		@stackableQuantity /= #$packedVolume$
		@stackableQuantity += 1
		@stackableQuantity ^= :\.\d+::
	}
}

Yeah I found this in your cfg. I don't see any extra cargo tags to parts that didnt have them prior. Maybe I'm missing something?

I put your folder in my game data folder. I dont have module manager as I didnt see it for 1.11 yet, is that what I'm missing?

Link to comment
Share on other sites

5 minutes ago, MadArkael said:

I put your folder in my game data folder. I dont have module manager as I didnt see it for 1.11 yet, is that what I'm missing?

I installed 1.10.90's version. and Tada! Not sure the volumes work out correctly, unless I bugged it yet again. The Atreus Cargo tube has a volume of 8500 L. The Nerv atomic rocket engine has a volume of 108000 L. (I know you're approximating volume from mass so its not going to be exact)

Link to comment
Share on other sites

Yes you need module manager. Current  4.1.4 works fine for 1.11

Literally any part from any mod can be put into a container... but there are relatively few containers currently made.  Yes my volumes are approximations, I'm hoping all mods will eventually include the dimensions by mod authors. But I'm using a ratio based on stock parts. Also keep in mind some 'large' things that are light like solar panels actually pack up to a small size, while things like rocket engines would come with a stand and shipping supports to make them larger just like IRL. Biggest container I have installed is an SN-26K Mk3 which is 55,600L volume. It can hold a Bobcat engine or 2 Swivels.

Also small parts like KAS screwdriver can be packed 6 to a slot, just like in KIS

Edited by Atlas Gaming
Link to comment
Share on other sites

1 minute ago, Atlas Gaming said:

Yes you need module manager. Current  4.1.4 works fine for 1.11

Literally any part from any mod can be put into a container... but there are relatively few containers currently made.  Yes my volumes are approximations, I'm hoping all mods will eventually include the dimensions by mod authors. But I'm using a ratio based on stock parts. Also keep in mind some 'large' things that are light like solar panels actually pack up to a small size, while things like rocket engines would come with a stand and shipping supports to make them larger IRL

I agree.  Yeah it makes it hard without actual dimensions. For reference with the nerv example though. 5 SEQ-24's stacked is 12500 L. You can clip 2 Nerv engines in with quite a bit of volume left over (almost 3)

Link to comment
Share on other sites

Your code is going to throw errors and warnings as it assumes that if a part has ModuleKISInventory that it also has slotsX, slotsY and maxVolume.  To avoid that one could do this instead:

Spoiler

// Create ModuleInventoryPart for all ModuleKISInventory parts
// I tried all of this in one pass but there are some parts (Station Parts Expansion Redux) that didn't have slots or maxVolume and that caused errors
@PART[*]:HAS[@MODULE[ModuleKISInventory],!@MODULE[ModuleInventoryPart]]:NEEDS[KIS]:Final
{
    Modby = PMoffitt
    MODULE
    {
        name = ModuleInventoryPart
    }
}

// Put in inventory slots
// Hope this doesn't have too many errors for parts that only have slotsX and no slotsY
@PART[*]:HAS[#Modby[PMoffitt],@MODULE[ModuleKISInventory]:HAS[#slotsX[*]]]:NEEDS[KIS]:Final
{
    @MODULE[ModuleInventoryPart]
    {
        InventorySlots = #$../MODULE[ModuleKISInventory]/slotsX$
        @InventorySlots *= #$../MODULE[ModuleKISInventory]/slotsY$
    }
}

@PART[*]:HAS[#Modby[PMoffitt],@MODULE[ModuleKISInventory]:HAS[#maxVolume[*]]]:NEEDS[KIS]:Final
{
    @MODULE[ModuleInventoryPart]
    {
        packedVolumeLimit = #$../MODULE[ModuleKISInventory]/maxVolume$
    }
}

// Cleanup the Modby
@PART[*]:HAS[#Modby[PMoffitt]]:Final
{
    -Modby = PMoffitt
}


For packedVolumeLimit you are assuming it is equal to 12000 * mass^2.  ExtraplanerLunchpads documents 0.5t/m^3 for rocketparts.  I am still trying to figure out how to deal with part size in a way that makes sense.

 

This is what I have so far but I am not sure I like the results as I was removing the KIS Inventory Modules and it only kind of did what I want.  I think I will take that back out to keep both systems working if they will. And then there are issues with KIS seat inventory.

Spoiler

//Support for KSP 1.11 Inventory System For KIS
// Pat Moffitt 12/19/2020

//  Modules that extend from ModuleKISItem include:  ModuleKISItemAttachTool, and pretty much anything that starts with ModuleKISItem.  We will have to include thoses also.

// These add ModuleCargoPart to parts that have ModuleKISItem
@PART[*]:HAS[@MODULE[ModuleKISItem*]&!MODULE[ModuleCargoPart]]:NEEDS[KIS]:Final
// Generic part will add volume and stackable in the next part mods
// Added the Modby so I can check for it in the following part mods
{
    Modby = PMoffitt
    MODULE
    {
        name = ModuleCargoPart
        packedVolume = 50 // A default value not sure but need something over 0 need to figure a way to convert mass to default volume
    }
}

@PART[*]:HAS[#Modby[PMoffitt],@MODULE[ModuleKISItem*]:HAS[#volumeOverride[*]]]:NEEDS[KIS]:Final
// Part had a volume in KIS
{
    @MODULE[ModuleCargoPart]
    {
        @packedVolume = #$../MODULE[ModuleKISItem*]/volumeOverride$ // Use volume from KIS
    }
}

@PART[*]:HAS[#Modby[PMoffitt],@MODULE[ModuleKISItem*]:HAS[#stackable[true]|#allowStack[True]]]:NEEDS[KIS]:Final
// Part was stackable in KIS
{
    @MODULE[ModuleCargoPart]
    {
        stackableQuantity = 100 // can stack 100 of them - not sure that's a good value
    }
}

// Cleanup the Modby
@PART[*]:HAS[#Modby[PMoffitt]]:Final
{
    -Modby = PMoffitt
    -MODULE[ModuleKISItem*]{}
}

// Create ModuleInventoryPart for all ModuleKISInventory parts
// I tried all of this in one pass but there are some parts (Station Parts Expansion Redux) that didn't have slots or maxVolume and that caused errors
@PART[*]:HAS[@MODULE[ModuleKISInventory],!@MODULE[ModuleInventoryPart]]:NEEDS[KIS]:Final
{
    Modby = PMoffitt
    MODULE
    {
        name = ModuleInventoryPart
    }
}

// Put in inventory slots
// Hope this doesn't have too many errors for parts that only have slotsX and no slotsY
@PART[*]:HAS[#Modby[PMoffitt],@MODULE[ModuleKISInventory]:HAS[#slotsX[*]]]:NEEDS[KIS]:Final
{
    @MODULE[ModuleInventoryPart]
    {
        InventorySlots = #$../MODULE[ModuleKISInventory]/slotsX$
        @InventorySlots *= #$../MODULE[ModuleKISInventory]/slotsY$
    }
}

@PART[*]:HAS[#Modby[PMoffitt],@MODULE[ModuleKISInventory]:HAS[#maxVolume[*]]]:NEEDS[KIS]:Final
{
    @MODULE[ModuleInventoryPart]
    {
        packedVolumeLimit = #$../MODULE[ModuleKISInventory]/maxVolume$
    }
}

// Cleanup the Modby
@PART[*]:HAS[#Modby[PMoffitt]]:Final
{
    -Modby = PMoffitt
    -MODULE[ModuleKISInventory]{}
}

@PART[KKAOSS_Landing_*]:HAS[!@MODULE[ModuleCargoPart]]
{
    MODULE
    {
        name = ModuleCargoPart
        packedVolume = 50 // A default value not sure but need something over 0 need to figure a way to convert mass to default volume
    }
}
 

And I suppose I should state that parts of this are copyright by Atlas Gaming under the  MIT Lic.  The rest is copyright by me under the MIT Lic.  You can pretty much use what I did at will.  Specially since it isn't done yet and not really tested.

 

Edited by pmoffitt
Link to comment
Share on other sites

Just looked up the largest KIS container in USI is 128,000 liters. That could hold some spare engines. But honestly, Global Construction can be used for much more compact ways to build in situ. If anything that mod underestimates volumes involved in shipping parts. So I think for most parts from spare solar, to RCS thrusters and even small engines, spares can fit the existing container pars from mods quite well using the formula I'm using.  

 

 

 

Link to comment
Share on other sites

Just now, Atlas Gaming said:

Just looked up the largest KIS container in USI is 128,000 liters. That could hold some spare engines. But honestly, Global Construction can be used for much more compact ways to build in situ. If anything that mod underestimates volumes involved in shipping parts. So I think for most parts from spare solar, to RCS thrusters and even small engines, spares can fit the existing container pars from mods quite well using the formula I'm using. 

Its your formula, I was just pointing out visual volume.

Another example is the main sail engine. It can be perfectly clipped into 5 SEQ-24's. They hold 12,500 L combined. So if you dont over complicate things and just calculate volume of the engine as a straight cylinder, the main sail should hold a volume approximately of 12500 L. Using your formula. The Main sail currently is 432,000 L.

Link to comment
Share on other sites

7 minutes ago, pmoffitt said:

Your code is going to throw errors and warnings as it assumes that if a part has ModuleKISInventory

I'm not getting any errors... link to log where you see errors so I can take a look. 

 

Just now, MadArkael said:

Another example is the main sail engine. It can be perfectly clipped into 5 SEQ-24's. They hold 12,500 L combined

Visually yes... but if you were to ship something the size of an F1 engine to space in a shipping container, it would be substantially larger than the engine itself.

You can tweak the sizing in my mod by changing the 12,500 number. Make it smaller if that's preferred. I based the number by looking at a dozen stock parts and comparing mass to volume.  

While the Main Sail should definitely NOT be 430,000L I also never planned on taking one with me  which wasn't already attached to a rocket :) 

 Bringing anything with over 1T of mass in a container, may be a moot point if a kerbal can't actually handle the item to attach it.

Link to comment
Share on other sites

7 minutes ago, Atlas Gaming said:

Visually yes... but if you were to ship something the size of an F1 engine to space in a shipping container, it would be substantially larger than the engine itself.

Fair Point.

7 minutes ago, Atlas Gaming said:

While the Main Sail should definitely NOT be 430,000L I also never planned on taking one with me  which wasn't already attached to a rocket

Agreed. I mostly Just want to make lifters with a "cookie cutter" transfer vehicle and instead of wrapping them in a fairing, it would be fun to use the new system is all.

Link to comment
Share on other sites

15 minutes ago, pmoffitt said:

This is what I have so far but I am not sure I like the results as I was removing the KIS Inventory Modules

So I noticed that KIS sort of disables itself... latest KIS includes code to not allow any part which fits into a stock container, to be put in a KIS inventory.  Since part of what my mod does is allow all modded parts to fit inside the stock inventory, KIS then refuses to allow the items in. It's unfortunate as I'd like to have the choice :)

Link to comment
Share on other sites

5 minutes ago, Atlas Gaming said:

I'm not getting any errors... link to log where you see errors so I can take a look. 

 

Station Parts Expansion Redux has parts that have ModuleKISInventory without the slotsX, or slotsY and I don't believe that maxVolume isn't required for KISInventory.  Don't get me wrong, I think not having slots defined in ModuleKISInventory is broken but there are some there.  And as I have already corrected it, I no longer have logs with the errors and warning.

12 minutes ago, Atlas Gaming said:

 Bringing anything with over 1T of mass in a container, may be a moot point if a kerbal can't actually handle the item to attach it.

Well, using KAS/KIS I updated that to a lot larger number.  Not sure that will work with KSP 1.11 anymore.

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