Jump to content

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


sarbian

Recommended Posts

Is there any way to make a custom configuration for my mod that ModuleManager can modify? I have some non-part-related GUI elements that I'd like to be as easily extensible as possible.

Just write a text file with the .cfg extension and use a unique node type for your settings. eg.

[COLOR=#008000]// inside GameData/test/testSettings.cfg[/COLOR]
TestSettingsNode
{
setting_test_a = A Value
}

Module manager doesn't care what node type it's patching. PART just happens to be the most commonly used

You can retrieve the module manager patched node using

ConfigNode node = GameDatabase.Instance.GetConfigNodes("TestSettingsNode").FirstOrDefault();
Debug.log(node.GetValue("settings_test_a"));[COLOR=#008000] // prints "A Value" to the log[/COLOR]
[COLOR=#008000]// note: there is also a GameDatabase.Instance.GetConfigNode method that uses a GameData relative path to fetch the node. I can just never remember the path to use[/COLOR]

Edited by Crzyrndm
Link to comment
Share on other sites

You can retrieve the module manager patched node using

ConfigNode node = GameDatabase.Instance.GetConfigNodes("TestSettingsNode").FirstOrDefault();
Debug.log(node.GetValue("settings_test_a"));[COLOR=#008000] // prints "A Value" to the log[/COLOR]
[COLOR=#008000]// note: there is also a GameDatabase.Instance.GetConfigNode method that uses a GameData relative path to fetch the node. I can just never remember the path to use[/COLOR]

You're the best! I knew that I could name the nodes whatever, but I didn't know how to get the patched version of it from Module Manager. Thank you so much! :D

Link to comment
Share on other sites


@[COLOR=#ff0000]NODE[/COLOR]:HAS[#ElectricCharge[<200]]
{
@ElectricCharge = 200
}

should be like that

(replace the red bit with what you need)

link

Thanks for the reply. That doesn't seem to work since it is checking against a resource. Would have to reference amount or maxamount somehow.

Link to comment
Share on other sites

Thanks for the reply. That doesn't seem to work since it is checking against a resource. Would have to reference amount or maxamount somehow.

pardon, my fault

let's see if I can write something that works


@PART:HAS[@RESOURCE[ElectricCharge]:HAS[#maxAmount[<200]]
{
@RESOURCE[ElectricCharge]
{
@amount = 200 // or whatever you need
@maxAmount = 200
}
}

I think this *should* work

Edited by Sigma88
Link to comment
Share on other sites

pardon, my fault

let's see if I can write something that works


@PART:HAS[@RESOURCE[ElectricCharge]:HAS[#maxAmount[<200]]
{
@RESOURCE[ElectricCharge]
{
@amount = 200 // or whatever you need
@maxAmount = 200
}
}

I think this *should* work

Ok I think I got it. Thanks for your help! I learned today that you can nest HAS commands, which is crazy.


@PART[*]:HAS[@MODULE[ModuleCommand]:HAS[#minimumCrew[0]],@RESOURCE[ElectricCharge]:HAS[#maxAmount[<200]]]
{
@RESOURCE[ElectricCharge]
{
@amount = 200
@maxAmount = 200
}
}

Link to comment
Share on other sites

the operator @ will set the value of a key only if that key is already in the module, is there an operator to set the value of a key only if it's missing?

If interpreting your question literally, the answer would be no ... you don't really say what the operator would do if the key is present. (NOT set it...?)

There is % which sets it if it's present and adds it with the assigned value if it's absent.

example:

%skinMaxTemp = 1523.15

Regardless of whether skinMaxTemp is absent or present, the above line will result in the part having skinMaxTemp with value of 1523.15

Link to comment
Share on other sites

If interpreting your question literally, the answer would be no ... you don't really say what the operator would do if the key is present. (NOT set it...?)

There is % which sets it if it's present and adds it with the assigned value if it's absent.

example:

%skinMaxTemp = 1523.15

Regardless of whether skinMaxTemp is absent or present, the above line will result in the part having skinMaxTemp with value of 1523.15

no, I really need what I asked :D

I can make it work anyways, but having that operator would make everything much easier

Link to comment
Share on other sites

Is there a way to duplicate an attachment/Stack node? This is what i was going for. Create a duplicate top stack node for all engines that don't have one. Also can I parse the list of coordinates with MM so that i could change a single variable in the list? Thanks


@PART
[*]:HAS[~node_stack_top2[],@MODULE[ModuleEngines*]]:FOR[ZZZZ]
{
%node_stack_top2 = #$node_stack_top$
}

Link to comment
Share on other sites

I wanted to have my MM tweak applied after a couple of other optionally present mods; if they are absent apply it anytime but if either or both of the others are present do it after them. Will this get the right effect:

+PART[FuelCell]:AFTER[TACLifeSupport&USILifeSupport] { ...

MODULE:NEEDS[TACLifeSupport] {...}

MODULE:NEEDS[uSILifeSupport] {...} ...

}

I searched around a little but it wasn't clear to me that AFTER would 'run' when the specified thing was absent.

Link to comment
Share on other sites

Pass specifiers don't work like that.

A pass specifier does only one thing: it says, when the pass is (this), run this patch.

Valid options are:

:FIRST

(nothing) -- runs on LEGACY

:BEFORE, FOR, or AFTER[some_identifier]

:FINAL

BEFORE/FOR/AFTER take an identifier. The valid identifiers are:

1. The names of all loaded DLLs

2. any identifier in a FOR[], excepting any already added in 1

3. The names of all root folders in GameData, excepting any added in 1 or 2.

A BEFORE, FOR, and AFTER pass is run for each identifier, and they are processed in that order (so all DLL identifiers run before any others).

As soon as a patch has a pass specifier that matches the current pass, it is run and then cleared.

This means that you can only add one pass specifier (since if you add two, the patch will run on the one that occurs first and the other will be ignored), and that AFTER[something&something] will only work if there is an identifier added (per above) named something&something, i.e. it won't work.

Link to comment
Share on other sites

thanks Nathan

- hmm so how do I ensure that the appropriate TAC or USI module gets added?

  • is the MODULE:NEEDS[TAC] enough to ensure that it wont get run before TAC is run/present?
  • maybe one 'core' MM.cfg to create my part and two patch MM.cfgs, one for TAC and one for USI, each using :AFTER[MOD] to controll adding the right MODULE?

Link to comment
Share on other sites

MODULE:NEEDS[whatever] will run on whatever pass the patch it's in has; NEEDS has nothing to do with passes. ;)

(Before any passes are run, MM will go through and discard all nodes with unmet :NEEDS)

If you're trying to ensure you run AFTER[TacLifeSupport] then that's indeed what you need to use and nothing else. Same with USI.

Link to comment
Share on other sites

ok so sounds like I need:

  • MyPart_Core.cfg - makes the part and constant resources etc
  • MyPart_TAC.cfg - with :AFTER[TAC] to be run after TAC is present and containing MODULE:NEEDS[TAC] {...} to add the TAC module
  • MyPart_USI.cfg - as for TAC but referencing USI stuff

is that the simplest cleanest way to get the job done? but how does it know to do MyPart_TAC after MyPart_Core ? do you know a mod that does what I'm wanting to do that I could use as a reference?

Link to comment
Share on other sites

ok so sounds like I need:

  • MyPart_Core.cfg - makes the part and constant resources etc
  • MyPart_TAC.cfg - with :AFTER[TAC] to be run after TAC is present and containing MODULE:NEEDS[TAC] {...} to add the TAC module
  • MyPart_USI.cfg - as for TAC but referencing USI stuff

is that the simplest cleanest way to get the job done? but how does it know to do MyPart_TAC after MyPart_Core ? do you know a mod that does what I'm wanting to do that I could use as a reference?

The part.core will be loaded before any of the patches so your're fine. You will need to check when the tac patches apply to be sure you can use after [TAC]

Link to comment
Share on other sites

I'm sure this has been answered, but my search-foo is weak this evening...

my goal: find all parts that are probe and all that hold crew

will this return probes, command pods, AND/OR ( | ) crew spaces (ala Hitchhiker, Science Lab, etc.)?

@PART
[*]:HAS[@MODULE[ModuleCommand]][B]|[/B]:HAS[#CrewCapacity
[*]]

Is the

[*] correct to return cores {ModuleCommand{minimumCrew = 0} as well as ( | ) anything with PART{CrewCapacity = 1,2,3...}(I've seen pods/cocpits with integrated cores for on-board Autopilot, in case Jeb suffocates or something) by itself?

@PART
[*]:HAS[@MODULE
[*][#minimumCrew
[*]]][B]|[/B]:HAS[#CrewCapacity
[*]]

Am I correct to assume that passing [#CrewCapacity

[*]] will return any items that have the CrewCapacity listed under the root node PART (won't give fuel tanks or non-crewed fuselages)?

wow, vertigo from trying to make sure i had laid it all out the way 'i think' i understand it. And the more I try to clarify what I'm asking, the more confused I seem to be getting so...

I don't envy you that do this for a living...hats off to you!

Link to comment
Share on other sites

Alt-F11, iirc. should be a black window with ModuleManger in the title bar, 3 buttons. (As it appears on mine)

confirmed just now in-game: Alt+F11

Nice that it has the version of the .dll in the title bar too for quick at-a-glance check.

Edited by Shaggygoblin
Link to comment
Share on other sites

Alt-F11, iirc. should be a black window with ModuleManger in the title bar, 3 buttons. (As it appears on mine)

confirmed just now in-game: Alt+F11

Nice that it has the version of the .dll in the title bar too for quick at-a-glance check.

Aha! Thank you very much. :) Rep!

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