Sign in to follow this  
SirDargon

[0.25] Configurable Science Data v.01 (For Science Experiment Modders)

Recommended Posts

[0.25] Configurable Science Data v.01.1 (For Science Experiment Modders)

This mod is meant for modders who want better control of how Science Labs boost the transmit value of a Science Report. Stock Science Labs only allow reports to be boosted by 50% of their transmit value. This mod lets modders give a custom boost amount based on 3 different ways:

  • Percent boost based on the base value
  • Percent boost based on the transmit value
  • Flat boost to the transmit value

What It Adds:

  • Adds CfgScienceData, which is a ScienceData Object with fields for a lab boost amount and what the boost pertains to (% of the base value, % of the transmit value, flat addition to the transmit value)
  • Adds ModuleCfgScienceLab, which replaces ModuleScienceLab and can handle CfgScienceData
  • Adds ModuleCfgScienceCommand, which replaces ModuleScienceContianer on parts with ModuleCommand and can handle CfgScienceData

Example Code:

Here are some example on how to review a CfgScienceData and how to process one:

public void ReviewDataItem(ScienceData data){
ExperimentResultDialogPage page = new ExperimentResultDialogPage(
part,
data,
data.transmitValue,
ModuleCfgScienceLab.GetBoostForVesselData(part.vessel, data),
true,
"Transmitting this data with cause experiment to be inoperable.",
false,
data.labBoost < 1 && vessel.FindPartModulesImplementing<ModuleCfgScienceLab>().Count > 0 && ModuleScienceLab.IsLabData(data),
new Callback<ScienceData>(onDiscardData),
new Callback<ScienceData>(onKeepData),
new Callback<ScienceData>(onTransmitData),
new Callback<ScienceData>(onSendDataToLab));
ExperimentsResultDialog.DisplayResult(page);
}

List<ModuleCfgScienceLab> labList = vessel.FindPartModulesImplementing<ModuleCfgScienceLab>();
if(labList.Count > 0){
ModuleCfgScienceLab lab = labList.FirstOrDefault(l => l.getLab().IsOperational());
if(lab != null){
lab.StartCoroutine (labList.FirstOrDefault().ProcessData((CfgScienceData)data, new Callback<ScienceData>(onLabComplete)));
}
}

If you can think of anything that could make this better, please let me know!

Change Log:

v.01.1:
Fixed casting error
Fixed lab boost showing with no lab on the vessel

v.01:
Initial Release!

Github:

https://github.com/SirDargon/ConfigurableScienceData

Download Current Version:

KSP .25:

Configurable Science Data v.01.1

Older Versions:

KSP .24.2:

Configurable Science Data v.01.1

Installation:

Merge GameData from the download with GameData in your Kerbal Space Program Directory

License:

Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)

Edited by SirDargon

Share this post


Link to post
Share on other sites

Updated to v.01.1

Fixed casting error

Fixed lab boost showing with no lab on the vessel

Share this post


Link to post
Share on other sites

As this mod doesn't seem to be getting the interest I was hoping it would, I'm going to be discontinuing it unless a bigger modder comes to me saying that they are interested in incorporating it for their mod.

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
Sign in to follow this