sarbian

[1.8.x-1.10.x] Module Manager 4.1.4 (July 7th 2020) - Locked inside edition

Recommended Posts

5 minutes ago, blowfish said:

should be as simple as @texture,*

Thank you

Share this post


Link to post
Share on other sites

So this is probably a silly question, and I'm guessing the answer is no, but is it possible to use Module Manager to override settings in KSP's main game settings file (/settings.cfg)? 
There's always a few things that I set, and some which aren't shown in the settings UI, so it would just be convenient to have a module manager style patch that could just be dropped in and set those values.
I know it's easy enough to just copy the settings.cfg file over from each install, but I prefer to not do that when moving up to to a new version of KSP.

Share this post


Link to post
Share on other sites

I don't think it is, but I'd love to be proven wrong.

Failing the elegant MM approach, as a hackjob you could try moving _your_ settings.cfg out of the way so KSP generates a new default one, then 'diff' those two, and include a call to 'patch' in your launcher script...

$ diff -Naur KSP/settings.cfg backuplocation/settings.backup > backuplocation/mysettings.patch
$ patch --dry-run KSP/settings.cfg backuplocation/mysettings.patch



Take the above snippet with a grain of salt; I haven't experimented with either approach, mostly because I was too lazy and usually just copied my old settings to a new install, but unless the MM route turns out to be feasible, I think I'm going to try that approach for the upcoming update cycle...

Share this post


Link to post
Share on other sites

MM can and will not modify anything that's modified by KSP itself.  It would basically break the ability to edit settings in-game.

Share this post


Link to post
Share on other sites

I want to make a patch that will apply to all parts that have any resource except, let's say, IntakeAir. How do I do that?

I could use this example from the Github Wiki:

@PART[*]:HAS[!RESOURCE[IntakeAir],@RESOURCE[*]]
{ ... }

But it will be incorrect, because if a part has both IntakeAir and some other resource, this patch won't apply to it (and I do want it to apply).

So, is there a way to specify key values that I want to exclude from search?

Share this post


Link to post
Share on other sites
4 hours ago, garwel said:

But it will be incorrect, because if a part has both IntakeAir and some other resource, this patch won't apply to it (and I do want it to apply).

A multi-part patch appears to do the trick in a quick test (I used ElectricCharge as the excluded resource):

// mark all parts with excluded keys
@PART:HAS[@RESOURCE[ElectricCharge]]
{
    %__excludeResource = true
}

