Jump to content

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


sarbian

Recommended Posts

 Been trying to combine two patches into one for Dockingport Descriptions

Spoiler

//Gendered?
@PART[*]:HAS[@MODULE[ModuleDockingNode]:HAS[#gendered[true]]]:LAST[DockingPortDescriptions]
{
	@description:HAS[@MODULE[ModuleDockingNode]:HAS[#gendered[true]]:HAS[#genderFemale[false]]]] ^= :$:Male:
	@description:HAS[@MODULE[ModuleDockingNode]:HAS[#gendered[true]]:HAS[#genderFemale[true]]]] ^= :$:Female:
}

currently works when is two separate patches:


@PART[*]:HAS[@MODULE[ModuleDockingNode]:HAS[#genderFemale[false]]]:AFTER[DockingPortDescriptions]
{ @description ^= :$:Male: }

@PART[*]:HAS[@MODULE[ModuleDockingNode]:HAS[#genderFemale[true]]]:AFTER[DockingPortDescriptions]
{ @description ^= :$:Female: }

 

what am I missing?

Link to comment
Share on other sites

I'm trying to +PART a model but it's getting removed by a separate NEEDS check.  How can I overwrite the NEEDS?

Specifically, Universal Storage 2 USSolidWasteWedge NEEDS Kerbalism, which I'm not running so it gets deleted.  I'd like to +PART the wedge and use it for Snacks Soil.  What order should I run my patch in?

BEFORE won't work I assume, because MM needs US2 to load first so my patch has something to +PART

AFTER doesn't work because the part doesn't load due to a failed NEEDS check in the US2 config.

Spoiler

 

//Snacks Soil!
+PART[USSolidWasteWedge]:NEEDS[SnacksUtils,UniversalStorage2]
{
    // Base attributes
        @name = SnacksSoilWedge
        @title = Snacks Soil Tank
        @tags = Snacks
        @description = Solid waste tank for Snacks

    // Plugin control
        @MODULE[USFuelSwitch]
        {
            //name = USFuelSwitch
            //SwitchID = 0
            @resourceNames = Soil;Soil;Soil;Soil
            @resourceAmounts = 125;250;375;500
            @initialResourceAmounts = 0;0;0;0
        }
}

 

 

Edited by Friznit
Link to comment
Share on other sites

6 hours ago, Friznit said:

I'm trying to +PART a model but it's getting removed by a separate NEEDS check.  How can I overwrite the NEEDS?

Specifically, Universal Storage 2 USSolidWasteWedge NEEDS Kerbalism, which I'm not running so it gets deleted.  I'd like to +PART the wedge and use it for Snacks Soil.  What order should I run my patch in?

BEFORE won't work I assume, because MM needs US2 to load first so my patch has something to +PART

AFTER doesn't work because the part doesn't load due to a failed NEEDS check in the US2 config.

 

probably just have to make a copy of the original part.cfg and replace the :NEEDS with your own. I don't believe MM can patch :NEEDS of another patch.

Link to comment
Share on other sites

7 minutes ago, jlcarneiro said:

Does someone know how one could make a MM patch to change default parachute spread angle setting?

I mean, I think I know the syntax, problem is: what is spread angle variable name? :blush:

Ahh I read you. Does it not have the variable listed in the part? That's odd if not.

Link to comment
Share on other sites

43 minutes ago, jlcarneiro said:

Does someone know how one could make a MM patch to change default parachute spread angle setting?

I mean, I think I know the syntax, problem is: what is spread angle variable name? :blush:

 

36 minutes ago, Avera9eJoe said:

Ahh I read you. Does it not have the variable listed in the part? That's odd if not.

everything you ever wanted to know about parachutes but were to afraid to ask: :o

Spoiler

Public Attributes

Animation  Anim
 
float  animTime = 0f
 
double  areaDeployed
 
double  areaSemi
 
float  autoCutSpeed = 0.5f
 
int  automateSafeDeploy = 0
 
string  canopyName = "canopy"
 
string  capName = "cap"
 
double  chuteEmissivity = 0.2d
 
double  chuteMaxTemp = 600d
 
double  chuteTemp = 200d
 
double  chuteThermalMassPerArea = 0.06d
 
float  clampMinAirPressure = 0.01f
 
double  convectionArea
 
double  convectivekW
 
float  deployAltitude = 500f
 
float  deploymentCurve = 2.5f
 
deploymentSafeStates  deploymentSafeState = deploymentSafeStates.SAFE
 
float  deploymentSpeed = 1f
 
deploymentStates  deploymentState = deploymentStates.STOWED
 
string  deploySafe = ""
  tuning for convection More...
 
double  finalTemp
 
string  fullyDeployedAnimation = "fullyDeploy"
 
float  fullyDeployedDrag = 450
 
bool  invertCanopy = true
 
double  invThermalMass
 
Quaternion  lastRot
  Thermal. More...
 
double  machHeatDensityFadeoutMult = 1d
  tuning for cut-warning More...
 
double  machHeatMult
 
double  machHeatMultBase = 1d
 
double  machHeatMultPow = 1.5d
 
double  machHeatMultScalar = 1.75d
 
double  maxSafeSpeedAtRef
 
float  minAirPressureToOpen = 0.01f
 
string  persistentState = "STOWED"
 
double  refDensity = 1.05d
 
double  refSpeedOfSound = 320
 
float  rotationSpeedDPS = 90f
  Fastest speed at which the parachute can rotate. Rotation is generally controlled by the drag vector, so a fast speed is generally recommended. More...
 
double  safeMult = 0.95d
 
double  secondsForRisky = 0.35d
 
string  semiDeployedAnimation = "semiDeploy"
 
float  semiDeployedDrag = 1
 
float  semiDeploymentSpeed = 1f
 
bool  shieldedCanDeploy = false
 
double  shockTemp
 
float  spreadAngle = 7f
 
double  startingTemp = 200d
 
float  stowedDrag = 0.22f
 
int  symmetryCount = 0

TL;DR: more direct answer:

float  spreadAngle = 7f
Edited by zer0Kerbal
Link to comment
Share on other sites

On 3/6/2020 at 9:55 PM, zer0Kerbal said:

 Been trying to combine two patches into one for Dockingport Descriptions

  Hide contents


//Gendered?
@PART[*]:HAS[@MODULE[ModuleDockingNode]:HAS[#gendered[true]]]:LAST[DockingPortDescriptions]
{
	@description:HAS[@MODULE[ModuleDockingNode]:HAS[#gendered[true]]:HAS[#genderFemale[false]]]] ^= :$:Male:
	@description:HAS[@MODULE[ModuleDockingNode]:HAS[#gendered[true]]:HAS[#genderFemale[true]]]] ^= :$:Female:
}

currently works when is two separate patches:



@PART[*]:HAS[@MODULE[ModuleDockingNode]:HAS[#genderFemale[false]]]:AFTER[DockingPortDescriptions]
{ @description ^= :$:Male: }

@PART[*]:HAS[@MODULE[ModuleDockingNode]:HAS[#genderFemale[true]]]:AFTER[DockingPortDescriptions]
{ @description ^= :$:Female: }

 

what am I missing?

Assuming ‘description’ is a key with a string value in it I highly doubt MM is going to find any keys or MODULES in there. ;)  

I’d stick with the split patch thing unless there’s a specific reason you’re trying to merge them?

Edited by Jognt
Even my typos sound like they have a cold.
Link to comment
Share on other sites

57 minutes ago, Jognt said:

Assuming ‘description’ is a key with a string value in it I highly doubt MM is going to find any keys or MODULES in there. ;)  

I’d stick with the split patch thing unless there’s a specific reason you’re trying to merge them?

# excellent point - and why? because.

Link to comment
Share on other sites

8 hours ago, Avera9eJoe said:

Ahh I read you. Does it not have the variable listed in the part? That's odd if not.

Thanks, but I looked for it in Squad part files (MK16, MK16-XL, etc.) but didn't find anything like it... :(

8 hours ago, zer0Kerbal said:

 

everything you ever wanted to know about parachutes but were to afraid to ask: :o

  Reveal hidden contents

Public Attributes

Animation  Anim
 
float  animTime = 0f
 
double  areaDeployed
 
double  areaSemi
 
float  autoCutSpeed = 0.5f
 
int  automateSafeDeploy = 0
 
string  canopyName = "canopy"
 
string  capName = "cap"
 
double  chuteEmissivity = 0.2d
 
double  chuteMaxTemp = 600d
 
double  chuteTemp = 200d
 
double  chuteThermalMassPerArea = 0.06d
 
float  clampMinAirPressure = 0.01f
 
double  convectionArea
 
double  convectivekW
 
float  deployAltitude = 500f
 
float  deploymentCurve = 2.5f
 
deploymentSafeStates  deploymentSafeState = deploymentSafeStates.SAFE
 
float  deploymentSpeed = 1f
 
deploymentStates  deploymentState = deploymentStates.STOWED
 
string  deploySafe = ""
  tuning for convection More...
 
double  finalTemp
 
string  fullyDeployedAnimation = "fullyDeploy"
 
float  fullyDeployedDrag = 450
 
bool  invertCanopy = true
 
double  invThermalMass
 
Quaternion  lastRot
  Thermal. More...
 
double  machHeatDensityFadeoutMult = 1d
  tuning for cut-warning More...
 
double  machHeatMult
 
double  machHeatMultBase = 1d
 
double  machHeatMultPow = 1.5d
 
double  machHeatMultScalar = 1.75d
 
double  maxSafeSpeedAtRef
 
float  minAirPressureToOpen = 0.01f
 
string  persistentState = "STOWED"
 
double  refDensity = 1.05d
 
double  refSpeedOfSound = 320
 
float  rotationSpeedDPS = 90f
  Fastest speed at which the parachute can rotate. Rotation is generally controlled by the drag vector, so a fast speed is generally recommended. More...
 
double  safeMult = 0.95d
 
double  secondsForRisky = 0.35d
 
string  semiDeployedAnimation = "semiDeploy"
 
float  semiDeployedDrag = 1
 
float  semiDeploymentSpeed = 1f
 
bool  shieldedCanDeploy = false
 
double  shockTemp
 
float  spreadAngle = 7f
 
double  startingTemp = 200d
 
float  stowedDrag = 0.22f
 
int  symmetryCount = 0

TL;DR: more direct answer:

float  spreadAngle = 7f

Thanks, man! Unfortunately, I tried it but it didn't work...

@PART[*]:HAS[@MODULE[ModuleParachute]]:FINAL
{
	@MODULE[ModuleParachute]
	{
		@minAirPressureToOpen = 0.5		// this one worked :)
		@spreadAngle = 10			// this one didn't... :(
	}
}

Any ideas?

Link to comment
Share on other sites

29 minutes ago, jlcarneiro said:

Thanks, but I looked for it in Squad part files (MK16, MK16-XL, etc.) but didn't find anything like it... :(

Thanks, man! Unfortunately, I tried it but it didn't work...


@PART[*]:HAS[@MODULE[ModuleParachute]]:FINAL
{
	@MODULE[ModuleParachute]
	{
		@minAirPressureToOpen = 0.5		// this one worked :)
		@spreadAngle = 10			// this one didn't... :(
	}
}

Any ideas?

isn't it normally limited - ie only certain values - try a number in that, or was that in the normal?

Link to comment
Share on other sites

2 minutes ago, jlcarneiro said:

Sorry, didn't get what you just said... Can you elaborate?

if you go into the game - and right click on a parachute - it will only let you put in a range of numbers - from x to z; I don't recall what those are. 10 might be out of range (outside of the possible numbers it will accept)

Link to comment
Share on other sites

If the original parachute config doesn't contain the key spreadAngle then you will need %spreadAngle = 10 ( or just spreadAngle = 10).  @ will only edit it if it's there.  ModuleManager has no knowledge of the default values (those come into play later when KSP parses things out of the configs, but MM only operates on the configs themselves)

Link to comment
Share on other sites

15 hours ago, zer0Kerbal said:

if you go into the game - and right click on a parachute - it will only let you put in a range of numbers - from x to z; I don't recall what those are. 10 might be out of range (outside of the possible numbers it will accept)

Oh! Now I get it! But, no, unfortunately 10 IS a possible number, the largest one, in fact.

What about that "f" you mentioned in your answer? Is it necessary?

Quote

TL;DR: more direct answer:

float  spreadAngle = 7f

 

Link to comment
Share on other sites

2 hours ago, DStaal said:

That was from the C# code describing the defaults.  It's necessary in C#, but not in Module Manager.

(TLD: Just ignore it, it's a C# thing.)

Thanks! I suspected something like that (just thought "f" would be because of the float type).

So, we're back on square 1, right? Basically we know what has to be changed, but we don't know what is its public name... :(

Edited by jlcarneiro
Link to comment
Share on other sites

19 hours ago, zer0Kerbal said:

@PART[*]:HAS[@MODULE[ModuleParachute]]:FINAL
{
	@MODULE[ModuleParachute]
	{
		@minAirPressureToOpen = 0.5 // this one worked :)
		%spreadAngle = 10 // this one didn't... :( 
	}
}

 

 

18 hours ago, blowfish said:

If the original parachute config doesn't contain the key spreadAngle then you will need %spreadAngle = 10 ( or just spreadAngle = 10).  @ will only edit it if it's there.  ModuleManager has no knowledge of the default values (those come into play later when KSP parses things out of the configs, but MM only operates on the configs themselves)

did you see this? (I updated the patch to reflect this)

 

and oops - yes, f means 'float' and don't include that. :D

Link to comment
Share on other sites

just checked - that patch worked perfectly. KSP 1.9.1 (both dlc's) and pretty much nothing else.

Advanced Tweakables checked on in order to see.

image.png

if you don't have advanced tweakables on, it still be set - just won't show.

thank you to @blowfish for seeing the obvious. :D

Edited by zer0Kerbal
Link to comment
Share on other sites

1 hour ago, zer0Kerbal said:

just checked - that patch worked perfectly. KSP 1.9.1 (both dlc's) and pretty much nothing else.

Advanced Tweakables checked on in order to see.

image.png

if you don't have advanced tweakables on, it still be set - just won't show.

thank you to @blowfish for seeing the obvious. :D

It worked flawlessly! Thank you all! 

Link to comment
Share on other sites

2 hours ago, jlcarneiro said:

Thanks! I suspected something like that (just thought "f" would be because of the float type).

So, we're back on square 1, right? Basically we know what has to be changed, but we don't know what is its public name... :(

Just to elaborate on MM syntax:

“@spreadAngle” will alter it if it is present in the CFG. If not present, it does nothing. 
“spreadAngle” will blindly add it to the bottom of the part or module in question, even if it was already there. 
“%spreadAngle” will alter it if present, and add it if it is not. 

Happy tweaking! :) 

Edited by Jognt
Link to comment
Share on other sites

2 hours ago, Jognt said:

Just to elaborate on MM syntax:

“@spreadAngle” will alter it if it is present in the CFG. If not present, it does nothing. 
“spreadAngle” will blindly add it to the bottom of the part or module in question, even if it was already there. 
“%spreadAngle” will alter it if present, and add it if it is not. 

Happy tweaking! :) 

yep - and don't forget & - will only add if it isn't already present

Link to comment
Share on other sites

Hi folks,

short question: will the following lines disable (not remove, just disable) the RCS thrusters for command pods (Mk3-1 and possibly mod pods)?

 

// Disable RCS thrusters for new pods/cockpits
// 
@PART[*]:HAS[@MODULE[ModuleCommand],@MODULE[ModuleRCSFX]]:Final
{
    @MODULE[ModuleRCSFX]
    {
        %moduleIsEnabled = false
    }
}
 

Are both conditions - ModuleCommand and Module RCSFX - AND or OR? Or is there a syntax error maybe?

Thanks in advance :) 

Edited by VoidSquid
Link to comment
Share on other sites

3 hours ago, VoidSquid said:

Hi folks,

short question: will the following lines disable (not remove, just disable) the RCS thrusters for command pods (Mk3-1 and possibly mod pods)?

 

// Disable RCS thrusters for new pods/cockpits
// 
@PART[*]:HAS[@MODULE[ModuleCommand],@MODULE[ModuleRCSFX]]:Final
{
    @MODULE[ModuleRCSFX]
    {
        %moduleIsEnabled = false
    }
}
 

Are both conditions - ModuleCommand and Module RCSFX - AND or OR? Or is there a syntax error maybe?

Thanks in advance :) 

short answer: maybe.

IIRC the moduleIsEnabled is inherited into all MODULES and for some modules it works, and for some it doesn't. No, I don't believe there is a list of which it works for (part of the gloriously well documented api. :o:P )

however there might be an analog:

Spoiler

Public Attributes

bool  isEnabled = true
 
bool  moduleIsEnabled = true
 
string  moduleName
 
bool  overrideStagingIconIfBlank = true
 
ModuleResourceHandler  resHandler = new ModuleResourceHandler()
 
bool  showUpgradesInModuleInfo = false
 
ProtoPartModuleSnapshot  snapshot
 
string  stagingDisableText = ""
 
bool  stagingEnabled = true
 
string  stagingEnableText = ""
 
bool  stagingToggleEnabledEditor = false
 
bool  stagingToggleEnabledFlight = false
 
List< ConfigNode upgrades
 
List< string >  upgradesApplied = new List<string>()
 
bool  upgradesApply = true
 
bool  upgradesAsk = true

isEnabled might also work.

 

I suggest making two parts (just copy entire .cfg and change the name/title/description) and add the line directly to the RCS(FX) modules and launch a test install to see if they do or do not work. Then if they work, try the patch. Yes, takes longer, but eliminates critical points of possible failure.

Link to comment
Share on other sites

9 minutes ago, zer0Kerbal said:

short answer: maybe.

I was afraid of such an answer. (Actually, I'd have given the same answer if I'd knew a bit more about this stuff). :P 

I was puzzled when I tried to look it up: what might be the difference between IsEnabled and  moduleIsEnabled ? Still don't know this. Guess it's try and error :D 

One question remains though: 

4 hours ago, VoidSquid said:

Are both conditions - ModuleCommand and Module RCSFX - AND or OR?

 

Link to comment
Share on other sites

  • 2 weeks later...
I am attempting to write a node with a generated name.
@CONTRACT_TYPE:HAS[#cooldown]:FOR[zGenericValueContracts] {
    DATA {
        type = int
        waitDays = 0
        expectedDays = #$../cooldown$
        doublingPeriods = 3
    }
    DATA {
        type = float
        fullTime = @waitDays + @expectedDays
        elapsedDays = Round((UniversalTime() - COOLDOWN_ITERATOR) / 86400.0)
        amountRecovered = (COOLDOWN_ITERATOR + 0) == 0 ? 1 : (@elapsedDays - @waitDays) / @expectedDays
        cooldownMultiplier = Log(Max(@amountRecovered, 1), @doublingPeriods) + Max(Min(@amountRecovered, 1), 0)
        cooldownMultiplierPercent = Round(@cooldownMultiplier * 100, 1)
    }
    BEHAVIOUR {
        name = SoftCooldownLogCompletionTime
        type = Expression

        CONTRACT_COMPLETED_SUCCESS {
            COOLDOWN_ITERATOR = UniversalTime()
        }
    }
    @description ^= :$:<br><br><b>This contract has reduced value after recent completion. Value will return to 100% after @fullTime days from the last completion. Value will slowly continue to rise after 100%. Current value is @cooldownMultiplierPercent% of the nominal amount.:
}
Everything that is COOLDOWN_ITERATOR needs to be a unique value per CONTRACT_TYPE. What I hoped to do was to do another pass regex find-&-replacing all COOLDOWN_ITERATOR with #$../name$ concatenated with some string like "_iterator". But I've got no clue how to do that, particularly because of this line:
        CONTRACT_COMPLETED_SUCCESS {
            COOLDOWN_ITERATOR = UniversalTime()
        }
Where I would need to change the node name, not just the value of the node. Does anybody have any ideas about to whom I could talk about this?
Edited by nepphhh
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...