Jump to content

[1.0.5] ShipSections v1.1 -- Section Your Ships for Accurate Analysis


jkortech

Recommended Posts

 

 

ShipSections%20Banner.png

Welcome to ShipSections

Download from GitHub or from CKAN (soon)

 

 

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

Requirements

ModuleManager 2.6.7+

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+

Edited by jkortech
Update for v1.1
Link to comment
Share on other sites

Interesting. Does this do anything on its own, or will - for example - Kerbal Engineer need to be updated to show things by section?

Also, do (or can) the names of the sections carry over into flight? It'd be cool do undock my lander from my mothership and have the two ships actually be named what I want, instead of the game picking one at random and calling it the lander.

Link to comment
Share on other sites

I don't think I fully understand what this does quite yet, but it sounds like it's something StageRecovery should hook into to estimate the landing velocity for each "section". I'm already working on adding code to do that for each stage, but this seems like it'd let people define their own "sections" (which might include things that are connected through decouplers) and they might want to know if they could recover that whole (whereas my method assumes each decoupler starts a new stage).

Link to comment
Share on other sites

5thHorseman: By itself it just adds the ability to create sections. The data is available in flight, I it just isn't shown right now because I still have to figure out docking/undocking to preserve the data (right now its stored in part modules). Kerbal Engineer will need to be updated, which is something that I'm planning on doing. I like your suggestions and I'll definitely aim to put them in either the next version of ShipSections or another mod that utilizes it.

Magico: You're idea is correct. It allows people to define sections that can include pieces connected through decouplers. It all depends on how people want to design their crafts.

Link to comment
Share on other sites

Magico: You're idea is correct. It allows people to define sections that can include pieces connected through decouplers. It all depends on how people want to design their crafts.

That's awesome! Consider me interested in adding support into StageRecovery. I'll likely have questions. Mostly I just need to know which parts are in any given section.

Link to comment
Share on other sites

That's awesome! Consider me interested in adding support into StageRecovery. I'll likely have questions. Mostly I just need to know which parts are in any given section.

The property you're looking for is API.PartsBySection. To get the parts for a section with a given name, use the following:

 API.PartsBySection.First(sections => sections.Key == "name here")

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...
On ‎11‎/‎4‎/‎2015 at 4:14 PM, 5thHorseman said:

Also, do (or can) the names of the sections carry over into flight? It'd be cool do undock my lander from my mothership and have the two ships actually be named what I want, instead of the game picking one at random and calling it the lander.

An auto-renaming feature is coming built-in to the next version of ShipSections.  Currently, the name will be based off the original name of the vessel with the section name appended to it. Does that sound good?

Link to comment
Share on other sites

  • 1 year later...

In my install, This mod is causing my loading screen to freeze when it says: Squad/Parts/prebuilt/KerbalEVA/KerbalEVA. It stays there for ever.

Oh I found what I was doing wrong. I had installed  Extensive Engineer Report  and that mod's thread takes you to a ShipSelections download page that has version 0.0.2. Now I downloaded it from here and it works. You might want to warn the EER modder so that nobody else gets this problem...

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