Jump to content

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


sarbian

Recommended Posts

Actually Sarbian, what MeCripp suggested works for some reason. I tried both with @ and without it, and it didn't. But what he suggested works, no idea why.

What he suggested contains a conditional check for the absence of techRequired and applies a 'techRequired = (whatever)' if it was absent. If that works for you but doing techRequired without the @ didn't work for you before, then you were doing something wrong before.

Link to comment
Share on other sites

And here is 2.0.8.

You can now clone and delete root node (parts) like this :

<snip>

Excellent addition :) I'd already been thinking I might need to add tweaked copies of parts to handle the command pods for my SurfaceNodes mod, so this'll be just the ticket for that.
Link to comment
Share on other sites

Actually Sarbian, what MeCripp suggested works for some reason. I tried both with @ and without it, and it didn't. But what he suggested works, no idea why.

What was suggested was very subtle. The problem is the different type of brackets... you had:

(
@TechRequired = advElectrics
}

That is, opening bracket is a plain parenthesis while the closing one is a curly bracket. Depending on your font the difference could be very subtle in the forum posting.

MeCripp's second suggestion corrected it to:

{
@TechRequired = advElectrics
}

I would suspect the different brackets would cause a problem.

Edited by tecknobabble
Link to comment
Share on other sites

What was suggested was very subtle. The problem is the different type of brackets... you had:

(
@TechRequired = advElectrics
}

That is, opening bracket is a plain parenthesis while the closing one is a curly bracket. Depending on your font the difference could be very subtle in the forum posting.

MeCripp's second suggestion corrected it to:

{
@TechRequired = advElectrics
}

I would suspect the different brackets would cause a problem.

Good catch. I'm sitting here right now staring at them and I still see a bracket :(

Now I know I am getting old. I need reading glasses ;.;

Link to comment
Share on other sites

So I've done my own enhancements to module manager.

Download Here

They seem to work pretty nice! I'd really appreciate ppl testing it out on their various MM files prior to me pushing it back to the MM repo.

Features:

Order Preserving

@ now preserves the original order, both for nodes and for values.

Use of NEEDS


PART:NEEDS[RealFuels] {
name = dummyPartIgnore
module = Part

DOG {
name = First
key1:NEEDS[ProceduralParts|StretchySRB] = Original Value
key2:NEEDS[!RealFuels] = Some other value
}
}

In the above, the part will only be defined if you have RealFuels loaded. You can do this on keys, values, patches, anywhere.

key1 will be defined if (ProceduralParts OR StretchySRB are loaded) and RealFuels is NOT loaded. You can still use , and it is treated like &. Not has highest precedence, then or, then and.

Define an insertion point for any nodes or values


@PART[dummyPartIgnore]
{
DOG {
name = AddLast
string = Will insert at the end
}

DOG,0 {
name = AddFirst
string = Will insert at the beginning
}

@DOG,0 { // Edits node zero as before, but ends up editing the above node
string,0 = Insert before the string already at the beginning
}
}

The index after the comma is where it will be inserted, this is relative to other nodes or values with the same name.

Regexp replaces


@PART[dummyPartIgnore]
{
@DOG[First]
{
@string ^= :^.*$:First dog edit $& in place
}
}

Breaking this down, the first character defines the separator, the section between the first : and the second : is the match string, and the section following the second : is the replacement.

For details on how to use regexp see the documentation here

Link to comment
Share on other sites

Nice addition :)

The NEEDS can be used on subnode too ?

Can be used anywhere - subnodes, values, deep in your tree... Anywhere

What I've done is to move the needs processing out to a separate pass, and anything that doesn't have needs satisfied gets deleted.

Need to do a bit of debug logging however, just figuring out the best way to do it.

Link to comment
Share on other sites

I think the answer is no, but can Module Manager add modules to parts on existing vessels (those saved in the persistence file)? I'm adding a new module to docking ports and would love to make it 'backwards compatible' with existing vessels.

