Jump to content

[0.24.2][WIP] Configurable Science Data v.01-beta


SirDargon

Recommended Posts

New Thread

[0.24.2][WIP] Configurable Science Data v.01-beta

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

This is a beta release to show what is capable so far and is in no way a finished product!

With that being said though, this can be used to start setting up compatibility with other mods (like my Science Containers) for when this is fully released.

This currently won't work properly with data pulled out of an experiment using this, nor via right-clicking on the Science Lab (yet).

In either case, it should revert to the stock 50% on transmit value for now.

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 can handle CfgScienceData

Planned Changes:

  • Make compatible with data pulled out of experiments and stored in crew capsules
  • Make compatible with right-clicking a Science Lab

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, (CfgScienceData)data),
true,
"Transmitting this data with cause experiment to be inoperable.",
false,
data.labBoost < 1 && 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-beta:  
Initial Beta Release!

Github:

https://github.com/SirDargon/ConfigurableScienceData

Download Current Version:

Configurable Science Data v.01-beta

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
It's out of beta
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...