Jump to content

[1.12.x] KSP Part Volumes


linuxgurugamer

Recommended Posts

I have a new beta for this:

0.0.3.1 BETA

  • Added missing line to  config file (was not needed, but nice to have) for processManipulableOnly option
  • Added tank volume calculations
  • Added code to clamp window on screen
  • Now hides the button if no changes are detected
  • Thanks to user @yalov for these:
    • add stackable support:  parts, that is fitted at least two times in maxStackCommonVolume, have stackableQuantity, but no more than maxPartsInStack
    • add packedVolume to ModuleCargoPart Bypass reasons info
    • change patch, so an index of ModuleCargoPart is not changed
    • support blacklistRegexPattern, and move KerbalEVA there
    • update settings window (checkbox for all fillers)
       

https://www.dropbox.com/s/ia29si4kdgjzssw/KSP_PartVolume-0.0.3.1.zip?dl=0

 

The feature to hide the button  is experimental.  Please let me know if you think I should leave it in or not

Link to comment
Share on other sites

I have found some problems in the beta:

  1. enable "process maniputable-only parts" and "stock parts"

    UTrm693.png

    after every restart and without any changes, the restart window will be appearing

    tioFCQR.png
    This problem was also on the previous version.

     
  2. New problem: with the settings as above, the patch looks like that
     
    // Squad/Parts/Electrical/z-4kBattery/z-4kBattery/batteryBankLarge
    // Dimensions: x: 2.63, y: 0.25, z: 2.50
    // Bounding Box Size: 1645.653 liters
    // Volume adjustment: 10%
    //
    @PART[batteryBankLarge]:HAS[@MODULE[ModuleCargoPart]]:Final
    {
        @MODULE[ModuleCargoPart]
        {
            %packedVolume = 1811
        MODULE
        {
            name = ModuleCargoPart
            packedVolume = 1811
            %KSP_PartVolume = true
        }
    }

     

 

 

Link to comment
Share on other sites

34 minutes ago, flart said:

enable "process maniputable-only parts" and "stock parts"

You might need to restart 2x

35 minutes ago, flart said:

New problem: with the settings as above, the patch looks like that

That's a problem, thanks.  Please check the first again,  restarting 2x without making any changes

Link to comment
Share on other sites

2 hours ago, flart said:

I have restarted 3 times, the restart message still appears

Strange, I did test that, but will look into it.  Besides, the file is wrong with that option anyway, so that does need fixing.

Edit:  The syntax issue was an easy fix, was a result of the massive merge I did, and when I had to fix conflicts, I missed one set of duplicated lines

Edited by linuxgurugamer
Link to comment
Share on other sites

New beta, fixes both the syntax error and the constant asking to restart game:

  • Fixed parts having ModuleInventoryPart getting a cargo module added
  • Added file versioning, with automatic deletion of old file versions
  • Fixed having manipuable parts constantly getting told to restart game
     

https://www.dropbox.com/s/hvvcgww1wawsejf/KSP_PartVolume-0.0.3.2.zip?dl=0

 

Link to comment
Share on other sites

6 hours ago, linuxgurugamer said:

New beta, fixes both the syntax error and the constant asking to restart game:

looks good,
what are the Calculated tank volume and Calculated tankVol (max x min) volume

// ----------------------------------------------------------------------
//      Calculated tank volume: 20978.8
//      Calculated tankVol (max x min) volume: 7556.8
// Squad/Parts/Aero/airlinerWings/MainWing/airlinerMainWing
// Dimensions: x: 11.33, y: 7.82, z: 0.92
// Bounding Box Size: 81664.4 liters
// Volume adjustment: 10%
//
//   Bypass reasons:
//      size exceeds largestAllowablePart: 64000
//
// ----------------------------------------------------------------------

 

Link to comment
Share on other sites

New release, 0.0.3.1

  • Added missing line to  config file (was not needed, but nice to have) for processManipulableOnly option
  • Added tank volume calculations
  • Added code to clamp window on screen
  • Now hides the button if no changes are detected
  • Thanks to user @yalov for these:
    • add stackable support:  parts, that is fitted at least two times in maxStackCommonVolume, have stackableQuantity, but no more than maxPartsInStack
    • add packedVolume to ModuleCargoPart Bypass reasons info
    • change patch, so an index of ModuleCargoPart is not changed
    • support blacklistRegexPattern, and move KerbalEVA there
    • update settings window (checkbox for all fillers)
  • Fixed parts having ModuleInventoryPart getting a cargo module added
  • Added file versioning, with automatic deletion of old file versions
  • Fixed having manipulable parts constantly getting told to restart game
Link to comment
Share on other sites

  • 2 months later...

I just wanted to make RestockPlus Oscar-A Fuel Tanks into Cargo Parts like the larger stock Oscar-B tanks, and against my better judgement installed this mod. It aggressively interfered with the Main Menu and kept telling me to restart the game, but otherwise apparently did nothing at all after running the game three times, so I uninstalled it. Only after uninstalling the mod, I found that nearly every single item was now a Cargo Item, including giant fuel tanks, in spite of the mod already being uninstalled. Oscar-A Fuel Tanks even took up more volume than Oscar-B Fuel Tanks twice their size. I tried deleting the partVolume.cfg file and restarting to fix the problem, but to no avail.

So now I've had to uninstall the whole game, delete everything in my Kerbal Space Program folder, reinstall the game, and reinstall all of my mods. In fact installing this mod practically wasted two days of my playing time what with all of the KSP restarts and downloading and installing I've had to do. And so I just thought I'd share my experience here for the benefit of other players. Thanks.

Link to comment
Share on other sites

On 4/26/2022 at 5:59 PM, wrdiffin said:

I just wanted to make RestockPlus Oscar-A Fuel Tanks into Cargo Parts like the larger stock Oscar-B tanks, and against my better judgement installed this mod. It aggressively interfered with the Main Menu and kept telling me to restart the game, but otherwise apparently did nothing at all after running the game three times, so I uninstalled it. Only after uninstalling the mod, I found that nearly every single item was now a Cargo Item, including giant fuel tanks, in spite of the mod already being uninstalled. Oscar-A Fuel Tanks even took up more volume than Oscar-B Fuel Tanks twice their size. I tried deleting the partVolume.cfg file and restarting to fix the problem, but to no avail.

So now I've had to uninstall the whole game, delete everything in my Kerbal Space Program folder, reinstall the game, and reinstall all of my mods. In fact installing this mod practically wasted two days of my playing time what with all of the KSP restarts and downloading and installing I've had to do. And so I just thought I'd share my experience here for the benefit of other players. Thanks.

If you has asked for help, I would have been able to tell you the one file you needed to delete.  By design it leaves the file behind, and should be documented in the OP.  I'll check that and add a note if necessary .

Edit: this behavior is documented in the OP, I just added a second note to point out that it needs to be deleted to fully delete the mod

Edited by linuxgurugamer
Link to comment
Share on other sites

40 minutes ago, MoonstreamInSpace said:

Would it be possible to add a button to ignore if the part has an inventory? It would be annoying to whitelist every one. (I'm hoping to use this with Sandcastle)

What kind of inventory?  Stock inventory?

Link to comment
Share on other sites

A few questions I didn't find a complete answer looking through the topic:

  • What "Process manipulable-only parts" does exactly?
  • What "Allow stackable parts" does? What is a stackable part in the first place?
  • Does "Include stock parts" re-calculate the volume of stock parts, or only calculates the volume for stock parts with missing ModuleCargoPart?
Edited by aat
Link to comment
Share on other sites

12 hours ago, MoonstreamInSpace said:

The partVolume_v2.cfg file said that they were blocked due to having ModuleInventoryPart.

the game does not allow to put an inventory into inventory, so it is stock limitation

 

5 hours ago, aat said:
  • What "Process manipulable-only parts" does exactly?
  • What "Allow stackable parts" does? What is a stackable part in the first place?
  • Does "Include stock parts" re-calculate the volume of stock parts, or only calculates the volume for stock parts with missing ModuleCargoPart?
  • the checkbox add parts to the partVolume_v2.cfg, that could be manipulated in the construction mode, but could not be put in the inventory (internally they have volume -1)
  • small parts could be in stack - several items in one cell in the inventory grid
  • only calculates the volume for stock parts with missing ModuleCargoPart
Link to comment
Share on other sites

16 hours ago, MoonstreamInSpace said:

Yes. The partVolume_v2.cfg file said that they were blocked due to having ModuleInventoryPart.

So what's the problem, then?  The mod itself already ignores parts which have an inventory

Link to comment
Share on other sites

On 5/4/2022 at 8:32 AM, linuxgurugamer said:

So what's the problem, then?  The mod itself already ignores parts which have an inventory

On 5/4/2022 at 4:28 AM, flart said:

the game does not allow to put an inventory into inventory, so it is stock limitation

I see the problem now. Sorry about that.

Edited by MoonstreamInSpace
Link to comment
Share on other sites

  • 4 weeks later...
On 12/17/2021 at 3:28 AM, boCash said:

I'm having trouble getting this mod to apply ModuleCargoPart to certain parts. This mod finds them and they aren't being bypassed/commented out in partVolumes.cfg. I think all of the offending parts already have ModuleInventoryPart and I see that they're all yielding 'packedVolume = -1' in the .cfg. I even tried hand-editing the .cfg on one part to 'packedVolume = 1000' in a hail mary to make something work but I cannot for the life of me get the gosh-darn ModuleCargoPart to apply. I'm not very familiar with how MM does its magic so please bear with my uninformed self and let me know if there's any additional data that would help or if I'm being really dumb and failed to read something in this thread.

Log

partVolumes.cfg

An offending part: \PlanetaryBaseInc\BaseSystem\Parts\Utility\Garages\garage_adapter_g.cfg

 

(12/22) Update after another couple hours of tinkering and learning:

True to my avatar, I failed to read something in this thread. Or rather, to process it in any meaningful way. Any time I had it set to 'Process Manipulable-only Parts', I encountered the same restart loop that DPOHbl4 mentioned. I tried the fix Gordon suggested but I still can't get ModuleCargoPart to stick. Is it something to do with the order of that and ModuleInventoryPart that was mentioned upthread? Hand-editing the part.cfg itself to add ModuleCargoPart works.

 

(12/23) Update after more tinkering and learning:

Yes, the issue is caused by the order of ModuleInventoryPart and ModuleCargoPart. Deleting ModuleInventoryPart before adding ModuleCargoPart solved the problem. I also readded ModuleInventoryPart, albeit with a static volume for all parts. I then removed KSP_PartVolume from the GameData folder so my precious hand edited file wouldn't be harassed.

Using NP++ and the ToolBucket plugin for multiline find+replace, I ran the following on PartVolumes.cfg:

Find:

    MODULE
    {
        name = ModuleCargoPart
        packedVolume = -1
        KSP_PartVolume = true
    }

Replace:

    !MODULE[ModuleInventoryPart] {}
    MODULE
    {
        name = ModuleCargoPart
        packedVolume = -1
        KSP_PartVolume = true
    }
    MODULE
    {
        name = ModuleInventoryPart
        InventorySlots = 4
        packedVolumeLimit = 400
    }

I tested this strange phenomena, and it seems that ModuleCargoPart has to come before ModuleInventoryPart to make this work. So I hacked some extra lines into the mod to make it output in this order for all the instances containing just ModuleInventoryPart instead of ignoring them... Only to find out after I finished writing that ModuleManager has this nifty little trick that lets you index the order of how MM does the edits.

@PART[*]:HAS[@MODULE[ModuleInventoryPart],!MODULE[ModuleCargoPart],!MODULE[KerbalEVA]]:FINAL
{
	MODULE,0
	{
		name = ModuleCargoPart
		packedVolume = -1
	}

}

This little hack works like charm for me (unless, on an unrelated note, I have NodeHelper installed which causes EVA Construction to throw whenever I try to detach a part). If it works for you I might throw it in a nice package and shoot it up to the dock.

Link to comment
Share on other sites

@LEC Be careful when inserting modules at the start. There are some stock modules that use index numbers to link to each other, so inserting something at the beginning can break those functionality. e.g. the Mobile Processing Lab:

PART
{
	...
	MODULE
	{
		name = ModuleScienceContainer
		...
	}
	MODULE
	{
		name = ModuleScienceLab
		containerModuleIndex = 0 // <==== NOTE
        ...
    }
	...
}

There are other examples, animations for instance.

It might be better to first move the ModuleInventoryPart to the end (clone new copy - $MODULE[ModuleInventoryPart] {}, then delete first copy - !MODULE[ModuleInventoryPart],0 {}), before inserting the ModuleCargoPart at the penultimate position (index = -2)

Link to comment
Share on other sites

On 6/1/2022 at 3:40 AM, Aelfhe1m said:

@LEC Be careful when inserting modules at the start. There are some stock modules that use index numbers to link to each other, so inserting something at the beginning can break those functionality. e.g. the Mobile Processing Lab:

PART
{
	...
	MODULE
	{
		name = ModuleScienceContainer
		...
	}
	MODULE
	{
		name = ModuleScienceLab
		containerModuleIndex = 0 // <==== NOTE
        ...
    }
	...
}

There are other examples, animations for instance.

It might be better to first move the ModuleInventoryPart to the end (clone new copy - $MODULE[ModuleInventoryPart] {}, then delete first copy - !MODULE[ModuleInventoryPart],0 {}), before inserting the ModuleCargoPart at the penultimate position (index = -2)

@boCash

Noticed after playing today that there were some weirdness going on, so I did another hack instead that gives the same results without causing issues for the lab.

@PART[*]:HAS[@MODULE[ModuleInventoryPart],!MODULE[ModuleCargoPart],!MODULE[KerbalEVA]]:FINAL
{

	MODULE
	{
		name = ModuleCargoPart
		packedVolume = -1
	}
	MODULE
	{
		name = ModuleInventoryPart		
		InventorySlots = #$/MODULE[ModuleInventoryPart]/InventorySlots$
		packedVolumeLimit = #$/MODULE[ModuleInventoryPart]/packedVolumeLimit$
	}
	!MODULE[ModuleInventoryPart] {}
}

 

Link to comment
Share on other sites

On 6/2/2022 at 8:07 PM, LEC said:

@boCash

Noticed after playing today that there were some weirdness going on, so I did another hack instead that gives the same results without causing issues for the lab.

@PART[*]:HAS[@MODULE[ModuleInventoryPart],!MODULE[ModuleCargoPart],!MODULE[KerbalEVA]]:FINAL
{

	MODULE
	{
		name = ModuleCargoPart
		packedVolume = -1
	}
	MODULE
	{
		name = ModuleInventoryPart		
		InventorySlots = #$/MODULE[ModuleInventoryPart]/InventorySlots$
		packedVolumeLimit = #$/MODULE[ModuleInventoryPart]/packedVolumeLimit$
	}
	!MODULE[ModuleInventoryPart] {}
}

 

Nice, I’ll incorporate this into the next release

Link to comment
Share on other sites

New release, 0.0.3.2

  • Updated original patch to only add ModuleCargoPart if no ModuleInventoryPart is there
  • Thanks to forum user @LEC for this patch
    • Added patch to add ModuleCargoPart and make sure ModuleInventoryPart is after ModuleCargoPart for those parts where there was a ModuleInventoryPart
  • Updated file version to 3
Link to comment
Share on other sites

23 hours ago, linuxgurugamer said:

New release, 0.0.3.2

  • Updated original patch to only add ModuleCargoPart if no ModuleInventoryPart is there
  • Thanks to forum user @LEC for this patch
    • Added patch to add ModuleCargoPart and make sure ModuleInventoryPart is after ModuleCargoPart for those parts where there was a ModuleInventoryPart
  • Updated file version to 3

Thanks for the update! I did encounter an error immediately after updating though, and it appears that a part in Universal Storage II is to blame. The cargo wedge config doesn't have a packedVolumeLimit value defined under ModuleInventoryPart, so it fails trying to parse the variable. I know that's a bug in Universal Storage II and I will be filing a bug report there, but I wanted to mention it here too in case others come here to report, since it wasn't apparent until this mod was updated. 

Link to comment
Share on other sites

  • 3 weeks later...

I'm getting the following error when loading with the latest version of this mod, it seems to be similar to what Zelda reported above but relates to a different mod:

Quote

[LOG 19:06:21.052] Applying update KSP_PartVolume/AddToAllParts/@PART[*]:HAS[!MODULE[ModuleCargoPart],@MODULE[ModuleInventoryPart],!MODULE[KerbalEVA]]:FINAL to Delivery/parts/fuselage/cygnus/_cygnus_fuselage_s1p5_1.cfg/PART[cygnus_fuselage_s1p5_1]

[WRN 19:06:21.052] Cannot find key packedVolumeLimit in MODULE

[ERR 19:06:21.052] Error - Cannot parse variable search when inserting new key packedVolumeLimit = #$/MODULE[ModuleInventoryPart]/packedVolumeLimit$

The mod in question is Special Delivery - Stockalike Cygnus.

Edited by jimmymcgoochie
Link to comment
Share on other sites

I had the same issue as above:  

On 6/28/2022 at 11:17 AM, jimmymcgoochie said:

Cannot find key packedVolumeLimit in MODULE

for the Ares Cockpit from mod The Martian For KSP. 

Fixed it by changing 

@MODULE[ModuleInventoryPart]

to

MODULE[ModuleInventoryPart]

in line 14 in AddToAllParts.cfg.

KSP now reports no errors, and looking in Module Manager config cache shows Ares Cockpit now has (apparently) correctly configured ModuleCargoPart and ModuleInventoryPart entries:

		MODULE
		{
			name = ModuleInventoryPart
			InventorySlots = 9
		}
		MODULE
		{
			name = ModuleCargoPart
			packedVolume = 4140
		}

 

To summarize, fixed by removing the @ sign in front of "MODULE[ModuleInventoryPart]" in line 14 of AddToAllParts.cfg.

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