Jump to content

[BETA][1.0.4] KerbalSorter v0.4 -- for better sifting through your vast crew roster!


JonDahm

Recommended Posts

The Kerbal Sorter

Beta release v0.4

I've always been incredibly frustrated with the lack of order in every list of kerbal in the game, ever, and the fact that you can't even rearrange them. So, to fix that, I've create a mod that will allow you to sort your crew roster by various stats, including:

  • name
  • class
  • level
  • gender
  • total number of flights

and any combination of the above! It adds a collapsible row of buttons above every roster currently in the game and lets you configure how you want to sort your Kerbals based on the order you push the buttons. So, for example, you could sort first by name (ascending), then by level (descending), then by profession. Ideally you should be able to sort from the editors or the launch panels, as well. It's very intuitive, don't worry.

Download the mod from GitHub

See the source code on Github, too!

I want to give a shout out to OakTree42 for his work on an Astronaut Complex Overhaul mod, without which I may never have figured out how to change anything in the Astronaut Complex!

Slightly out-dated.

NCg5CMI.png

v0.4 Beta

  • Added tab-switch handling to Astronaut Complex.
  • Added tool-tips to every button.
  • Added SortBar to Applicants panel, with compatibility for OakTree42's KSI-Hiring mod.
  • Added sorting by number of flights to all lists except the list of applicants.
  • Added detection for Clear and Reset buttons in Editors and Launch Windows.
  • Added detection for loading vessels in Editors.
  • Added detection for selecting vessels in Launch Windows.
  • Added fly-in animation to the Editor SortBar.
  • Lists now revert to default orderings when no sorting is applied.
  • Fixed bug where SortBars in Editors and Launch Windows would stay visible when jumping to Astronaut Complex.

v0.3 Beta -- First release

Copyright © 2015, Jon Dahm

All rights reserved.

Redistribution and use in source and binary forms, with or without

modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this

list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,

this list of conditions and the following disclaimer in the documentation

and/or other materials provided with the distribution.

* Neither the name of KerbalSorter nor the names of its

contributors may be used to endorse or promote products derived from

this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"

AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE

IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE

DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE

FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL

DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR

SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER

CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,

OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE

OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

This game (Kerbal Space Program) was made by Squad. With the exception of the icons on the buttons of the sort bar, all media content is their copyright.

Four icons used in this mod (the wrench, steering wheel, and vial, as used in the sorting-by-class button, and the rocket in the sorting-by-num-flights button) were taken from game-icons.net, and are licensed by them under the Creative Commons 3.0 License. With the exception of the rocket, I did not modify them in any way, except to display them on buttons in the game. The rocket was modified from its original format to remove an exhaust effect and to rotate the ship, as well as to add arrows. All other icons were made by me (Jon Dahm) and are public domain.

Edited by JonDahm
updating the picture.
Link to comment
Share on other sites

Interesting! Very interesting!

This will be very handy when you have to deal with huge kerbonauts roster as if you use CrewQueue mod for example. I will definitely try this!

And I have a logical suggestion for sorting options: courage and stupidity charts. Also badass filter maybe. :)

Edited by ZobrAA
Link to comment
Share on other sites

This will be very handy when you have to deal with huge kerbonauts roster as if you use CrewQueue mod for example. I will definitely try this!

That's the idea!

And I have a logical suggestion for sorting options: courage and stupidity charts. Also badass filter maybe. :)

I've been considering filters, actually. Probably a later version, after I get sorting on all the different rosters. I'm not sure how well sorting by courage and stupidity would work, though. I may look into it. Thank you for the suggestions!

Link to comment
Share on other sites

More progress! I now have the sort bar in the editors and the launch windows! That's everywhere I planned on putting them. My next step is to make sure it works with various window sizes before moving on to reintegrate sorting. Check it out!

Javascript is disabled. View full album

EDIT: I just checked both ends of the screen-size spectrum. There is a small problem on the smallest end (1024px width) where the buttons extend off the screen in the Astronaut Complex and the Launch Windows. Beyond that, it snaps to the correct position on every screen size I've tried, so I'll take that as a success!

Edited by JonDahm
Just ran screen size tests.
Link to comment
Share on other sites

Tested. And it looks to be working as intended.

Some tips for future updates:

Tooltips. As much as all buttons seem to sort kerbals in some way or the other it is hard to see what exactly does what.

In the astronaut complex the sorting only works on available Kerbals menu. Not in the active Kerbals list.

After your excellent work on Kerbal sorting is finished will you do ships in the tracking station too?

Link to comment
Share on other sites

Tested. And it looks to be working as intended.

Wonderful!

Tooltips. As much as all buttons seem to sort kerbals in some way or the other it is hard to see what exactly does what.

Interesting. I tried to make the buttons as intuitive as possible, but I can definitely see the need for tooltips. I'll look into that.

In the astronaut complex the sorting only works on available Kerbals menu. Not in the active Kerbals list.

