Skip to content

Kerbal Space Program Mod for sectioning ships for accurate analysis

Notifications You must be signed in to change notification settings

jkoritzinsky/ShipSections

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ShipSections Logo

Welcome to ShipSections

What is ShipSections?

ShipSections lets you divide your ships into different sections like "Lifter", "Interplanetary", "Lander", "Explodey Piece", etc. Through ShipSections, other mods can analyze just the parts within that section. Note: This is currently a VAB/SPH only experience. ShipSections does not currently have full support for craft in flight. It works when nothing blows up and nothing is docked, but I don't make any promises.

How do I use ShipSections? (Player)

The ShipSections window is on the App Launcher. Click it, and you'll see a window with all of the current sections and a button to highlight each of them. To create a section, right click on any decoupler or non-shielded docking port and click "Create Section". That will make this part and all of its children within the current section parts of a new section. You can rename the section using the window mentioned before.

How do I use ShipSections? (Modder)

  1. Reference the ShipSections.dll.
  2. Derive your class from SectionData<Your Class>
  3. Implement the Merge method. This method takes in another instance of your data class. Your job is to merge the data from that instance into your instance. This happens upon initial loading (merge current data into defaults), and whenever sections are merged.
  4. Optional: Create a config file with default values.
  5. Use the events and methods on the ShipSections.API class to interface with your section data.

Creating a config file with default values

Here is an example config:

SECTIONDATADEF
{
    name = MySectionData
    isPayload = 1
}
public class MySectionData : SectionData<MySectionData>
{
    [Persistent]
    public int isPayload = 0;
    
    protected override void Merge(MySectionData data)
    {
        isPayload = data.isPayload;
    }
}

Getting your section data

The following method can be used to get data:

T API.GetSectionDataForMod<T>(string sectionName)

Pass in the name of a section and the type of section data that you want, and this method will return it to you for you to use. Generally, you should only have to use the API class and the SectionData<T> class.

Reporting Bugs

If you find a bug or want a new feature, contact me either on the KSP Forums, on GitHub, or on the KSP or KSP Mod Dev subreddits, or by private message on any of these platforms.

Mods that Use ShipSections

Extensive Engineer Report v0.5+

About

Kerbal Space Program Mod for sectioning ships for accurate analysis

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages