Jump to content

Extension for ModuleManager with wildcard and conditional - v0.2 - 24 july 2013


sarbian

Recommended Posts

There is no easier way right now. You can't do that with the current version.

I just did some quick test and the problem was in fact easy : there is a missing ] in the expression you posted. Missing square bracket are evil :) It does not work any better since operators are not implemented but it does not apply to all part.

And I checked that < and > are parsed by KSP, so I could add those checks. No guarantee since the code is already more and more messy. Adding much more would need a proper syntax parser and I don't want to go there.

I'll add a check for square bracket parity soon.

Ok but what about HAS[!#CrewCapacity[0]]

Would that not work either?

Link to comment
Share on other sites

Edit : uh ? the post I replied to is gone.

You want to add it to all part with no IonModuleCrewSupport AND CrewCapacity=2

The AND part is a comma (,)

And you missed a closing bracket

So this one should work (can't test now) :

@PART[*]:HAS[!MODULE[ionModuleCrewSupport],HAS[#CrewCapacity[2]]]

Edited by sarbian
Link to comment
Share on other sites

What am I doing wrong here? By my understanding, the following should be adding IonCross life support systems, O2 and CO2 resources to each part that does NOT have the IonModuleCrewSupport module and that has CrewCapacity = 1

No eligible parts that I've checked were being given the module or resources


@PART[*]:HAS[!MODULE[IonModuleCrewSupport],HAS[#CrewCapacity[1]]]
{
MODULE
{
name = IonModuleCrewSupport
}

RESOURCE
{
name = Oxygen
amount = 100
maxAmount = 100
}

RESOURCE
{
name = CarbonDioxide
amount = 0
maxAmount = 10
}
}

Link to comment
Share on other sites

Sorry it was me failing to use my own extension ...

it's :

@PART[*]:HAS[!MODULE[ionModuleCrewSupport],#CrewCapacity[1]]

Sorry for the delay in responding and thank you for trying but that does not work either. The desired module does not get placed on any parts that would be eligible. (i.e. do not already have the module and have the listed crew capacity)

Link to comment
Share on other sites

Just tried it again. Seems to work for me ...

My test.cfg


@PART[*]:HAS[!MODULE[IonModuleCrewSupport],#CrewCapacity[1]]
{
MODULE
{
name = IonModuleCrewSupport
}

RESOURCE
{
name = Oxygen
amount = 100
maxAmount = 100
}

RESOURCE
{
name = CarbonDioxide
amount = 0
maxAmount = 10
}
}

My log


Applying node /Test/@PART[*]:HAS[!MODULE[IonModuleCrewSupport],#CrewCapacity[1]] to Squad/Parts/Command/cupola/part/cupola
(Filename: C:/BuildAgent/work/7535de4ca26c26ac/Runtime/ExportGenerated/StandalonePlayer/UnityEngineDebug.cpp Line: 54)
Applying node /Test/@PART[*]:HAS[!MODULE[IonModuleCrewSupport],#CrewCapacity[1]] to Squad/Parts/Command/landerCabinSmall/part/landerCabinSmall
(Filename: C:/BuildAgent/work/7535de4ca26c26ac/Runtime/ExportGenerated/StandalonePlayer/UnityEngineDebug.cpp Line: 54)
Applying node /Test/@PART[*]:HAS[!MODULE[IonModuleCrewSupport],#CrewCapacity[1]] to Squad/Parts/Command/Mark1Cockpit/part/Mark1Cockpit
(Filename: C:/BuildAgent/work/7535de4ca26c26ac/Runtime/ExportGenerated/StandalonePlayer/UnityEngineDebug.cpp Line: 54)
Applying node /Test/@PART[*]:HAS[!MODULE[IonModuleCrewSupport],#CrewCapacity[1]] to Squad/Parts/Command/Mark2Cockpit/part/Mark2Cockpit
(Filename: C:/BuildAgent/work/7535de4ca26c26ac/Runtime/ExportGenerated/StandalonePlayer/UnityEngineDebug.cpp Line: 54)
Applying node /Test/@PART[*]:HAS[!MODULE[IonModuleCrewSupport],#CrewCapacity[1]] to Squad/Parts/Command/mk1pod/part/mk1pod

Link to comment
Share on other sites

Just tried it again. Seems to work for me ...

My test.cfg

<snipped for clarity

My log

<snipped for clarity>

You're pulling that out of output_log.txt right? All I see in there relating to your plugin and my config is:


Config(@PART[*]:HAS[!MODULE[IonModuleCrewSupport],#CrewCapacity[1]]) MyTweaks/ioncross_for_everyone/@PART[*]:HAS[!MODULE[IonModuleCrewSupport],#CrewCapacity[1]]
(Filename: C:/BuildAgent/work/7535de4ca26c26ac/Runtime/ExportGenerated/StandalonePlayer/UnityEngineDebug.cpp Line: 54)
Config(@PART[*]:HAS[!MODULE[IonModuleCrewSupport],#CrewCapacity[2]]) MyTweaks/ioncross_for_everyone/@PART[*]:HAS[!MODULE[IonModuleCrewSupport],#CrewCapacity[2]]
(Filename: C:/BuildAgent/work/7535de4ca26c26ac/Runtime/ExportGenerated/StandalonePlayer/UnityEngineDebug.cpp Line: 54)
Config(@PART[*]:HAS[!MODULE[IonModuleCrewSupport],#CrewCapacity[3]]) MyTweaks/ioncross_for_everyone/@PART[*]:HAS[!MODULE[IonModuleCrewSupport],#CrewCapacity[3]]
(Filename: C:/BuildAgent/work/7535de4ca26c26ac/Runtime/ExportGenerated/StandalonePlayer/UnityEngineDebug.cpp Line: 54)
Config(@PART[*]:HAS[!MODULE[IonModuleCrewSupport],#CrewCapacity[4]]) MyTweaks/ioncross_for_everyone/@PART[*]:HAS[!MODULE[IonModuleCrewSupport],#CrewCapacity[4]]
(Filename: C:/BuildAgent/work/7535de4ca26c26ac/Runtime/ExportGenerated/StandalonePlayer/UnityEngineDebug.cpp Line: 54)
Config(@PART[*]:HAS[!MODULE[IonModuleCrewSupport],#CrewCapacity[5]]) MyTweaks/ioncross_for_everyone/@PART[*]:HAS[!MODULE[IonModuleCrewSupport],#CrewCapacity[5]]
(Filename: C:/BuildAgent/work/7535de4ca26c26ac/Runtime/ExportGenerated/StandalonePlayer/UnityEngineDebug.cpp Line: 54)
Config(@PART[*]:HAS[!MODULE[IonModuleCrewSupport],#CrewCapacity[6]]) MyTweaks/ioncross_for_everyone/@PART[*]:HAS[!MODULE[IonModuleCrewSupport],#CrewCapacity[6]]

I'm using the same conditionals you are.... guess I better go check plugin versions. ModuleManager is the latest though, he hasn't updated it in awhile

Edit: It shouldn't matter where in GameData the dll lives; it's clearly loaded. But where did you put yours?

Edited by Starwaster
Link to comment
Share on other sites

In gamedata root. the cfg file is here too

Edit : can you try this ModuleManager version http://www.sarbian.com/sarbian/ModuleManager.dll ? It the last one with this patch added : http://forum.kerbalspaceprogram.com/showthread.php/45107-KSPAddon-bug-causes-mod-incompatibilities

Do you have other mods with dll ?

Edited by sarbian
Link to comment
Share on other sites

In gamedata root. the cfg file is here too

Edit : can you try this ModuleManager version http://www.sarbian.com/sarbian/ModuleManager.dll ? It the last one with this patch added : http://forum.kerbalspaceprogram.com/showthread.php/45107-KSPAddon-bug-causes-mod-incompatibilities

Do you have other mods with dll ?

Sorry for the delayed response. I tried the patched ModuleManager.dll and I have good news and bad news.

Good news is that my IonCross patch worked and I was able to add life support to all parts with crew capacity 1-6.

The bad news is that most of my Modular Fuel Tank config files stopped working. (actually all MFT fuel tanks and engines stopped working; they reverted back to stock. Only MFT patches that I had created continued to work)

I had to restore the original ModuleManager.dll file to resture MFT to functionality.

I don't know what to do with this at this point. When I have time I'll create another KSP folder with no mods except ModuleManager, your extensions and Modular Fuel Tanks installed so I can trouble shoot the problem better. That will eliminate any issues with other plugins and decrease my load times so that I can shut down and restart KSP without 5 minute load times.

Link to comment
Share on other sites

Edit2 :

I made an error while applying Majiir fix. Can you try it with those 2 :

www.sarbian.com/sarbian/ModuleManager.dll

www.sarbian.com/sarbian/MMSarbianExt.dll

If it still does not work can you post your .cfg file and mods list and I'll duplicate your install to test.

Edited by sarbian
Link to comment
Share on other sites

Edit2 :

I made an error while applying Majiir fix. Can you try it with those 2 :

www.sarbian.com/sarbian/ModuleManager.dll

www.sarbian.com/sarbian/MMSarbianExt.dll

If it still does not work can you post your .cfg file and mods list and I'll duplicate your install to test.

Test results are:

ModularFuels working as expected.

IonCross being added to everything with CrewCapacity, but it's also resulting in IonCross being added twice to some items, where it's being added from other config files (such as IonCross itself)

Looking at the log it actually appears that my config is being applied first so I'm going to assume here that the conditional is working properly and that the other configs just have no means of knowing that IonCross was already added.

Do you know if file name has any bearing on execution order? Or do I need to use the :Final keyword to make mine execute last?

Edit:

The problem with extra IonCrossCrewSupport modules persists. I even tried keyword :Final, but it doesn't look right.

Ordinarily, it would appear as

Part[PartName]:Final

Looking at the config that I have, I'm not sure that's going to work as I don't know how this is going to end up looking internally by the time your plugin and ModuleManager get done parsing...

Here's an example of what I'm using:


@PART[*]:HAS[!MODULE[IonModuleCrewSupport],#CrewCapacity[1]]:Final
{
MODULE
{
name = IonModuleCrewSupport
}

RESOURCE
{
name = Oxygen
amount = 100
maxAmount = 100
}

RESOURCE
{
name = CarbonDioxide
amount = 0
maxAmount = 10
}
}

Edited by Starwaster
additional information
Link to comment
Share on other sites

The problem is that my MMExt don't know if MM is finished when it adds its patch and it may do the patch before or after MM. I don't know how to do it right now ...

And :Final is not yet implemented for MMExt

Edited by sarbian
Link to comment
Share on other sites

The problem is that my MMExt don't know if MM is finished when it adds its patch and it may do the patch before or after MM. I don't know how to do it right now ...

And :Final is not yet implemented for MMExt

But isn't it really just passing through the node back to MM when it finishes determining how many nodes need to be applied? Shouldn't it just work if you pass :Final through with the rest of the node? (assuming that :Final was present to begin with)

btw, glad to see you're still here, I thought you'd left us to go on vacation :P

Link to comment
Share on other sites

  • 4 weeks later...

errr i don't seems able to change gimbalrange globaly with this extension...

my cfg:

@PART[*]:HAS[@MODULE[ModuleGimbal]]

{

@gimbalRange = 1.5

}

in the ksp.log, it seems the first part worked, it do fine those parts that have gimbal enabled (this is my light-weight test platform, so just 3 engines found):

[LOG 19:34:17.936] Applying node /gimbal_fix/@PART[*]:HAS[@MODULE[ModuleGimbal]] to Squad/Parts/Engine/liquidEngine1-2/part/liquidEngine1-2

[LOG 19:34:17.947] Applying node /gimbal_fix/@PART[*]:HAS[@MODULE[ModuleGimbal]] to Squad/Parts/Engine/liquidEngine2/part/liquidEngine2

[LOG 19:34:17.949] Applying node /gimbal_fix/@PART[*]:HAS[@MODULE[ModuleGimbal]] to Squad/Parts/Engine/liquidEngine2-2/part/liquidEngine2-2

but it just don't change the value.....

any more sample syntax for this???

Thank you.

Link to comment
Share on other sites

errr i don't seems able to change gimbalrange globaly with this extension...

my cfg:

@PART[*]:HAS[@MODULE[ModuleGimbal]]

{

@gimbalRange = 1.5

}

in the ksp.log, it seems the first part worked, it do fine those parts that have gimbal enabled (this is my light-weight test platform, so just 3 engines found):

[LOG 19:34:17.936] Applying node /gimbal_fix/@PART[*]:HAS[@MODULE[ModuleGimbal]] to Squad/Parts/Engine/liquidEngine1-2/part/liquidEngine1-2

[LOG 19:34:17.947] Applying node /gimbal_fix/@PART[*]:HAS[@MODULE[ModuleGimbal]] to Squad/Parts/Engine/liquidEngine2/part/liquidEngine2

[LOG 19:34:17.949] Applying node /gimbal_fix/@PART[*]:HAS[@MODULE[ModuleGimbal]] to Squad/Parts/Engine/liquidEngine2-2/part/liquidEngine2-2

but it just don't change the value.....

any more sample syntax for this???

Thank you.

Because you're not applying the change to the module. Technically what the code you cited does is to attempt to change an existing property on the part named gimbalRange. (which doesn't actually exist and wouldn't do anything if it did)

You need this:


@PART[*]:HAS[@MODULE[ModuleGimbal]]
{
@MODULE[ModuleGimbal]
{
@gimbalRange = 1.5
}
}

Link to comment
Share on other sites

Because you're not applying the change to the module. Technically what the code you cited does is to attempt to change an existing property on the part named gimbalRange. (which doesn't actually exist and wouldn't do anything if it did)

You need this:


@PART[*]:HAS[@MODULE[ModuleGimbal]]
{
@MODULE[ModuleGimbal]
{
@gimbalRange = 1.5
}
}

arr, thank you. i tuned down ALL engines' gimbal to 0.3 trying to reduce wobble now. \o/ but seems still need to lock gimbal if radically mounted.

Link to comment
Share on other sites

  • 3 weeks later...

Since ialdabaoth gave me his blessing to manage MM while he his away i'll merge my extension with MM in the coming days. I just need to merge the code, and do a few test.

Link to comment
Share on other sites

How do I add MechJeb to all pods that don't already have it?

@PART[*]:HAS[@MODULE[ModuleCommand]:HAS[!MODULE[MechJebCore]]]

{

MODULE

{

name = MechJebCore

}

}

Isn't working.

---

Actually, while we are at it, can someone explain this mod properly? For example, what exactly does '#' do?

Link to comment
Share on other sites

This extension is really useful. I have attempted to add AIES and RemoteTech into the career mode tech tree in an approximately sensible stock equivalent fashion. With over 100 parts involved the wildcard and conditional approach has made it possible to do it in a reasonable amount of time. It seems to have worked. Now to play test :cool:


// RemoteTech Parts

@PART[Remote*] //Some RemoteTech parts are not used
{
TechRequired = spaceExploration
}

@PART[SatDish9000]
{
TechRequired = spaceExploration
}

// AIES Parts


@PART[*]:HAS[#author[Carmics]] //this catches any AIES parts that get missed elsewhere
{
TechRequired = specializedConstruction
}

@PART[*]:HAS[#author[Carmics],@MODULE[ModuleCommand]]
{
@TechRequired = flightControl
}

@PART[*]:HAS[#author[Carmics],#category[Aero]]
{
@TechRequired = advAerodynamics
}

@PART[*]:HAS[#author[Carmics],#category[Science]]
{
@TechRequired = electronics
}

@PART[*]:HAS[#author[Carmics],#category[Propulsion]]
{
@TechRequired = heavyRocketry
}

@PART[fuel*]:HAS[#author[Carmics]]
{
@TechRequired = heavyRocketry
}

@PART[*]:HAS[#author[Carmics],#category[Utility]]
{
@TechRequired = landing
}

@PART[solar*]:HAS[#author[Carmics]]
{
@TechRequired = advElectrics
}

@PART[*RCS*]:HAS[#author[Carmics]]
{
@TechRequired = advFlightControl
}

@PART[*]:HAS[#author[Carmics],#category[Control]]
{
@TechRequired = advFlightControl
}

@PAR@PART[*]:HAS[#author[Carmics],#category[Structural]]
{
@TechRequired = stability
}

@PART[Dishcl1]
{
@TechRequired = scienceTech
}

@PART[Antennaesc]
{
@TechRequired = start
}

@PART[solarpaneles1]
{
@TechRequired = start
}

@PART[batteryBAEr]
{
@TechRequired = start
}

@PART[engineexper05]
{
@TechRequired = basicRocketry
}

@PART[decouplersv05]
{
@TechRequired = basicRocketry
}

@PART[tankMER6]
{
@TechRequired = basicRocketry
}

@PART[tank1300cl]
{
@TechRequired = generalRocketry
}

@PART[VR1vulcan]
{
@TechRequired = generalRocketry
}

@PART[liquidEngineconstelacion]
{
@TechRequired = generalRocketry
}

@PART[satpropt300FuelTank]
{
@TechRequired = flightControl
}

@PART[tankMER1]
{
@TechRequired = flightControl
}

@PART[tankminsond]
{
@TechRequired = flightControl
}

@PART[tankorb1]
{
@TechRequired = flightControl
}

@PART[tanktoemv2]
{
@TechRequired = flightControl
}

Link to comment
Share on other sites

@AlmightyR


@PART[*]:HAS[@MODULE[ModuleCommand],!MODULE[MechJebCore]]
{
MODULE
{
name = MechJebCore
}
}

As for the # look at Kaa253 post. He has some great use for it :)

Link to comment
Share on other sites

Does anyone have a cfg file with all stock parts in it and would like to share it?

Planning on building my own tech tree and some other stuff.

Yes, just asking because I am lazy, but asking almost never hurts. :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...