Jump to content

[1.8.x-1.12.x] Module Manager 4.2.3 (July 03th 2023) - Fireworks season


sarbian

Recommended Posts

This is a question about how MM's caching works.

I use a .cfg to store settings and I've recently received several requests to move that .cfg file to a Plugin data sub-folder so that MM doesn't nuke it's cache and redo everything everytime KSP loads. (I store window positions in the .cfg file so it changes every time KSP is run.)

This is simple enough on the surface, however I am running into an issue where I have actually deliberately made my .cfg file into a ConfigNode so that other mods could modify the configuration of my mod via a MM patch for their purposes.

Now I am being asked to undo that work and turn my .cfg file from a ConfgiNode back into a basic settings file and hide in from MM in the Plugin data subfolder. I'm pretty sure this is mutually exclusive so I'm wondering it there was some quirk to the caching process I could maybe take advantage of?

In short, is there a way to keep my .cfg file exposed so that the settings of my mod can be modified by other mods with an MM patch, but not trigger MM's cache rebuilding when the values of the window position variables saved in the file change?

(It is a career overhaul mod that interacts with my AGX mod to change how action group unlocking progresses that is causing this.)

D.

Edited by Diazo
Link to comment
Share on other sites

@Diazo How can that work?  If you're writing to the file, but other mods can change it, then couldn't whatever you save could be clobbered by a patch and never take effect?  Maybe there are some settings you want to be controllable by the user and some you want to expose to other mods?

Link to comment
Share on other sites

1 hour ago, Diazo said:

This is a question about how MM's caching works.

I use a .cfg to store settings and I've recently received several requests to move that .cfg file to a Plugin data sub-folder so that MM doesn't nuke it's cache and redo everything everytime KSP loads. (I store window positions in the .cfg file so it changes every time KSP is run.)

This is simple enough on the surface, however I am running into an issue where I have actually deliberately made my .cfg file into a ConfigNode so that other mods could modify the configuration of my mod via a MM patch for their purposes.

Now I am being asked to undo that work and turn my .cfg file from a ConfgiNode back into a basic settings file and hide in from MM in the Plugin data subfolder. I'm pretty sure this is mutually exclusive so I'm wondering it there was some quirk to the caching process I could maybe take advantage of?

In short, is there a way to keep my .cfg file exposed so that the settings of my mod can be modified by other mods with an MM patch, but not trigger MM's cache rebuilding when the values of the window position variables saved in the file change?

(It is a career overhaul mod that interacts with my AGX mod to change how action group unlocking progresses that is causing this.)

D.

The cache is cleaned if any cfg/dll (I use a hash to check) changed or if dll/cfg were added/removed. So if the content of your mod config does not change all the time there is no point in putting them in Plugin data. If some part of your file does change all the time then I would have a cfg for the part that change in the plugin data subfolder and the "static" part in the usual folder. Sorry for the work :)

Link to comment
Share on other sites

@blowfish It's currently for changing values that are only changeable in the .cfg file anyway at this point (so they are not accessible from in-game), although you are correct that it would reset the values to whatever the MM patch is every time KSP starts if you offered this on values that could be changed in game.

@sarbian So 2 config files seems to be the best solution then? Was trying to avoid that but I can make it work.

D.

Link to comment
Share on other sites

