Snark

[1.3] VesselCategorizer v1.1: Choose vessel type in the editor, or automatically based on ship name.

Recommended Posts

Posted (edited)

What it does

  • Lets the user choose vessel type (i.e. probe, base, station, etc.) via UI in the vehicle editor.
  • Can automatically set vessel type from ship name, based on customizable configuration.

Download from SpaceDock
License: CC-BY-NC-ND 4.0
Source code

 

Player-selectable vessel type

All command pods and probe cores have a "Vessel Type" selector on their menu in the vehicle editor:

screenshot.png

...just choose whichever you like. Your choice will be saved with the ship. When you launch it, it will have whatever ship type you chose.

One of the available choices (the default one, in fact) is simply "Default". When that's chosen, then the ship type will be chosen as usual based on what parts it contains, unless there's a name-based setting (see below).

 

Automatic vessel type based on name

Unless you've manually chosen a specific vessel type in the editor (see above), the mod looks at your vessel name to see if it can automatically set the vessel type for you.

vesselName.png

By default, it looks for one of the following strings in the vessel name, and sets the vessel type to what you'd expect:

  • Lander
  • Station
  • Base

...However, the player can easily customize it to add their own strings, either by directly editing the config, or by patching it with ModuleManager. For example, suppose you routinely name your unmanned interplanetary probes with "Pioneer" or "Surveyor" in their names, and you want to designate such ships as the "probe" type. You could use ModuleManager config like this:

@VesselCategorizer:AFTER[VesselCategorizer] {
    @NamingRules {
        Probe = surveyor
        Probe = pioneer
    }
}

For tips on how to write your own config, see the comments in the default config file that comes with the mod.


 

How to install

Unzip the contents of "GameData" to your GameData folder, same as with most mods.  (Note, includes ModuleManager.)

 

Why I wrote it

It's one of those minor itches that bugs me every time I play KSP.  I don't enjoy having to manually tinker with ship type; I want it to just magically be what I want it to be.  Examples of things that bug me:

  • I use relay antennas instead of direct ones, wherever possible, because it lets my probes do double duty as relays.  But KSP then makes all of my probes into "relay" ship type, which is not what I want.
  • I launch stations.  There's no way for the stock game to automatically set "station" type.
  • I often make landers that don't have a "lander can" on them... so the stock game doesn't call them landers.
  • I play in career mode, which means that only 0.625m probe cores are available until very late game.  Which means I always have to tuck my probe cores inside service bays.  Which makes them a pain in the posterior to rename the ship.  (Have to open the bay, find the core, change the type, close the bay.  Every. Single. Blessed. Time.)  :mad:
  • I'm an OCD consistency freak, and have a fairly standard naming scheme for my ships.  So a name-based vessel categorizer is right up my alley.

 

 

Edited by Snark
Update to v1.1.

Share this post


Link to post
Share on other sites

Cool idea! Thx! :)

But does it works on KSP 1.2.2?

Share this post


Link to post
Share on other sites

I see no reason why it wouldn't.  I'm guessing it probably would.  But am running 1.3 myself, so I have no actual first-hand knowledge there.  All I can say is, "try it and see".  :wink:

Share this post


Link to post
Share on other sites

Hi all,

I'm pleased to announce the release of VesselCategorizer v1.1.  The main new feature is UI in the vehicle editor to let you choose what vessel type you want:

screenshot.png

...just choose whichever you like. Your choice will be saved with the ship. When you launch it, it will have whatever ship type you chose.

One of the available choices (the default one, in fact) is simply "Default". When that's chosen, then the ship type will be chosen as usual based on what parts it contains, unless there's a name match.

(Note, this update adds ModuleManager 2.8.1 to the download, since MM is needed in order to enable the new feature.)

Enjoy!  :)

Share this post


Link to post
Share on other sites

Hey, nice update! I was kinda "meh" about the auto-categorize feature, since my naming schemes are all over the place and may or may not follow coherent rules for any given series of launches. But manually setting vehicle type in the editor sounds great.

Share this post


Link to post
Share on other sites
6 hours ago, White Owl said:

I was kinda "meh" about the auto-categorize feature, since my naming schemes are all over the place and may or may not follow coherent rules for any given series of launches. But manually setting vehicle type in the editor sounds great.