Link to comment
Share on other sites

Yes. However, be careful, since (as things currently are) changing the module order of a part (so the order of modules in the prefab object that KSP creates at startup doesn't match the order of MODULE nodes in the .craft or .sfs file) will break data-loading from *all* that part's modules.

Link to comment
Share on other sites

I think the answer is no, but can Module Manager add modules to parts on existing vessels (those saved in the persistence file)? I'm adding a new module to docking ports and would love to make it 'backwards compatible' with existing vessels.

It will, because if an active vessel has a part that is missing a module that the part's cfg says it has, then the active part will get that module.

Sometimes that's good. the module will work just fine out of the box.

sometimes it's bad because the module wont initialize properly. the vessel works ok and the part works ok except functionality of the module in question is impaired.

And in some cases it's VERY bad because some of the modules depended on loading in a certain order and the vessel wont load properly. Bad things might happen to it when it comes off rails.

I dont think it's really a MM issue either because it doesnt matter how the module got on the part. and the third possibility can happen if the PartModule code was modified such that existing vessels might do bad things. IonCross life support had a really bad save breaking update once and there was just no mitigating it.

Link to comment
Share on other sites

That would explain quite a lot. Thanks for the rapid replies.

So, what causes the re-order? It's clearly not happening every time, else all saves would be broken..

Would adding the new module to the end of the modules list avoid this issue?

Link to comment
Share on other sites

Yes you can add the module at the end of the list and that will be OK

However, if you then go and change that patch so that module is no longer added, and there's some modules added at the end of the list, then loading will break.

It's not very good design on behalf of squad.

Don't worry however - I am thinking of how to fix this problem, and my plan is to make some work around so all can use it.

Link to comment
Share on other sites

Here is the official release of Swamp_ig patch

DLL : ModuleManager.2.0.10.dll

Zip : ModuleManager-2.0.10.zip

Details of the changes

MM will now complain if you use a version older than this one. It's to avoid a bug with the election process with version 2.0.x that made it possible for two or more MM to run at the same time.

Edited by sarbian
Link to comment
Share on other sites

With 2.1.0 I get a NRE right after MM has identified all loaded DLLs:


[LOG 02:51:28.825] [ModuleManager] compiling list of loaded mods...
Mod DLLs found:
Assembly-CSharp v1.0.0.0
ModuleManager v2.1.0.0
aaa_Toolbar v1.0.0.0
ActionGroupManager v0.0.0.0
<...snip...>
Non-DLL mods added:
[LOG 02:51:28.973] [ModuleManager] Exception while checking needs : LLL-Extra/Parts/fuelLowerstage/part/fuelLowerstage
System.NullReferenceException: Object reference not set to an instance of an object
at ConfigNode.CopyToRecursive (.ConfigNode node) [0x00000] in <filename unknown>:0
at ConfigNode.CopyToRecursive (.ConfigNode node) [0x00000] in <filename unknown>:0
at ConfigNode.CopyTo (.ConfigNode node) [0x00000] in <filename unknown>:0
at ModuleManager.ConfigManager.CheckNeeds (.ConfigNode subMod) [0x00000] in <filename unknown>:0
at ModuleManager.ConfigManager.CheckNeeds (System.Collections.Generic.List`1 excludePaths) [0x00000] in <filename unknown>:0
[LOG 02:51:29.075] [ModuleManager] :FIRST (default) pass

The part is the "Cellular fuel tank" from LLL_Full's extra pack.

The cause seems to be in this section:


PART
{
name = fuelLowerstage
module = Part
author = Lack

//MODEL
{
model = Squad/Parts/Structural/structuralIBeam3/model
position = 0,0.00,-0
scale = 1,0.8,1
rotation = 0,0,0
}
MODEL
<...snip...>

As you can see, Lack has "disabled" one MODEL section by commenting out the header, so I assume MM can't handle a body without a header any more.

Is this considered a bug or "WONTFIX, tell Lack to fix his damn parts"? :D

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