Jump to content

[1.0.5] Science Containers v.08.3


SirDargon

Recommended Posts

SirDargon,

Since it seems you're about to release a new version, have you seen my suggestions a few posts above this one?

I'm sorry for not replying to your post, but I did look at it. I've decided to change the probe like you suggested and will be changing the location in the tech tree for the probe (if I remember correct, the 2.5m part is already under General Construction).

Hmm. Is science supposed to be locked into the part once it gets hoovered up from experiments? Like others I snagged this since I figured it'd make doing science sweeps much easier - but after doing so, I found out I couldn't retrieve it from the part via right-click, and my research vehicle is a separate one from my return vehicle.

EDIT: OK, after whipping up a ModuleManager config to insert the collection script into cockpits, it seems you can nab those on EVA even if not from the science parts themselves. Maybe a better way to go about this would be to just insert the manual collection script into cockpits and then only have new parts for automatic collection, which some folks might not even want?

I'll take a look again, but science shouldn't be locked in the container once collected. The only problem with putting them in crew capsules is that they already implement the IScienceDataContainer interface and by putting my ScienceContainer (which also implements IScienceDataCntainer) in them, you're being redundant. I'm going to look into making a separate module that can be used for crew capsules that wont be redundant.

Edit: You mean form EVA! That was an oversight on my part. I will add the ability to retrieve data from the part during EVA for the next release. Thank you for pointing that out to me!

Edited by SirDargon
Link to comment
Share on other sites

SirDagon,

Thanks! About 2.5m part, I think it shouldn't be under General Construction: I think it should be under a node related to science...

Ah, ok. Yeah, I can understand that. I just thew it in there for the time being because you should be getting the 2.5m part around that time. But you're right, it would make better sense in some sort of science node. Will move it for the next release. I have the next release about halfway done. As long as I can find a way let EVA Kerbals retrieve the data, I should have it out tomorrow. But that depends on a response to a message I sent to someone asking about how I should go about it. I know of a work around for it, but I really don't want to use a work around if I don't have to.

Link to comment
Share on other sites

Ah, ok. Yeah, I can understand that. I just thew it in there for the time being because you should be getting the 2.5m part around that time. But you're right, it would make better sense in some sort of science node. Will move it for the next release. I have the next release about halfway done. As long as I can find a way let EVA Kerbals retrieve the data, I should have it out tomorrow. But that depends on a response to a message I sent to someone asking about how I should go about it. I know of a work around for it, but I really don't want to use a work around if I don't have to.


[KSPEvent(active = true, guiName = "Collect Data", externalToEVAOnly = true, guiActive = false, guiActiveUnfocused = true, unfocusedRange = 1f)]
new public void CollectDataExternalEvent()
{
List<ModuleScienceContainer> EVACont = FlightGlobals.ActiveVessel.FindPartModulesImplementing<ModuleScienceContainer>();
if (collectedData.Count > 0) {
if (EVACont.First().StoreData(new List<IScienceDataContainer> { this }, false))
foreach (ScienceData data in collectedData)
DumpData(data);
}
}

Here you go.

Edited by 7H3LaughingMan
Link to comment
Share on other sites


[KSPEvent(active = true, guiName = "Collect Data", externalToEVAOnly = true, guiActive = false, guiActiveUnfocused = true, unfocusedRange = 1f)]
new public void CollectDataExternalEvent()
{
List<ModuleScienceContainer> EVACont = FlightGlobals.ActiveVessel.FindPartModulesImplementing<ModuleScienceContainer>();
if (collectedData.Count > 0) {
if (EVACont.First().StoreData(new List<IScienceDataContainer> { this }, false))
foreach (ScienceData data in collectedData)
DumpData(data);
}
}

Here you go.

I'm guessing you got that out of DMagic's source code? He sent me the same bit of code when I asked him about it. But I do thank you for sending it my way too. I'm going to be adding it once I figure out why none of the ScienceData coming from stock experiments are retaining their LabBoost when transferred to my parts... They retain them if you manually transfer them via Kerbal to your crew capsule and then collect, but not when you collect them straight to my parts. I think it has something to do with the use of IScienceContainer.getData() vs ModuleScienceContainer.getData().

Link to comment
Share on other sites

I'm guessing you got that out of DMagic's source code? He sent me the same bit of code when I asked him about it. But I do thank you for sending it my way too. I'm going to be adding it once I figure out why none of the ScienceData coming from stock experiments are retaining their LabBoost when transferred to my parts... They retain them if you manually transfer them via Kerbal to your crew capsule and then collect, but not when you collect them straight to my parts. I think it has something to do with the use of IScienceContainer.getData() vs ModuleScienceContainer.getData().

If you call ModuleScienceContainer.GetData() is the exact same code as trying to run it as IScienceContainer.GetData(). Could you explain a little more what you are trying to do?

Link to comment
Share on other sites

If you call ModuleScienceContainer.GetData() is the exact same code as trying to run it as IScienceContainer.GetData(). Could you explain a little more what you are trying to do?

