Jump to content

Science Lab Module migration problem


wrexecute

Recommended Posts

I'm trying to add the experiment reset functionality (via ModuleManager) from the stock science lab to another manned part (FusTek Science Module to be exact). I'm having this frustrating problem making it impossible to right-click anything on the flight scene when I use the modified part. Removing the custom part from the design allows me to right click and open menus again on the next launch. After that I tried to migrate the science module into many other modded and stock parts, getting the same result. It only works right when I use the original lab piece.

This some kinda sick joke? I want a lighted lab so badly!

To clarify, here is also the stuff I wrote to the MM config, which was a brand new blank file made just for this purpose. I placed it in GameData/MyTweaks which is where I keep everything else I've customized:

@PART[KarmonySciModule]
{

MODULE
{
name = ModuleCommand
minimumCrew = 0

RESOURCE
{
name = ElectricCharge
rate = 0.005
}
}

MODULE
{
name = ModuleScienceContainer

reviewActionName = Review Data
storeActionName = Store Experiments
collectActionName = Take Data

evaOnlyStorage = True
storageRange = 2

allowRepeatedSubjects = True
}

MODULE
{
name = ModuleScienceLab

containerModuleIndex = 0
dataTransmissionBoost = 1.5
crewsRequired = 2

canResetConnectedModules = True
canResetNearbyModules = True
interactionRange = 5

RESOURCE_PROCESS
{
name = ElectricCharge
amount = 10
}
}

}

Edited by wrexecute
Link to comment
Share on other sites

I tried this once, adding a science lab module to a command pod to make testing easier and had exactly the same problem. I've seen a few other people run into this as well.

I never really played around with it to try fixing it though. Does the FusTek part have its own ModuleScienceExperiment or ModuleScienceContainer modules? Maybe those interfere somehow. Try adding ModuleScienceLab to another part, maybe a crew container, and see what happens.

Link to comment
Share on other sites

The FusTek part I currently use only has a light module for the windows, which works. Adding my cfg into the mix screws that up and anything else with a right-click menu as well. Also tried it on the Hitchhiker, and a KSPI Lab. Neither worked, and I suspected the KSPI Lab wouldn't like it anyway with all its inherent modules already running things on its end. Ah well, I'll have to go with the stock lab for my mission until I can figure this out. There's plenty of nice addons to light it up.

Link to comment
Share on other sites

You need to check output_log.txt when something like this happens because you can't rely on some grumpy yet benevolent person to come along and try it for you. (error below)

My guess is that it's getting hung up on containerModuleIndex which probably literally means the Nth module in the part of the science container module. You'll note in the original, the science container is the first module (index 0)

I've played around with it trying index 3, 4 and 5. I tried those numbers because according to the database, the science container was the 5th module. Then later I tried 4 because I deleted the command module as the Fustek science part already had one. I looked at the quicksave to see where in the part the module was according to that and it was number 3, but that doesn't work either. I've got a bunch of mods loaded and some of them are adding modules to parts so I'm not quite sure what order the science container really is.

So, the TL;DR of all that is that the science lab expects to have the location of the container passed to it in its MODULE node and if the indexed number doesn't match the location of an actual science container then it will throw an exception.

Delete your ModuleManager configuration that adds the science stuff and edit the actual part.cfg

Insert the science modules before ANY OTHER MODULES. Or if you put them somewhere other than up in front then make careful note of where the container module is and change the index in the science lab to correspond.

Ordinarily I wouldn't tell someone not to use ModuleManager for this, but the way Squad set that up means that if you want to do it with ModuleManager you'll have to positively identify the correct index of the container and if the ordinal location of the container changes for any reason then the science part will BREAK all over again. (Thanks Squad)

Edit: Also, you had a command module in your patch file but the Karmony Science Lab already has a command module


NullReferenceException: Object reference not set to an instance of an object
at ModuleScienceLab.updateModuleUI () [0x00000] in <filename unknown>:0

at ModuleScienceLab.onPartActionUI (.Part p) [0x00000] in <filename unknown>:0