// remove mark from parts with included keys
@PART:HAS[#__excludeResource[true],@RESOURCE[!ElectricCharge]]
{
    !__excludeResource = any 
}

// patch unmarked parts
@PART:HAS[~__excludeResource[true],@RESOURCE[*]]
{
	// patch parts here
}

// cleanup
@PART:HAS[#__excludeResource[*]]
{
    !__excludeResource = any
}

 

Share this post


Link to post
Share on other sites
1 hour ago, garwel said:

I want to make a patch that will apply to all parts that have any resource except, let's say, IntakeAir. How do I do that?

I could use this example from the Github Wiki:


@PART[*]:HAS[!RESOURCE[IntakeAir],@RESOURCE[*]]
{ ... }

But it will be incorrect, because if a part has both IntakeAir and some other resource, this patch won't apply to it (and I do want it to apply).

So, is there a way to specify key values that I want to exclude from search?

What are you trying to do with the patch?  Typically if you're trying to do something with other resources you don't care whether or not the part has IntakeAir or not.

Share this post


Link to post
Share on other sites

I originally asked this in another topic, but I think it would fit better here:

I go through this pre-launch routine every time.  I was wondering if there a simple MM patch for setting the default view on some preferred launch configurations:

  • Expand staging bar to show numbers
  • Change to orbital AP and PE numbers
  • Pop out the resource levels on the bar

Share this post


Link to post
Share on other sites
44 minutes ago, Probus said:

I originally asked this in another topic, but I think it would fit better here:

I go through this pre-launch routine every time.  I was wondering if there a simple MM patch for setting the default view on some preferred launch configurations:

  • Expand staging bar to show numbers
  • Change to orbital AP and PE numbers
  • Pop out the resource levels on the bar

No way for MM to do that (and no default configuration exists for MM to even affect).  These all sound valuable but the best way for them to be addressed would be for Squad to do actually implement them in the base game.

Share this post


Link to post
Share on other sites
7 hours ago, blowfish said:

No way for MM to do that (and no default configuration exists for MM to even affect).  These all sound valuable but the best way for them to be addressed would be for Squad to do actually implement them in the base game.

Darn.  Thanks for the quick response @blowfish.

Share this post


Link to post
Share on other sites
23 hours ago, blowfish said:

What are you trying to do with the patch?  Typically if you're trying to do something with other resources you don't care whether or not the part has IntakeAir or not.

The idea is to add a module only to parts that have "normal" resources (e.g. LiquidFuel or EC, but not IntakeAir, Ablator and so on).

Share this post


Link to post
Share on other sites
8 hours ago, garwel said:

The idea is to add a module only to parts that have "normal" resources (e.g. LiquidFuel or EC, but not IntakeAir, Ablator and so on).

What specifically defines a "normal" resource in this case?  What does the module do with it?

Share this post


Link to post
Share on other sites
3 hours ago, blowfish said:

What specifically defines a "normal" resource in this case?  What does the module do with it?

It's quite complicated to explain (this is for a new mod that will introduce some special mechanics), but the main idea is, these are resources that can be stored, consumed/produced and can flow. It includes all liquid and gaseous fuels, life support resources etc.

Share this post


Link to post
Share on other sites
3 hours ago, garwel said:

It's quite complicated to explain (this is for a new mod that will introduce some special mechanics), but the main idea is, these are resources that can be stored, consumed/produced and can flow. It includes all liquid and gaseous fuels, life support resources etc.

Okay, so it sounds like you want to include most resources except for IntakeAir and possibly a few others (IntakAtm from firespitter and Ablator come to mind).  You might be able to do this in MM with a multi-stage patch, it gets a bit complicated though

Spoiler

@PART:HAS[@RESOURCE]:FOR[SomeMod]
{
    someModResourceCount = 0

    @RESOURCE,*
    {
        */someModResourceCount += 1
    }
    
    @RESOURCE[IntakeAir]
    {
        */someModResourceCount -= 1
    }
    
    @RESOURCE[IntakeAtm]
    {
        */someModResourceCount -= 1
    }
    
    @RESOURCE[Ablator]
    {
        */someModResourceCount -= 1
    }

    // any other resources you want to exclude
}

@PART:HAS[#someModResourceCount[>0]]:FOR[SomeMod]
{
    MODULE[MyModule] {}
}

@PART:HAS[#someModResourceCount]:FOR[SomeMod]
{
    !someModResourceCount = DELETEORWHATEVER
}

 

If it's for a new module though you may be better off just applying it to everything and handling the details of that in code.

Share this post


Link to post
Share on other sites
// copy the surfAntenna properties to a retractable antenna
+PART[Antenna_Tape2]:FINAL
{
  @name = surfAntennaDeploy
  @title = Communotron 16-S Deployable
  @mass = #$@PART[surfAntenna]/mass$
  @MODULE[ModuleDataTransmitter]
  {
    @packetSize = #$@PART[surfAntenna]/MODULE[ModuleDataTransmitter]/packetSize$
    @packetResourceCost = #$@PART[surfAntenna]/MODULE[ModuleDataTransmitter]/packetResourceCost$
    @antennaPower = #$@PART[surfAntenna]/MODULE[ModuleDataTransmitter]/antennaPower$
  }
  @MODULE[ModuleDeployableAntenna]
  {
    @windResistance = 100
  }
}

I get the errors in the log:

[ERR 23:23:37.377] Error - Cannot parse variable search when editing key mass = #$@PART[surfAntenna]/mass$
[ERR 23:23:37.382] Error - Cannot parse variable search when editing key packetSize = #$@PART[surfAntenna]/MODULE[ModuleDataTransmitter]/packetSize$
[ERR 23:23:37.387] Error - Cannot parse variable search when editing key packetResourceCost = #$@PART[surfAntenna]/MODULE[ModuleDataTransmitter]/packetResourceCost$
[ERR 23:23:37.391] Error - Cannot parse variable search when editing key antennaPower = #$@PART[surfAntenna]/MODULE[ModuleDataTransmitter]/antennaPower$

Looked again at the docs for variables and not sure how to work around this

Share this post


Link to post
Share on other sites
4 hours ago, Drew Kerman said:

I get the errors in the log:

[ERR 23:23:37.377] Error - Cannot parse variable search when editing key mass = #$@PART[surfAntenna]/mass$
[ERR 23:23:37.382] Error - Cannot parse variable search when editing key packetSize = #$@PART[surfAntenna]/MODULE[ModuleDataTransmitter]/packetSize$
[ERR 23:23:37.387] Error - Cannot parse variable search when editing key packetResourceCost = #$@PART[surfAntenna]/MODULE[ModuleDataTransmitter]/packetResourceCost$
[ERR 23:23:37.391] Error - Cannot parse variable search when editing key antennaPower = #$@PART[surfAntenna]/MODULE[ModuleDataTransmitter]/antennaPower$

Looked again at the docs for variables and not sure how to work around this

Double check capitalization in SurfAntenna against the part you're looking at.  It is case sensitive.

Share this post


Link to post
Share on other sites
Posted (edited)
15 minutes ago, blowfish said:

Double check capitalization in SurfAntenna against the part you're looking at.  It is case sensitive.

Derp, wasn't even considering case sensitivity. the error made me think I wasn't supposed to be directly assigning searched keys to edited keys, but that's what I saw in examples and thus was like "wah?"

Can it be changed to make it more obvious it couldn't find the part it was searching for?

Edited by Drew Kerman

Share this post


Link to post
Share on other sites

I have a couple MM warnings from JNSQ, GEP and GEP_JNSQ

[LOG 13:35:41.589] [ModuleManager] WARNING: unrecognized tag: 'LAST' on: JNSQ/JNSQ_Configs/Antenna/@PART:HAS[@MODULE[ModuleDataTransmitter*]]:LAST[JNSQ]
[LOG 13:35:41.589] [ModuleManager] WARNING: unrecognized tag: 'LAST' on: JNSQ/JNSQ_Configs/Antenna/@PART:HAS[@MODULE[ModuleDataTransmitter*]]:LAST[JNSQ]
@PART:HAS[@MODULE[ModuleDataTransmitter*]]:LAST[JNSQ]
{
	@MODULE[ModuleDataTransmitter]
	{
		@antennaPower *= 4
		%JNSQ = True
	}
	@MODULE[ModuleDataTransmitterFeedeable]:NEEDS[NearFutureExploration]
	{
		@antennaPower *= 4
		%JNSQ = True
	}
}

@PART:HAS[@MODULE[ModuleDataTransmitter*]]:LAST[JNSQ]
{
	@MODULE[ModuleDataTransmitter*]:HAS[~JNSQ[True]]
	{
		%JNSQ = False
	}
}
[LOG 13:35:41.598] [ModuleManager] WARNING: unrecognized tag: 'LAST' on: JNSQ/JNSQ_Configs/OceanStyle/@Kopernicus:LAST[JNSQ]
@Kopernicus:LAST[JNSQ]
{
	@Body,*
	{
		@Ocean
		{
			%Material
			{
				%displacement = 0.05
				%texDisplacement = -0.055
				%dispFreq = 0.045
				%tiling = 2000
				%oceanOpacity = 0.75
			}
			%Mods
			{
				%OceanFX
				{
					!Watermain{}
					Watermain
					{
						waterTex-0 = JNSQ/Terrain/PluginData/water2.dds
						waterTex-1 = JNSQ/Terrain/PluginData/water1.dds
					}
				}
			}
		}
	}
}

Has that :LAST argument been phased out of MM? All the warnings of these mods are related to this. Can it be ignored, or fixed? Thanks!

 

Share this post


Link to post
Share on other sites
Posted (edited)

Is it possible to match and update values of a specific module's curve-like node? I'd like to go over any parts containing this module

MODULE
{
	name = TestFlightReliability
	configuration = Aestus
	reliabilityCurve
	{
		key = 0 2.72727272727273E-05
		key = 3000 1.70454545454545E-05 -9.25324675324678E-10 -9.25324675324678E-10
		key = 10000 1.36363636363636E-05 0 0
	}
}

and change the curve's values for key = 0.

EDIT: I should make it clear that I want to apply a multiplier to that curve, so I need to somehow obtain the second value (2.72727272727273E-05). Is it posssible to do this?

Edited by Tonas1997

Share this post


Link to post
Share on other sites
3 hours ago, hendrack said:

I have a couple MM warnings from JNSQ, GEP and GEP_JNSQ


[LOG 13:35:41.589] [ModuleManager] WARNING: unrecognized tag: 'LAST' on: JNSQ/JNSQ_Configs/Antenna/@PART:HAS[@MODULE[ModuleDataTransmitter*]]:LAST[JNSQ]
[LOG 13:35:41.589] [ModuleManager] WARNING: unrecognized tag: 'LAST' on: JNSQ/JNSQ_Configs/Antenna/@PART:HAS[@MODULE[ModuleDataTransmitter*]]:LAST[JNSQ]

@PART:HAS[@MODULE[ModuleDataTransmitter*]]:LAST[JNSQ]
{
	@MODULE[ModuleDataTransmitter]
	{
		@antennaPower *= 4
		%JNSQ = True
	}
	@MODULE[ModuleDataTransmitterFeedeable]:NEEDS[NearFutureExploration]
	{
		@antennaPower *= 4
		%JNSQ = True
	}
}

@PART:HAS[@MODULE[ModuleDataTransmitter*]]:LAST[JNSQ]
{
	@MODULE[ModuleDataTransmitter*]:HAS[~JNSQ[True]]
	{
		%JNSQ = False
	}
}

[LOG 13:35:41.598] [ModuleManager] WARNING: unrecognized tag: 'LAST' on: JNSQ/JNSQ_Configs/OceanStyle/@Kopernicus:LAST[JNSQ]

@Kopernicus:LAST[JNSQ]
{
	@Body,*
	{
		@Ocean
		{
			%Material
			{
				%displacement = 0.05
				%texDisplacement = -0.055
				%dispFreq = 0.045
				%tiling = 2000
				%oceanOpacity = 0.75
			}
			%Mods
			{
				%OceanFX
				{
					!Watermain{}
					Watermain
					{
						waterTex-0 = JNSQ/Terrain/PluginData/water2.dds
						waterTex-1 = JNSQ/Terrain/PluginData/water1.dds
					}
				}
			}
		}
	}
}

Has that :LAST argument been phased out of MM? All the warnings of these mods are related to this. Can it be ignored, or fixed? Thanks!

 

Last does not take an argument. It is just ":LAST". I think that is simply the problem :o)

1 hour ago, Tonas1997 said:

Is it possible to match and update values of a specific module's curve-like node? I'd like to go over any parts containing this module


MODULE
{
	name = TestFlightReliability
	configuration = Aestus
	reliabilityCurve
	{
		key = 0 2.72727272727273E-05
		key = 3000 1.70454545454545E-05 -9.25324675324678E-10 -9.25324675324678E-10
		key = 10000 1.36363636363636E-05 0 0
	}
}

and change the curve's values for key = 0.

EDIT: I should make it clear that I want to apply a multiplier to that curve, so I need to somehow obtain the second value (2.72727272727273E-05). Is it posssible to do this?

Try looking at this 

 

Share this post


Link to post
Share on other sites
On 6/13/2020 at 1:17 AM, Drew Kerman said:

Can it be changed to make it more obvious it couldn't find the part it was searching for?

Would be nice I agree.  Not sure how easy it would be though at the current state of the code.

18 hours ago, hendrack said:

I have a couple MM warnings from JNSQ, GEP and GEP_JNSQ


[LOG 13:35:41.589] [ModuleManager] WARNING: unrecognized tag: 'LAST' on: JNSQ/JNSQ_Configs/Antenna/@PART:HAS[@MODULE[ModuleDataTransmitter*]]:LAST[JNSQ]
[LOG 13:35:41.589] [ModuleManager] WARNING: unrecognized tag: 'LAST' on: JNSQ/JNSQ_Configs/Antenna/@PART:HAS[@MODULE[ModuleDataTransmitter*]]:LAST[JNSQ]

 

Double check that you don't have an old version of MM sitting around.

 

Share this post


Link to post
Share on other sites

I saw it but making suggestion is a lot easier than writing the code required to implement them. Don't hold your breath because I sure will not do it.  @blowfish may have a different view on that but those feature are quite complex.

Share this post


Link to post
Share on other sites
4 minutes ago, sarbian said:

I saw it but making suggestion is a lot easier than writing the code required to implement them. Don't hold your breath because I sure will not do it.  @blowfish may have a different view on that but those feature are quite complex.

@sarbianYou can work together with blowfish to develop that feature.

Share this post


Link to post
Share on other sites
54 minutes ago, Monniasza said:

@sarbianYou can work together with blowfish to develop that feature.

You're asking them to implement a programming language, which necessitates an interpreter to run it, which itself requires a parser and lexer and other stuff besides. It's only one of the more difficult things you can do in computer science.

Share this post


Link to post
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.