Jump to content

[Workaround found] Help needed submitting science data to RnD archives


Guest

Recommended Posts

Ok, so I’m updating a mod called Syncrio, it is a multiplayer extension that syncs scenario data from client to client. I’m almost done with the update, but I need help figuring out how to add a science subject to the RnD archives.

I've been using the game event "OnScienceRecieved" to get the data on client A and "ResearchAndDevelopment.Instance.SubmitScienceData(float dataAmount, scienceSubject subject)" to add it on client B’s side.

But, all I get on client B’s side is "[Research & Development]: +5 data on Crew Report from LaunchPad. Subject value is 0.00" in KSP's debug log and it does not register the data in the RnD archives. Meaning the same data can be gathered on client A and then gathered again on client B.

Oddly enough, client A data gets this message "[Research & Development]: +5 data on Crew Report from LaunchPad. 2 Science added. Subject value is 0.00" when they gather the data, the difference between the two messages being the "2 Science added." part.

I have also tried creating a custom part/part module to gather and transmit the science data, but all I got was a message saying that I had completed the progress node for science recovery on kerbin.

This is the last thing I need done for Syncrio's science game mode to be released and I have been at this for over a week now and have made no progress. So any help anyone can give will be greatly appreciated.

 

========Edit========

A workaround has been found. Using the config nodes from the science subjects, it is possible to input the config nodes into the RnD config node. Here is a code example:

Spoiler

ConfigNode RnDCFG = new ConfigNode();

ResearchAndDevelopment.Instance.Save(RnDCFG);

//Then input the science subjects into the "RnDCFG"

List<ProtoScenarioModule> psmLocked = HighLogic.CurrentGame.scenarios;

int idx = psmLocked.FindIndex(i => i.moduleName == "ResearchAndDevelopment");

if (ScenarioRunner.GetLoadedModules().Contains(psmLocked[idx].moduleRef))
{
  	ScenarioRunner.RemoveModule(psmLocked[idx].moduleRef);
}

psmLocked[idx].moduleRef = ScenarioRunner.Instance.AddModule(RnDCFG);
psmLocked[idx].moduleRef.targetScenes = HighLogic.CurrentGame.scenarios[idx].targetScenes;

HighLogic.CurrentGame.scenarios = psmLocked;

 

I hope this helps anyone trying to do this, or something like this. :)

Edited by Caylis1397
Workaround found
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...