lol, yeah, you're not the only one.  I kinda figured that out after watching a couple of days go by with like two downloads per day.  :)

To be frank, I was kinda "meh" about it myself.  "Pick the ship type in the VAB" is the feature I actually wanted, myself.  I just did the name thing first because it seemed easier, and had managed to (erroneously) convince myself that the VAB thing would be too hard, until I had a brainstorm.

Various maunderings on the subject in a spoiler section, for the curious.

Spoiler

See, "choose the vessel type in the VAB" seems like such an obvious, simple, and necessary feature that it bugged me for years that they don't have it in the stock game.  I would fantasize about what the UI would look like.  (Okay, okay, I have pretty dull fantasies these days.  I guess I'm just a boring person, or perhaps it's an occupational hazard of getting old.)  The "right" design seemed clear and obvious to me:

  • Have an additional tab up at the top of the editor screen, right next to the one that shows the ship's current flag.
  • It would show the icon of the ship's current vessel type.
  • Clicking the button on the tab would open a drop-down of all the icon buttons, and you just click on the one you want.

So I spent all that time picturing exactly that feature in my head, and I guess I did it so long that it kinda channelized my thinking and I got fixated on that exact image.  So every time I pictured writing a mod (which is my usual response to "I wish the game would do X") to address the matter, I pictured implementing that specific UI.  Which intimidated me, since implementing that UI would require doing a bunch of futzing around with Unity UI coding, which is a big area of ignorance for me.  I know nothing about it, having successfully managed to avoid needing to do anything with it up to this point.  I do like learning things, but I was pretty sure that implementing this would be a steep learning curve, taking a lot of my time and requiring a lot of tedious debugging.  So I just never got around to implementing it:  the lack of the feature is a relatively minor annoyance, and the pain of not having it never came close to reaching the perceived pain of trying to implement the UI I wanted.  (Plus I kept hoping that Squad would just add the feature and save me the hassle.)  :wink:

However, after releasing the simple name-based categorizer in this mod, and seeing that practically nobody wanted it (the download rate was probably the most pathetic of any mod I've released), that spurred me to take a fresh look at the problem ("hmmm, is there any other way I could make this work?"), and then I had the little brainstorm of "heeeeyyyyyy, what if I put a button on the command pod menu to do this?"  Having that idea changed everything:

  • First, it seems to me that it's actually not a bad UI model:  it's unintrusive (which I like), and (more importantly) it's actually pretty consistent with existing game behavior.  If you're in the flight scene (as opposed to the editor), and you want to change the ship icon, what do you do?  You click on a command pod and press a button.  So, just do the (nearly) same thing in the editor, and Bob's your uncle.
  • Second, and crucially, it's easy for me to code.  No Unity UI hackery required.  The KSP API has nice hooks for adding buttons and such to part menus, so I could add the feature to the right-click menu pretty easily with just a few lines of code.  It was one of the easiest mods I've ever written.

So anyway, yeah, I'm pretty happy with the new feature, myself.  Not only do I now have essentially the feature I've always wanted, but I think it's a lot more useful to other folks this way, too-- the download rate has shot up remarkably.

So, yay!  :)

Share this post


Link to post
Share on other sites

Awesome mod idea. Will use! Thank you! I wanted something like this.

Edited by inigma

Share this post


Link to post
Share on other sites

Looks like a useful mod. Is it compatible with KCT? Have any plans to put it on CKAN?

Share this post


Link to post
Share on other sites
9 hours ago, garwel said:

Is it compatible with KCT?

No clue, since I don't happen to use that mod myself.  (Kerbal Construction Time, for anyone who didn't catch that reference.)

I see no reason why it wouldn't, but that's no guarantee, since I don't know how KCT is implemented-- specifically, I don't know exactly how KCT launches its ships. "Try it and see," is about the only advice I can offer.

9 hours ago, garwel said:

Have any plans to put it on CKAN?

Oh, the temptation to make a smart-aleck response... :wink:

Anyway, yes, it's already there-- has been since I first published it, like all my mods. SpaceDock makes it really easy to do, basically just check a little checkbox when publishing, then forget about it.

Share this post


Link to post
Share on other sites

This is a great QoL mod and should really, in my opinion, be considered for a vanilla merge.

Thanks, Snark, for making something so useful I didn't know I wanted but now can probably not live without.