I found out what I thought was the problem wasn't the problem. I've fixed the the LabBoost on the version I'm working on (it was really messed up in the versions online), but in doing so I found out that stock experiments (Goo and Material Labs are the only ones I've tested so far with this) can't be boosted with a lab if they are directly collected by my parts. But, if you manually collect them via a Kerbal in EVA and put them into the crew capsule, and then have my parts collect them, they can still be boosted. Why? I have no idea, and I'm trying to figure that out. There's something special about a Kerbal pulling it out compared to something else doing it. But even weirder, it looks like experiments from mods (Like DMagic's) are not effected by this and can still be boosted if collected directly with my mod.

Edited by SirDargon
Link to comment
Share on other sites

I found out what I thought was the problem wasn't the problem. I've fixed the the LabBoost on the version I'm working on (it was really messed up in the versions online), but in doing so I found out that stock experiments (Goo and Material Labs are the only ones I've tested so far with this) can't be boosted with a lab if they are directly collected by my parts. But, if you manually collect them via a Kerbal in EVA and put them into the crew capsule, and then have my parts collect them, they can still be boosted. Why? I have no idea, and I'm trying to figure that out. There's something special about a Kerbal pulling it out compared to something else doing it. But even weirder, it looks like experiments from mods (Like DMagic's) are not effected by this and can still be boosted if collected directly with my mod.

Just tested out your latest version, any data that I collected and stored into the Science Container was unable to be boosted unless I moved the data into the capsule's ModuleScienceContainer. (Only tested on Mystery Goo & Science Jr.) I believe this has to do with how the ReviewDataItem is using ExperimentResultDialogPage. I changed it on my local copy and got it working, what I am using is actually how the ModuleScienceContainer is doing it.


public void ReviewDataItem(ScienceData data) {
ExperimentResultDialogPage page = new ExperimentResultDialogPage(
part,
data,
data.transmitValue,
ModuleScienceLab.GetBoostForVesselData(part.vessel, data),
false,
"",
ModuleScienceLab.IsLabData(data),
true,
new Callback<ScienceData>(onDiscardSelectedData),
new Callback<ScienceData>(onKeepSelectedData),
new Callback<ScienceData>(onTransmitSelectedData),
new Callback<ScienceData>(onSendSelectedDataToLab));
ExperimentsResultDialog.DisplayResult(page);
}

I did notice that in storeDataEVA that you are looking for ModuleScienceContainer and using it as such, I would recommend using IScienceDataContainer since you are going to be missing his Surface Samples along with his EVA Reports.

Also worth noting if by moving a few things around in collectData(), you can remove the top most foreach making it simpler and allow the ScienceContainer to also grab any Science from the part it resides in without touching itself. Thus if someone uses ModuleManager and adds it to the capsules it will grab the Crew Reports and the default ModuleScienceContainer. Note: Do not remove the default one since it will break the ability to automatically store data upon entering the capsule from EVA.


List<IScienceDataContainer> containers = vessel.FindPartModulesImplementing<IScienceDataContainer>();
foreach(IScienceDataContainer c in containers) {
if(c != (IScienceDataContainer)this) {
ScienceData[] data = c.GetData();
foreach(ScienceData d in data) {
if(d != null) {
lastData = d;
collectedData.Add(ScienceData.CopyOf(d));
c.DumpData(d);
i++;
}
}
}
}

Edited by 7H3LaughingMan
Link to comment
Share on other sites

Thank you so much. I was up all night (literally) trying to figure out why the labBoost wasn't working. I spent so much time working on that, that most everything else was just quickly slapped together. I really do appreciate you pointing out how to fix it, along with my oversight on pulling science out of the same part. I will fix those up once I get me some rest. I would like to point out that storeDataEVA is only used to store data that a Kerbal is carrying (which uses ModuleScienceContainer) so, it shouldn't miss anything. At least it didn't when I was testing it. I'll see if it still works as intended with IScienceContainer, and if it does, I'll use it instead for consistency.

Link to comment
Share on other sites

I've just put out version .05 of Science Containers! I now have implemented everything I originally had in mind for this mod and now will be working on extra things people mentioned to add on to it!

I've even included an optional MM file (under extra downloads) that will add Science Container functionality to all command modules.

Link to comment
Share on other sites

Science lab interaction is one of the biggest problems with custom experiments. The most complicated part is resetting experiments, which shouldn't be an issue here, but you also need to make sure your experiment results dialog code is checking everything correctly when it decides whether or not to add the science boost option.

I use this line in the dialog page setup:


data.labBoost < 1 && checkLabOps() && xmitDataScalar < 1

where checkLabOps() is


private bool checkLabOps()
{
List<ModuleScienceLab> labList = vessel.FindPartModulesImplementing<ModuleScienceLab>();
for (int i = 0; i < labList.Count; i++) {
if (labList[i].IsOperational())
return true;
}
return false;
}

Link to comment
Share on other sites

The only problem with using

data.labBoost < 1 && checkLabOps() && xmitDataScalar < 1

