sarbian / ModuleManager

179 stars 95 forks source link

More consistent syntax #12

Open Starstrider42 opened 10 years ago

Starstrider42 commented 10 years ago

Can the & and | operators be added to the syntax for HAS blocks as well as NEEDS blocks? It would make some filters much easier to write than in the present version, where an or-clause can only be represented with multiple patches. Thanks!

7ranceaddic7 commented 7 years ago

I know this is REALLY old but was wondering if it would ever be implemented?

Someone else wrote a config to add response times to engines. Unfortunately, the only way to implement this on parts with different :HAS requirements is to create separate configs that each applies the same modifications to the separate requirements. This could get messy if the EXAMPLE were to be implemented for RF (SIDENOTE2).

EXAMPLE: Intuitively this should work:

@PART[*]:HAS[@MODULE[ModuleEngines*]:HAS[@PROPELLANT[Oxidizer|MonoPropellant],~useEngineResponseTime[True]]] { }

Alas, this is required: @PART[*]:HAS[@MODULE[ModuleEngines*]:HAS[@PROPELLANT[Oxidizer],~useEngineResponseTime[True]]] { }

@PART[*]:HAS[@MODULE[ModuleEngines*]:HAS[@PROPELLANT[MonoPropellant],~useEngineResponseTime[True]]] { }

SIDENOTE1: Nothing in the documentation indicates that | does not function in a :HAS statement.

SIDENOTE2: Even more disconcerting would be a MMConfig for this: @PART[*]:HAS[@MODULE[ModuleEngines*]:HAS[@PROPELLANT[LqdOxygen|NTO|HNO3|NitrousOxide|HTP|N2F4|OF2|AK*|ClF*|FLOX*|IRFNA*|LF2],~useEngineResponseTime[True]]]

blowfishpro commented 7 years ago

What's the use case for multiple :HAS blocks? Can't the same thing be accomplished by &/,-ing the conidtions together?

7ranceaddic7 commented 7 years ago

@blowfishpro In this case, they isolate the different nodes (ModuleEngines* and Propellant). How would you write it?

But, that is not my issue. My issue is WITHIN in the HAS block and | (OR) and & (AND) not functioning as expected.

blowfishpro commented 7 years ago

Ahh, there was some nesting there that I missed. I agree that allowing | to work within a HAS block would be useful.