Yeah, I know. I need to find a way to detect when users switch tabs -- after re-sorting lists when they change, that's the next thing I'll be looking into. I should probably add sorting to the list of available hires, too, but I've been putting it off in order to be compatible with OakTree42's mod.

After your excellent work on Kerbal sorting is finished will you do ships in the tracking station too?

That's an interesting idea. Any suggested sorting criterion?

Link to comment
Share on other sites

Age (AFAIK stock sorts by age), type and SOI.

I can definitely see those. I can also see sorting by name (an obvious choice) and orbital characteristics (i.e. periapsis, apoapsis, semi-major axis, etc), and potentially filtering by SOI -- I could also add filtering by type simply so it's all in one bar, but there's already filtering by type available, so I'd probably have to link the two. Thank you for the suggestions!

Link to comment
Share on other sites

OMG! Sorting in TS will be SO HELPFUL! It's like the dream since 0.19 :)

Also downloading v0.3 immediately! Thx for you work JonDahm! :D

I'm so glad you like it! :D

Alright, I've been shown a way to detect tab switches. I can now sort the list of Assigned and KIA kerbals in the Astronaut Complex! I've also found a way to detect when kerbals are hired/fired, which means I can keep the list of Available kerbals sorted even through changes. Those will be available in my next release (v0.4), which should also contain changes that keep the lists sorted in the other windows, too.

Unfortunately, I still can't find a way to detect when kerbals are added to/removed from crew rosters in the Launch Window/Editors. If anyone listening has any leads, please tip me off!

Link to comment
Share on other sites

More progress! Now, when you turn off all sorting, the lists revert back to their original ordering. The only exception to that is the Assigned tab in the Astronaut Complex; I'm still working on determining the proper ordering for it, and there are a lot of potential variables I have to account for.

I've also found and fixed a bug where the sort bars for the Launch Window and the Editor stayed visible when jumping to the Astronaut Complex.

Finally, I've added a fly-in animation for the sort bar in the editor so that it comes in with the Crew Selection window, rather than simply appearing while the window slides in behind it. The way I implemented it feels a little hacky, though. If anyone listening wants to compile the source and test it on their machine, I'd really appreciate it!

Link to comment
Share on other sites

  • 4 weeks later...

Lots, lots more progress! I've refactored some of the code and added lots of documentation.

Feature-wise, the crew lists in the Editors and Launch Windows will now re-sort themselves after pressing the Clear and Reset buttons, though unfortunately I can't detect drag and dropping kerbals. Additionally, I added a sort bar above the Applicants panel in the Astronaut Complex, which disables itself when OakTree42's KSI-Hiring mod is installed. I also added tooltips to every button this mod adds! Finally, I have the framework set up for replacing the crew auto-assigned when loading a vessel in the Editors or selecting a vessel in the Launch Windows with crew based on the user's sorting preference. It's not implemented at the moment, though, because my methods have been throwing NullReferenceExceptions when used.

I only have a couple things left before my next release: Beta v0.4. One of those is figuring out the default order that the assigned kerbals in the Astronaut Complex appear it. The other is deciding on an icon for the "Sort by Number of Flights" button. You can see my choices below, both of them designed by me, both of them crappy. :P

8roYrjC.png

Any thoughts from y'all? Anyone want to make me a better set of 16x16 icons?

Link to comment
Share on other sites

Beta v0.4 released! I went with the last icon set I made from game-icons.net for the Sort by Number of Flights button in this release, but I'm definitely still open to feedback.

Also, I'm considering making a thread in the Add-on Release subforum to gain a wider audience. Do y'all think the mod is ready for that?

Link to comment
Share on other sites

Big news! I've made support for AVC and (when 1.0 is released) CKAN! I've also got all the button and sort bar configurations in ConfigNode files that ModuleManager can modify. That means if you want to add a button, all you have to do is create a ModuleManager/ConfigNode file and compile a small DLL with your comparison function.

Next on the agenda: Actually saving the sort state on a per-game basis, fixing the drag-n-drop bug, and seeing if I can actually replace the auto-assigned crew. Things are looking up!

Link to comment
Share on other sites

  • 3 weeks later...

Sorry for being away a while -- had some health issues. I'm mostly back in shape again. :)

A progress report on what I've done since the last post:

  • Fixed the drag-n-drop bug
  • Figured out how to save and load bar states on a game-by-game basis. Not fully implemented yet.

As you can see, not a whole lot, but I've also been sick, so there's that. Hopefully I'll get back into the swing of this again soon. I'm still working on it, I promise!

Link to comment
Share on other sites

  • 4 years later...

I had a private conversation with @linuxgurugamer about merging this into TRP-Hire. I gave him permission to do this in that PM, but just for the public record, this is explicit, written consent for @linuxgurugamer to merge my code into TRP-Hire, with or without including my copyright or a copy of the license. I don't maintain this project anymore.

Happy KSPing!

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