is that science data from stock experiments have labBoost set to 0, even when they show they have a boost when reviewing them while still in the experiment. I've used

ModuleScienceLab.GetBoostForVesselData(part.vessel, data)

in place of data.labBoost, and

ModuleScienceLab.IsLabData(data)

in the place to check for a lab, which 7H3LaughingMan showed me, and as far as I've noticed, it has been giving me the correct values each time now. The only problem I've noticed is that your Solar Particle Collector data is showing a 50% boost to its transmit value (which would increase it to 70%) instead of 10% (which is 50% of it's current transmit value, like it should be) while still in the collector, but once it's in my container's it shows the correct boost (10%).

Link to comment
Share on other sites

The only problem I've noticed is that your Solar Particle Collector data is showing a 50% boost to its transmit value (which would increase it to 70%) instead of 10% (which is 50% of it's current transmit value, like it should be) while still in the collector, but once it's in my container's it shows the correct boost (10%).

That's intentional, and if I could I would make that persist, but I don't know of any way to store lab boost amounts in the data itself, so it's only when you process data while it's still inside of the solar particle collector, or bio drill or anomaly scanner that it gets boosted this way.

Link to comment
Share on other sites

Ok, I didn't realize that was intentional. I closed the issue I put on your github about it then. Well then, keeping that 50% is something I'll personally try to make compatible with my mod, seeing I it's one of my favorite mods out there for KSP.

Link to comment
Share on other sites

Science Containers v.05.1 is out!

Added compatibility with DMagic's ScienceData so that they keep their 50% labBoost in my containers.

I don't think this will actually work. Having spent an absurd amount of time trying to get my experiments working properly with science labs I've discovered that the ScienceData.labBoost field doesn't actually do what it sounds like it does. This field stores the current research level of the science data, not how much it will be increased by the science lab. The value returned by GetBoostForVesselData isn't the same thing as the labBoost value, though I think they are related.

Any labBoost value less than 1 is standard data. A labBoost of 1.5 is the regular "Detailed Analysis" level. There are, however, four other levels of research that aren't implemented, you can find them in ScienceUtil.LabBoostLevels.

What I think is going on here, is that there was once a much more complicated system of science lab gameplay. With different levels of research available, probably linked to how many science labs you have on your vessel, or maybe different types of science labs.

Link to comment
Share on other sites

I've taken a look how you did you're labBoosts and what I have works for now, as it seems all stock ScienceData have a labBoost of 0, and once boosted it gets raise greater than 1. So I'm searching for labData between 0 and 1. If it finds an experiment with such a labBoost, I know it's modded and can adjust accordingly. But for now that's a work around and I can only guarantee it'll work with your modded ScienceData properly. But on the same note, it seems most other modders also use 0 as labBoost so it should work with most others too, for now. I'm about to put out ScienceData v0.6 which has my Auto-collecting Containers, after which I'm going to look into making something like an AdvanceScienceData class, along with a new module for Science Labs that can process them, giving modders better control of labBoosts and such, so that we don't have to use this work around.

Link to comment
Share on other sites

It works for the solar particle collector, but that's just a side-effect of the arbitrary data.labBoost value that I've given to all of my results. I used 0.5, but anything below 1 would have the same end-result (at least for science not moved out of my containers). The increased level of science lab boost comes from a separate value that I've hard-coded into the particle collector module (the drill is intended to have a similar, but smaller increase, but I guess I left it out), the same goes for the anomaly scanner. Everything else though, including the Universal Storage parts, uses the stock behavior for science lab boosts; an increase of 50% of the transmission rate.

So by setting the lab research boost level to the data.labBoost level, all of my experiments will get a huge, unintended boost in science return by processing them in the lab. This could really throw things off for the stock replacement parts in my Universal Storage collection.

There are really only two data.labBoost levels that matter; anything less than 1, and 1.5, which is the standard, after-lab-processing level.

Link to comment
Share on other sites

Science Containers v.06.1 is out now! With this release, I have added some Science Containers with the ability to automatically collect science as you do experiments! Also, I have created a github for my projects on here! Check it out if you like.

It works for the solar particle collector, but that's just a side-effect of the arbitrary data.labBoost value that I've given to all of my results. I used 0.5, but anything below 1 would have the same end-result (at least for science not moved out of my containers). The increased level of science lab boost comes from a separate value that I've hard-coded into the particle collector module (the drill is intended to have a similar, but smaller increase, but I guess I left it out), the same goes for the anomaly scanner. Everything else though, including the Universal Storage parts, uses the stock behavior for science lab boosts; an increase of 50% of the transmission rate.

So by setting the lab research boost level to the data.labBoost level, all of my experiments will get a huge, unintended boost in science return by processing them in the lab. This could really throw things off for the stock replacement parts in my Universal Storage collection.

There are really only two data.labBoost levels that matter; anything less than 1, and 1.5, which is the standard, after-lab-processing level.

Hmm... I see what you mean with the US parts... I'll pull out what I had thought to be a work around for now... Hopefully I'll be able to get something made that'll help us and other science experiment modders now that I've got v.06.1 out...

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