How the heck do I prevent MM from repatching all the config files on every startup? I thought the cache function was supposed to fix that? :( 

 

Any help is appreciated. I think @NathanKell mentioned something about .cfg files being in /GameData/, but I cant find his post regarding it. I have a config that adds mechjeb and KER to command pods in my GameData folder, and also my config for blizzy's toolbar. Could that be affecting the cache?

Link to comment
Share on other sites

20 minutes ago, jstnj said:

How the heck do I prevent MM from repatching all the config files on every startup? I thought the cache function was supposed to fix that? :( 

 

Any help is appreciated. I think @NathanKell mentioned something about .cfg files being in /GameData/, but I cant find his post regarding it. I have a config that adds mechjeb and KER to command pods in my GameData folder, and also my config for blizzy's toolbar. Could that be affecting the cache?

MM will only use the cache if no configs or plugins have changed.  It will also tell you what changed in the log.

Link to comment
Share on other sites

1 hour ago, cy-one said:

Is there a way to filter parts that have a crew capacity > 1?

 

Something like 

@PART[*]:HAS[@MODULE[ModuleScienceLab], #CrewCapacity[>1]]

?

@PART:HAS[#CrewCapacity[>1]]

Should do

Check that the case sensitivity is right because I don't remember right now

Link to comment
Share on other sites

On 20.5.2016 at 2:08 AM, blowfish said:

It has no effect as in what? As in you looked at the reaction wheel values in the editor part catalog and they aren't different from their original values? Or as in you looked at ModuleManager.ConfigCache and saw that the changed didn't apply?

If you want us to help you debug this, please do the following:

  • Post the exact patch you have and the path to the .cfg file that contains it (e.g. GameData/Stuff/MyPatch.cfg)
  • Delete GameData/ModuleManager.ConfigCache
  • Open KSP and let it load to the main menu
  • Post KSP.log (in the KSP root folder) and GameData/ModuleManager.ConfigCache

(these are really the steps for debugging any module manager patch)

The original person I wrote the tutorial for had no complaints, so it's probably some configuration issue on your end.

2.6.65 somehow fixed this. thank you anyway

Link to comment
Share on other sites

On 5/20/2016 at 10:14 AM, cy-one said:

Might be a stupid post, but how does one do multiline comments in MM/stock configs?

Just in case someone else looks this up.

Notepad++ has a short-cut (CTRL+Q) that toggles comments... You can select multiple lines and it will put // in front of each... and also remove it, when pressed again.
Super handy!

Link to comment
Share on other sites

Would the following be read as I expect?

 

ratio = #$/MODULE[ModuleEnginesFX],0/PROPELLANT[IntakeAir]/ratio$

 

im trying to get the ratio value of the PROPELLANT node named IntakeAir from the first instance of ModuleEnginesFX.

 

If this is not correct, how would I do the above?

 

EDIT - NM, it works fine.  i misplaced punctuation elsewhere.

 

Edited by xx_mortekai_xx
Link to comment
Share on other sites

Question regarding changing multiple propelants... I've looked on the wiki and this thread, but I can't find anything that works for me.

 

I'm trying to make a patch that will handle all engines in a certain mod to change the propellant ratio. Say the engine module uses two propellants but I do not know which ones (could be any of 4 combinations as fuel switch is active and different engines use different fuels).

 

I tried this, but it only works on the first of the two propellants. Simply adding the same @PROPELLANT just changes the first one again, not the second.

@PART[*]:HAS[@MODULE[ModuleEngines*]]:NEEDS[X]:AFTER[Y]
  
        @PROPELLANT
        {
            @ratio /= 2
        }

 

Then I tried the ,1 and ,2 options but this only change the second one (guessing this is not he correct approach).

        @PROPELLANT,1
        {
            @ratio /= 2
        }
        @PROPELLANT,2
        {
            @ratio /= 2
        }

 

What am I doing wrong?

Edited by Jimbodiah
Link to comment
Share on other sites

8 minutes ago, Jimbodiah said:

Question regarding changing multiple propelants... I've looked on the wiki and this thread, but I can't find anything that works for me.

 

I'm trying to make a patch that will handle all engines in a certain mod to change the propellant ratio. Say the engine module uses two propellants but I do not know which ones (could be any of 4 combinations as fuel switch is active and different engines use different fuels).

 

I tried this, but it only works on the first of the two propellant.


@PART[*]:HAS[@MODULE[ModuleEngines*]]:NEEDS[X]:AFTER[Y]
  
        @PROPELLANT
        {
            @ratio /= 2
        }

 

Then I tried the ,1 and ,2 options but this only change the second one (guessing this is not he correct approach).


        @PROPELLANT,1
        {
            @ratio /= 2
        }
        @PROPELLANT,2
        {
            @ratio /= 2
        }

 

What am I doing wrong?

Try this:

	@Part[*]:HAS[@MODULE[ModuleEngines*]]:NEEDS[X]:AFTER[Y]
	{
	     @MODULE[ModuleEngines*]
	     {
	          @PROPELLANT[*],0
	          {
	               @ratio /= 2
	          }
	          @PROPELLANT[*],1
	          {
	               @ratio /= 2
	          }
	     }
	}
	

Edited by xx_mortekai_xx
Link to comment
Share on other sites

Thanks BlowFish!!!!!

Then going one step further...

        @atmosphereCurve
        {
        @key[1, ] *= 1.1
	    @key,1[1, ] *= 1.1
        }

Is this the right way to change these values?

 atmosphereCurve
 {
        key = 0 310
        key = 1 265
 }

 

Trying to wrap my head around the syntaxes.

 

Edited by Jimbodiah
Link to comment
Share on other sites

53 minutes ago, Jimbodiah said:

^ Answer is yes, just tried it... 

Thanks for the help guys!!!!

keep in mind that those curves may have 4 elements. (key = 1 2 3 4)

if they have, and you are multiplying the second value by 1.1 (or any other number), you should also multiply the third and fourth values by the same number

on the contrary, if you multiply the first value by 1.1 (or any other number) you should divide the third and fourth values by that same number

Link to comment
Share on other sites

Yep, indeed. In this case there are only two values though, the first relating to atm pressure and the second the ISP value at that pressure. Just wanted to check if I can grasp how the syntax works.

Keep up the good work guys!!!!!

Link to comment
Share on other sites

11 minutes ago, Jimbodiah said:

Yep, indeed. In this case there are only two values though, the first relating to atm pressure and the second the ISP value at that pressure. Just wanted to check if I can grasp how the syntax works.

Keep up the good work guys!!!!!

you could also use:

@key,*[1, ] *= 1.1

this will apply to all "key" and multiply the second element of the list by "1.1"

Link to comment
Share on other sites

im trying to nerf reaction wheels in my install, and i have this code so far:

//nerfing reaction wheels
@PART[*]:HAS[ModuleReactionWheel]
{
	@MODULE[ModuleReactionWheel]
	{
		@PitchTorque /=2
		@YawTorque /=2
		@RollTorque /=2
	}
}

why is this not working?

Link to comment
Share on other sites

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