at EventData`1[Part].Fire (.Part data) [0x00000] in <filename unknown>:0

at UIPartActionWindow.CreatePartList () [0x00000] in <filename unknown>:0

at UIPartActionWindow.Setup (.Part part, DisplayType type, UI_Scene scene) [0x00000] in <filename unknown>:0

at UIPartActionController.CreatePartUI (.Part part, DisplayType type, UI_Scene scene) [0x00000] in <filename unknown>:0

at UIPartActionController.SelectPart (.Part part, Boolean allowMultiple) [0x00000] in <filename unknown>:0

at UIPartActionController.HandleMouseClick (UnityEngine.Camera cam, Boolean allowMultiple) [0x00000] in <filename unknown>:0

at UIPartActionController+.MoveNext () [0x00000] in <filename unknown>:0

Link to comment
Share on other sites

I see now, thank you. So modules sometimes have to be in a particular order, oh boy. I can see how the extra command module could be a problem as well, lacking the @ symbol for modifying the existing one. I'm guessing this created a second one erroneously? Or does the parser ignore duplicate modules unless it spots a @ for modification? This is why these things are best left out of novice hands like mine. Thanks for the explanation of this, it isn't lost on me. However, as a rule I keep all my tweaks to their own MM files, and am probably better off leaving this one alone. I can fix it like you mentioned, but you also brought up something else; I certainly do have many tweaked modules flying around my game directory, there's no telling when that science module will get out of order and break again.

Link to comment
Share on other sites

I see now, thank you. So modules sometimes have to be in a particular order, oh boy. I can see how the extra command module could be a problem as well, lacking the @ symbol for modifying the existing one. I'm guessing this created a second one erroneously? Or does the parser ignore duplicate modules unless it spots a @ for modification? This is why these things are best left out of novice hands like mine. Thanks for the explanation of this, it isn't lost on me. However, as a rule I keep all my tweaks to their own MM files, and am probably better off leaving this one alone. I can fix it like you mentioned, but you also brought up something else; I certainly do have many tweaked modules flying around my game directory, there's no telling when that science module will get out of order and break again.

Correct, you would want an @ to avoid a duplicate command module

For ModuleManager 1.5.6+ there's also the % which acts like a @ unless the part lacks the specified module in which case it adds it. So if you had put a %MODULE[ModuleCommand]{//stuff} then it would have edited the existing ModuleCommand on the sci module.

As far as order goes, most of the time order is irrelevant but there are instances where some plugins cause errors if a given PartModule isn't loaded in expected order.

If you ever run into a situation where an existing craft mysteriously breaks but an identical launched craft is ok, then the expected order might have changed rendering existing craft in your save file invalid. It's a bizarre situation that even editing of the craft in the save file is difficult or nigh impossible to remedy.

But I digress. Order in this situation shouldn't matter except that the science lab was coded in a way where the code depends on the science container being in a given ordinal location in the part.

A better way for Squad to have done this would be some sort of tag variable that could be set on the container module node and a corresponding variable on the science lab. That would have been immune to any order changes.

Link to comment
Share on other sites

  • 6 months later...

Thanks Starwaster.

Following your advice I managed to sort out a similar problem I had.

I wanted to add the "clean out experiment" functionality to the KSPI lite science lab.

I much prefer the KSPI science lab model, and it also has an IVA.

Not to mention the science researching function that is useful to stick on a long duration mission ship.

After making sure the science module was top in the cfg, I now have a KSPI science lab with the "clean out experiments" function.

It kept all it's previous function too.

Just what is needed for a long distance science ship. :)

Link to comment
Share on other sites

  • 1 month later...
Correct, you would want an @ to avoid a duplicate command module

For ModuleManager 1.5.6+ there's also the % which acts like a @ unless the part lacks the specified module in which case it adds it. So if you had put a %MODULE[ModuleCommand]{//stuff} then it would have edited the existing ModuleCommand on the sci module.

As far as order goes, most of the time order is irrelevant but there are instances where some plugins cause errors if a given PartModule isn't loaded in expected order.

If you ever run into a situation where an existing craft mysteriously breaks but an identical launched craft is ok, then the expected order might have changed rendering existing craft in your save file invalid. It's a bizarre situation that even editing of the craft in the save file is difficult or nigh impossible to remedy.

But I digress. Order in this situation shouldn't matter except that the science lab was coded in a way where the code depends on the science container being in a given ordinal location in the part.

A better way for Squad to have done this would be some sort of tag variable that could be set on the container module node and a corresponding variable on the science lab. That would have been immune to any order changes.

Necrobump.

THANK YOU Starwaster! You helped me as well

Link to comment
Share on other sites

  • 6 months later...

I was having this issue as well, so thank you Starwaster. Something I noticed, however. The "containerModuleIndex" value in ModuleScienceLab isn't pointed at the ModuleScienceLab module. It's actually pointing at the ModuleScienceContainer module. So if the part you want to add ths science lab to already has a ModuleScienceContainer in it, you just have to figure out which module number it is and put that into the "containerModuleIndex" in your ModuleManager config.

For instance, the part that I'm trying to tweek comes from the Skylab mod (skylab_unbroken.cfg). In that part, there is a ModuleCommand, ModuleRCS, ModuleReactionWheel & ModuleScienceContainer, in that order. So in my module manager config, I set "containerModuleIndex = 3" and now the right click menu appears exactly as expected.

That said, while the right click menu works, it looks like the ModuleScienceConverter doesn't. The "Science", "Data" & "Rate" values that should appear on the right click menu. I can use the "Process in Lab Module" option, but it dosen't appear that anything gets put into research. Also, the "Start Research" button isn't available. I don't see any errors on the debug toolbar, and if I look at the part database the ModuleScienceConverter is definitely on the part. Finally, I know the part works fine if I put both the ModuleScienceConverter & ModuleScienceLab directly into the main cfg instead of adding them through MM. I'm still trying to figure out what might be causing the converter not to work.

Link to comment
Share on other sites

  • 1 month later...
I was having this issue as well, so thank you Starwaster. Something I noticed, however. The "containerModuleIndex" value in ModuleScienceLab isn't pointed at the ModuleScienceLab module. It's actually pointing at the ModuleScienceContainer module. So if the part you want to add ths science lab to already has a ModuleScienceContainer in it, you just have to figure out which module number it is and put that into the "containerModuleIndex" in your ModuleManager config.

For instance, the part that I'm trying to tweek comes from the Skylab mod (skylab_unbroken.cfg). In that part, there is a ModuleCommand, ModuleRCS, ModuleReactionWheel & ModuleScienceContainer, in that order. So in my module manager config, I set "containerModuleIndex = 3" and now the right click menu appears exactly as expected.

Thanks TONS! This was a big help.

Link to comment
Share on other sites

I'm guessing that one of the recent ModuleManager updates resolved the problem relating to ModuleScienceLab and ModuleScienceConverter because I now seem to be able to add them via module manager instead of altering the part's config file. That's cool. You still have to know the exact MODULE number of the ModuleScienceContainer in the part, but as long as you don't remove modules (and control the order new modules get added), it all seems to work fine.

I'm running into a new problem, though. I'm trying to add the ModuleScienceLab and ModuleScienceConverter modules to Bobcat's AltairlanderPod (from his "AmericanPack" parts pack). Adding the modules isn't an issue. The problem I'm encountering is that the AltairlanderPod is a command module, rcs thruster and engine, all in one part. And when you add the ModuleScienceConverter module (either directly to the part.cfg or via modulemanager), the engine on the pod is active as soon as you go to the launch pad. Everything else works, and you can shut the engine down manually. I'm just wondering if anyone else has experience this and if anyone has found a way to correct this behavior?

EDIT: Apparently, the issue I'm having with engines being on by default isn't related to ModuleScienceConverter. Or at least not just to that module. I was editing the Altairdescentstage module (same parts pack) to include the CO2 scrubber and Water purifier modules from Tac Life Support and when I did, the engine on the Altairdescentstage also starts active at launch. Would still love to fine a way to force the engines to be off by default.

Edited by chrisl
Link to comment
Share on other sites

  • 1 year 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...