Jump to content

How do you modify the available parts inventory in the VAB?


Bugbear

Recommended Posts

I noticed the first tutorial (Construction Basics) controlled what parts were available to build with in the VAB, but I couldn't figure out how to do this myself. Does anyone have any tips?

Thanks!

Link to comment
Share on other sites

Try EditorPartList.instance.limitedParts = new List<AvailablePart ();

You may need to call refresh on it afterwards.

Alternatively, I believe rslashphish managed this with his editor part filter mod so you could look at the source code for that.

Link to comment
Share on other sites

I did finally figure this one out, thanks to some help from Adammada's Basic Mission Pack scenarios (a great set of scenario challenges designed for newer players).

Here's the basic code if anyone is interested. See the Mission Pack linked above for an actual implementation.


//create a set of available parts
Dictionary<string, AvailablePart> parts = new Dictionary<string, AvailablePart> ();

//add each available part to our set and make the amount available equal to 0.
foreach (AvailablePart eachPart in PartLoader.fetch.loadedPartsList)
{
eachPart.amountAvailable = 0; //sets the amount of each part available to 0
//Parts with an amount of 0 are not displayed
parts.Add (eachPart.name, eachPart); //Adds the part to our set of available parts.
}
EditorPartList.Instance.Refresh (); //update the editor screen with our list of parts

//This will change the qty of items available on the fly:
//NOTE the qty of parts available in the editor DOES NOT currently decrease when adding parts to a ship.
string name="MK1Fuselage";
parts[name].amountAvailable=5;
EditorPartList.Instance.Refresh (); //update the editor screen with our list of parts

Edited by Bugbear
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...