Jump to content

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


SirDargon

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
Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...
  • 1 month later...
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...