Jump to content

Can you Filter Science Experiments when Storing


Recommended Posts

I've done a bit of coding with work and thought I might try my hand at making a small mod regarding science. One thing I can't work out is if the function behind the "Store experiments" process for a Kerbal on EVA is an all or nothing process?

I'm looking to hide the existing "Store Experiments" button and replace with a process of my own making. I figure this part should be fairly straight forward (at least I 'think' it should be) My question to the KSP coding community is: Can the experiment storage function be made to use filters so it only stores certain experiments? Alternatively, do you think it's possible to create a replacement process that does the filter specifics that I'm looking for as well as hide the stock "Store experiments" button?

Example Scenario:
Kerbal EVA's from command module
Kerbal on EVA uses button "Take Data (15)" to grab all experiments from command module
Kerbal on EVA uses 'custom' button to "Store Crew Reports(2)"

This isn't the mod, but being able to filter the science reports when storing them upon returning from EVA is something I'd like to do for my idea to work. If not, my backup is to resort to a workaround post EVA, and have a function to move the specific experiments from one ScienceContainer to another within the same ship - I've seen 2-3 mods that already do a variety of that so I know that's possible.

 

Link to comment
Share on other sites

An example of a mod that works with individual experiment results in a ScienceDataContainer would be Ship Manifest take a look at it on GitHub.

To do what you're talking about I would suggest starting by writing a PartModule that inherits ScienceDataContainer and then overriding the CollectDataExternalEvent and StoreDataExternalEvent methods with whatever filtering code you need (or hide them and replace with other actions and events). Use a module manager patch to replace existing ScienceDataContainer modules with your custom module.

The methods and fields are all public so it looks like it should be possible but I don't have any real experience with writing PartModules.

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