Share this post


Link to post
Share on other sites
On 24/08/2017 at 11:08 AM, Snark said:

I'm an OCD consistency freak

I'd never noticed :rolleyes: 

On 24/08/2017 at 11:08 AM, Snark said:
  • I play in career mode, which means that only 0.625m probe cores are available until very late game.  Which means I always have to tuck my probe cores inside service bays.  Which makes them a pain in the posterior to rename the ship.  (Have to open the bay, find the core, change the type, close the bay.  Every. Single. Blessed. Time.)  :mad:

I don't mind the rest so much, but oh this

Share this post


Link to post
Share on other sites
11 hours ago, Snark said:

Anyway, yes, it's already there-- has been since I first published it, like all my mods. SpaceDock makes it really easy to do, basically just check a little checkbox when publishing, then forget about it.

Is it just me then who doesn't see the mod on CKAN, not even in the ALL list? Possibly, there is something wrong with its dependencies (the only one, I understand, is MM).

Share this post


Link to post
Share on other sites
11 minutes ago, garwel said:

Is it just me then who doesn't see the mod on CKAN, not even in the ALL list? 

No idea.  Have never used CKAN myself and never will; don't know what it looks like when it's installed, don't even know what an "ALL list" is (nor do I need to know, since I'm not a CKAN user).

I just check the little "CKAN" checkbox on SpaceDock when I'm publishing my mod, and leave it at that, and trust that it all just magically works.  I'm pretty sure that my other mods are working properly with CKAN (for example, when I release a new BetterBurnTime version, there's generally a surge of well over a thousand downloads within a few hours-- I assume those are CKAN people, I doubt that there are thousands of people monitoring my forum thread here!)  :wink: 

So my guess would be "it's just you".  Another possibility would be if SpaceDock had just recently broken its CKAN integration somehow, but if that were the case, I expect there would be lots of people yelling about it (perhaps you could check over at the SpaceDock thread).  (Or maybe CKAN is really slow these days, and it takes a week or more to propagate?  I only published this mod a few days ago.)

What I'm pretty sure it's not, is anything about my mod specifically.  I just check the checkbox, same as with all my mods.  (And even if there were something up with my mod... it's not as though I could do anything about it.  It's SpaceDock that handles all that CKAN stuff.)

11 minutes ago, garwel said:

Possibly, there is something wrong with its dependencies (the only one, I understand, is MM).

This seems unlikely to me (though admittedly I know nothing of the actual nuts-and-bolts of how CKAN works).  Yes, my mod requires MM to run... but I would guess that CKAN doesn't actually know that it needs MM, because, 1. I bundle MM inside my mod (so I don't need any dependency management there), and 2. I certainly haven't provided any special metadata files to CKAN telling them "I use MM", so I doubt it even knows.  (Plus there's the fact that I have other MM-bundling mods, such as IndicatorLights, which seem to work just fine on CKAN and always have.)

 

Share this post


Link to post
Share on other sites

I just fixed the CKAN for this, the submitted file which was automatically generated had a problem.

This is WONDERFUL!!!!!

Thank you @Snark

Share this post


Link to post
Share on other sites
On 9/6/2017 at 4:30 AM, Snark said:

 

Anyway, yes, it's already there-- has been since I first published it, like all my mods. SpaceDock makes it really easy to do, basically just check a little checkbox when publishing, then forget about it.

I wish it was that simple.  Unfortunately, the file generated by spacedock rarely works, so I had to create a new one and put it into ckan.

 

Share this post


Link to post
Share on other sites
On 9/7/2017 at 8:24 PM, linuxgurugamer said:

I wish it was that simple.  Unfortunately, the file generated by spacedock rarely works, so I had to create a new one and put it into ckan.

 

Major thanks for that, it's a tremendous service you just did.  :)

(Next time I'm ready to publish a mod, I guess I'll come pester you for technical details about how to tell if CKAN is set up correctly and how to fix it if it isn't.)

Share this post


Link to post
Share on other sites
10 hours ago, Snark said:

Major thanks for that, it's a tremendous service you just did.  :)

(Next time I'm ready to publish a mod, I guess I'll come pester you for technical details about how to tell if CKAN is set up correctly and how to fix it if it isn't.)

Just ping me

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now