Jump to content

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


sarbian

Recommended Posts

If I want to remove a key from all the modules in a part, can I do it with this?


@PART[partname]
{
@MODULE
[*]
{
!key = DEL
}
}

I don't know why, but I had to do this in order to make it work


@PART[partname]
{
@MODULE:HAS[#key
[*]]
{
!key = DEL
}
}

Edited by Sigma88
Link to comment
Share on other sites

Are changes not immediate?

I did this test:

tempFX1 = #$/MODULE[ModuleEnginesFX]/maxThrust$
@MODULE[ModuleEnginesFX]
{
@maxThrust = 250
}
tempFX2 = #$/MODULE[ModuleEnginesFX]/maxThrust$

maxThrust is 90 in the orginal CFG file.

The MM cache file shows these values after loading:

tempFX1 = 90
tempFX2 = 90
MODULE
{
...
maxThrust = 250

So the change is taking place but the before and after vars are the original.

Link to comment
Share on other sites

The directive are not processed in the order you write them in the script. loaded config node are composed of a list of values and a list of sub node. MM process the value first and then the subnodes.

So the actual processing order of your test would be :


tempFX1 = #$/MODULE[ModuleEnginesFX]/maxThrust$
tempFX2 = #$/MODULE[ModuleEnginesFX]/maxThrust$
@MODULE[ModuleEnginesFX]
{
@maxThrust = 250
}

Link to comment
Share on other sites

The directive are not processed in the order you write them in the script. loaded config node are composed of a list of values and a list of sub node. MM process the value first and then the subnodes.

So the actual processing order of your test would be :


tempFX1 = #$/MODULE[ModuleEnginesFX]/maxThrust$
tempFX2 = #$/MODULE[ModuleEnginesFX]/maxThrust$
@MODULE[ModuleEnginesFX]
{
@maxThrust = 250
}

really??? oh $....

I need to go back and re-check everything then...

does it work the same for sub-subnodes?


@Part
{
@MODULE
{
@key
@SUBMODULE
{
@key
}
@key
}
}

Link to comment
Share on other sites

is module manager case sensitive?

If I do something like this:

@MODULE:HAS[#key[true]]

{

}

but the module has "key = True", would that change?

should I use

:HAS[#key[?rue]]

?

edit

yeah fixed it.

Edit2

is there any way to make a patch not case sensitive?

I'm having an issue making a mod to patch other mods, and each modder use different upcase and LOWERCASE ( ;) ) WoRds

it's a NIghTMaRe

Edited by Sigma88
Link to comment
Share on other sites

So let's say I want to fix all the old part/mod bottom nodes that have +1 in their 5th position.

What do I do to match, and then change, @node_stack_bottom's 5th item? Just :HAS[#node_stack_bottom,5[1]] and @node_stack_bottom,5 = -1?

Link to comment
Share on other sites

So let's say I want to fix all the old part/mod bottom nodes that have +1 in their 5th position.

What do I do to match, and then change, @node_stack_bottom's 5th item? Just :HAS[#node_stack_bottom,5[1]] and @node_stack_bottom,5 = -1?

the fifth would be node_stack_bottom,4 (the first being node_stack_bottom,0)

other than that, idk if it will work in the :HAS[]

Link to comment
Share on other sites

One more question. I'm trying to fix old Goodspeed parts, and I do this:

@PART[goodspeedRocketPartsTank,goodspeedGoldFuelBall,goodspeedGoldXenonBall] { @MODEL,* { @texture,* ^= :crewCabin:hitchhikerStorageContainer: } }  // Goodspeed Rocket Parts Container, FB-G Fuel Tank, XB-G Xenon Tank
@PART[goodspeedPartsWarehouse] { @MODEL,* { @texture,* ^= :Utility/roverBody:Command/probeRoverBody: } } // Goodspeed Rocket Parts Warehouse
@PART[goodspeedHexFrame*,goodspeedHexSideMount1] { @MODEL,* { @texture,* ^= :strutCube:strutCubicOcto: } } // Goodspeed TR6.1 Structural Frame, TR6.3 Structural Frame, TR-S Side Mount
@PART[goodspeedStashBox] { @MODEL,* { @texture,* ^= :mk2LanderCabin:mk2LanderCan: } } // Goodspeed Experiment Storage Device
@PART[goodspeedOrangeFuelBall] { @MODEL,* { @texture,* ^= :fuelTank3-2:fuelTankJumbo-64: } } // Goodspeed FB-O Fuel Tank, FP-O Fuel Tank
@PART[goodspeedRoundFuelCap] { @MODEL,* { @texture,* ^= :fuelTank_long:fuelTankT800: } } // Goodspeed Rounded Fuel Cap
@PART[goodspeedNuclearReactor*] { @MODEL,* { @texture,* ^= :nuclearEngine:liquidEngineLV-N: } } // Goodspeed UNSFE-100 Nuclear Reactor, UNSFE-200 Nuclear Reactor, UNSFE-400 Nuclear Reactor
@PART[goodspeed_zap01] { @MODEL,* { @texture,* ^= :ksp_r_largeBatteryPack:z-400Battery: } } // Goodspeed ZAP-01 Radioisotope Thermoelectric Generator
@PART[goodspeedSideNose1250] { @MODEL,* { @texture,* ^= :solidBooster1-1:solidBoosterBACC: } } // Goodspeed SM-1250 Rocket Cap
@PART[goodspeedSideMount1250] { @MODEL,* { @texture,* ^= :StackDecoupler:decouplerStackTR-18A: } } // Goodspeed SMD-250 Side Mount & Decoupler

and it doesn't work; in ModuleManager.ConfigCache I see:

        MODEL        {
[B] texture = :StackDecoupler:decouplerStackTR-18A:[/B]
texture = model001, Squad/Parts/Utility/StackDecoupler/model001

I also do this:

@PART[goodspeedMonoStack3750] { @MODEL,* { @model ^= :RCSTank1-2:RCSFuelTankR1: } }  // Goodspeed FL-R5 RCS Fuel Tank

@PART[goodspeedSweptPylon400] { // Goodspeed SW-400 Pylon & Decoupler
@MODEL,0 {
@texture,0 ^= :Aero/advancedCanard:Structural/strutCubicOcto:
@texture,1 ^= :Aero/advancedCanard:Structural/strutCubicOcto:
} // MODEL
} // PART

and this works fine (both ways).

What gives?..

- - - Updated - - -

the fifth would be node_stack_bottom,4 (the first being node_stack_bottom,0)
Yeah, forgot that, 10x. But... Using
@node_stack_bottom,4 = -1

just breaks the nodes, giving

node_stack_bottom = -1

:-( So there must be some other method of accessing that.

Edited by cipherpunks
Link to comment
Share on other sites

So, here's what I came with:

@PART[goodspeed*]:HAS[#node_stack_bottom
[*]]:NEEDS[Goodspeed]:FIRST { // Goodspeed parts have old-style, "wrong" bottom nodes; some are overrided later, hence :FIRST
@node_stack_bottom = #$node_stack_bottom[0]$, $node_stack_bottom[1]$, $node_stack_bottom[2]$, $node_stack_bottom[3]$, -1, $node_stack_bottom[5]$, $node_stack_bottom[6]$
} // PART

Still need to solve @MODEL,* { @texture,* ^= problem. Sarbian?...

And can You please add ; as statement separator, so I could neatly @oneline { @var1 = val1; @var2 = somethingelse } ? Screen real estate is precious.

Edited by cipherpunks
Link to comment
Share on other sites

I ll have a look at the regex but I m pretty sure someone already wrote a similar patch that worked.

The file are parsed by KSP, so no ";". And even if it was not I would not. One line code is the root of all evil.

Link to comment
Share on other sites

All of the releases are here: https://github.com/sarbian/ModuleManager/releases

It's linked right on the first page.

Can you have a HAS[@MODULE[!XYZ] applied right after a module?

Basically I'm trying to apply a module, but only if it isn't on there. If the module is on, or added, delete another module..


@PART[*]:NEEDS[CrossFeedEnabler]:HAS[@MODULE[InterstellarFuelSwitch]]:FOR[zCustom]:Final
{
MODULE[ModuleCrossFeed]:HAS[!MODULE[ModuleCrossFeed]]
{
name = ModuleCrossFeed
crossFeedOverride = False
}
!MODULE[ModuleFuelCrossfeedActions]:HAS[MODULE[ModuleCrossFeed]]{}
}

Link to comment
Share on other sites

Why it is? Can You elaborate? cause I've been using one-liners for so many years with great success, in various OS's and lang's....

Readability enhances maintainability. Cryptiuc and dense one liners are part of the things that made perl known as a "write only" language.

Link to comment
Share on other sites

Nori, those are just tags. They only have the source.

pack_rtr, you want the build server. On the left, Build History. https://ksp.sarbian.com/jenkins/job/ModuleManager/

Nori: HAS means "does this node have this thing" so no.

Consider two things:

@MODULE[foo] is just shorthand for @MODULE:HAS[#name[foo]]

@MODULE[foo]:HAS[@MODULE[bar] means to find the MODULE with name == 'foo' that has a node inside it named MODULE which has a value inside that called 'name = bar'.

I don't think that's what you want to be doing.

Also, you can't have multiple pass specifiers (well, you can, but only the first one will be used). That is to say, :FOR[foo]:FINAL is exactly the same as just :FOR[foo] because the FOR pass for mod 'foo' comes before the FINAL pass.

Just like FOR[foo]:AFTER[bar] will run on the AFTER pass for mod bar, not on the FOR pass for mod foo.

Edited by NathanKell
Link to comment
Share on other sites

That does not make them a good idea.
This argument seems purely subjective to me. Don't get me wrong, but please elaborate or retract. Cause if one-liners are bad, then bigger half of I.T. world is doing bad thing many times per day (for example using shell, chaining commands with pipes in shell etc), and it is our duty to warn them, right?

- - - Updated - - -

Readability enhances maintainability. Cryptiuc and dense one liners are part of the things that made perl known as a "write only" language.
Excuse me, but (increasing line count) != (readability will increase linearly). Quite often it's quite the contrary (as screen space is limited and you need to scroll when the code is really sparse, so you can't read entire section in one glimpse, and risk distraction.

Besides, AFAIK Perl haters hate Perl because of regexps, which are dense; but You do not advocate removing regex support from MM, do You?

Edited by cipherpunks
Link to comment
Share on other sites

Nori, those are just tags. They only have the source.

pack_rtr, you want the build server. On the left, Build History. https://ksp.sarbian.com/jenkins/job/ModuleManager/

Nori: HAS means "does this node have this thing" so no.

Consider two things:

@MODULE[foo] is just shorthand for @MODULE:HAS[#name[foo]]

@MODULE[foo]:HAS[@MODULE[bar] means to find the MODULE with name == 'foo' that has a node inside it named MODULE which has a value inside that called 'name = bar'.

I don't think that's what you want to be doing.

Also, you can't have multiple pass specifiers (well, you can, but only the first one will be used). That is to say, :FOR[foo]:FINAL is exactly the same as just :FOR[foo] because the FOR pass for mod 'foo' comes before the FINAL pass.

Just like FOR[foo]:AFTER[bar] will run on the AFTER pass for mod bar, not on the FOR pass for mod foo.

Which is the newest build for 0.90?

Link to comment
Share on other sites

Whoops. Sorry about that. I'm so used to downloading mods from github that I just assumed it included the DLL.

@pack_rtr - I think this is what you want: https://ksp.sarbian.com/jenkins/job/ModuleManager/83/artifact/ModuleManager.2.6.0.dll

That is the last build before KSP 1.0 was released.

Thanks NathanKell. I was wondering about FOR and Final as the Final didn't seem to be final.. :) Hm, I thought that I have seen AFTER + FOR in some mods but maybe I'm wrong? Probably was a NEEDS + FOR.

Considering this is for my own tweaks, is it best to use a FOR[zCustom] like I am, or should I just put :Final on my changes? I am sometimes overwriting MM changes made by other mods, was hoping FOR[zCustom] would apply after most mods as I figured FOR was done alphabetically, but maybe I'm wrong.

Ok, so basically I'm just going to have to do this:


@PART[*]:NEEDS[CrossFeedEnabler]:HAS[@MODULE[InterstellarFuelSwitch],@MODULE[ModuleCrossFeed]]:FOR[zCustom]
{
!MODULE[ModuleFuelCrossfeedActions]{}
}

@PART[*]:NEEDS[CrossFeedEnabler]:HAS[@MODULE[InterstellarFuelSwitch],!MODULE[ModuleCrossFeed]]:FOR[zCustom]
{
MODULE[ModuleCrossFeed]
{
name = ModuleCrossFeed
crossFeedOverride = False
}
!MODULE[ModuleFuelCrossfeedActions]{}
}

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