Jump to content

Bugbear

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by Bugbear

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

  2. Why is this not stickied yet?

    The format looks good, although there is a minor font issue under landinggear where a couple of entries are in a smaller font.

    A few links you can add under plugins:

    Creating your first module

    Part API

    Anatid's KSP API documentation

    The official unoffical help a fellow plugin developer thread

    Mu's code-update PartModuleKSPField KSPEvent ConfigNode and PartResource

    Handy link to add under general

    Stock Parts List

×
×
  • Create New...