Jump to content

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


sarbian

Recommended Posts

@sarbian I've run into an odd bug that I've been able to reproduce on two different computers.  If MM has to create the cache, the stock Squad inflatable heat shield automatically inflates in the VAB and there is no way to deflate it. The right click menu has the option Toggle instead of Deflate Heat Shield. Clicking Toggle doesn't do anything. My concern is there may be more scrambled than just this one part.

I ran into it with a 1.6.0 install and around 100 mods. Looking for mod conflicts I was able to reproduce it with a clean install of 1.6.0 and only Module Manager with no other mods installed. I tried with 1.3.2 and 1.3.1, but nothing older. After running into the problem on my gaming computer I installed KSP 1.6.0 on an older laptop and was able to reproduce the problem.

First delete the cache files MM creates, to force it to create them. Then start the game, go into the VAB, and add the inflatable heat shield to a craft. It should automatically inflate and there is no option to deflate it. A NullReferenceException is thrown when the the heatshield is added to the craft. Quit and restart, go into the VAB, add the heatshield and there should be no problem on the second start.

If Module Manager has to build the cache, the problem occurs stock or modded.

If MM loads from the cache there is no problem.

Stock install without MM there is no problem.

So, the workaround seems to be that whenever your mods change you have to load the game, quit and restart to avoid this.

KSP.LOG  output_log.txt

Link to comment
Share on other sites

@Tonka Crash avoid using mods with 1.6 for now, there's a rather serious issue which ModuleManager makes much worse (I think this is likely a manifestation of that).  Squad is aware of it, currently waiting until the new year to see if they'll fix or not (fixing on the ModuleManager side would not be ideal).  If you absolutely have to use 1.6 with mods, let KSP load to the main menu, quit, and then reload KSP without changing anything (so that ModuleManager loads from cache) and do this every time you add, remove, or change a mod.

Link to comment
Share on other sites

2 hours ago, blowfish said:

@Tonka Crash avoid using mods with 1.6 for now, there's a rather serious issue which ModuleManager makes much worse (I think this is likely a manifestation of that).  Squad is aware of it, currently waiting until the new year to see if they'll fix or not (fixing on the ModuleManager side would not be ideal).  If you absolutely have to use 1.6 with mods, let KSP load to the main menu, quit, and then reload KSP without changing anything (so that ModuleManager loads from cache) and do this every time you add, remove, or change a mod.

If it serves for something, I detected the need for this workaround on the 1.5.x too (and I think - but I'm not sure if memory is serving me right -  I had to do it once on 1.4.5).

 

— — — POST EDIT — — — 

Had someone tried to check the problem with and without Making History installed? MH uses the Start Menu to fire some internal processes, and this had bitten me more than once!

Edited by Lisias
post edit
Link to comment
Share on other sites

2 hours ago, Lisias said:

Had someone tried to check the problem with and without Making History installed?

I've been running 1.6 without MH installed and have noticed no issues at all. 

I'm running everything I had installed under 1.5.1, and it all appears to be working without any problems.

Link to comment
Share on other sites

2 hours ago, Lisias said:

Had someone tried to check the problem with and without Making History installed?

Good question.  I can demonstrate the inflated heat-shield and ignited NERVAs problem, using blowfish's method of deleting partDatabase.cfg in a stock 1.6.0, without Making History.  That might narrow down the problem, so I'll update entry 20758 on the bug-tracker.

Edited by OHara
Link to comment
Share on other sites

I found a workaround to the "Variant: Variant Name" issue.
It is in no way a permanent fix. It has to be done every time you start the game.
I also recommend uninstalling any mods that change the way the parts list is shown.
This includes "Filter Extensions"

While you're in the main menu, open the Debug Menu (Alt + F12)
Go to "Database" and click reload database. Wait until the "Loading..." next to the categories changes back to numbers. This could take a couple minutes if you have a lot of mods.
After that, click reload texts dictionary. A message on the top should come up that it was successful.
You may now right click on all the parts you desire without them glitching out!
Proof and mod list: https://imgur.com/a/iZqV8yj
I have not tested it fully but I have tested it with the retractable rover wheels and the lander can and they are not bugged anymore when I do the above.

Link to comment
Share on other sites

Hi everyone, this is one of my first support requests so please do advise me if I can do better. But really it's also a more general question. Here goes:

What exactly are ModuleManager warnings and errors, what do they indicate, are they problematic or do they worsen startup time? What can I do when I see "patches applied, found X warnings"?

bdUyhtd.png

Log: http://s000.tinyupload.com/download.php?file_id=60425537397745288702&t=6042553739774528870266955

I'm running KSP 1.5.1 and my mods are as follows:

Spoiler

KSP: 1.5.1 (Win64) - Unity: 2017.1.3p1 - OS: Windows 10  (10.0.0) 64bit
ClickThroughBlocker - 0.1.6.9
ToolbarControl - 0.1.6.19
AllYAllContinued - 0.11.16.2
B9 Part Switch - 2.5.1
Bon Voyage - 0.14.3
Chatterer - 0.9.96.2332
Community Resource Pack - 1.0
CommunityTechTree - 3.3.4
Contract Configurator - 1.27.1
Contract Pack: Anomaly Surveyor - 1.7.1
Contract Pack: Field Research - 1.2.1
Crowd Sourced Science - 4.1.2
Community Terrain Texture Pack - 1.0.4
CustomBarnKit - 1.1.19
DistantObjectEnhancement - 1.9.1
DMagic Orbital Science - 1.4.1
DynamicBatteryStorage - 1.3.3
Environmental Visual Enhancements - 1.4.2.2
HideEmptyTechTreeNodes - 1.0.5
RasterPropMonitor - 0.30.6
Kerbal Engineer Redux - 1.1.5.5
<b><color=#CA7B3C>Kopernicus</color></b> - 1.5.1.1
KSP-AVC Plugin - 1.2.0.6
Landing Height - 2.2.0.4
ModularFlightIntegrator - 1.2.6
NearFutureElectrical - 0.10.4
NearFuturePropulsion - 1.0.4
NearFutureSolar - 0.8.13
Final Frontier - 1.5.1.3415
OuterPlanetsMod - 2.2.2
PatchManager - 0.0.16.3
PlanetShine - 0.2.6.1
Precise Node - 1.2.9.3
RealPlume - Stock - 1.3
ReentryParticleEffect - 1.3
ResearchBodies - 1.9.8
SCANsat - 1.1.8.10
ScienceAlert - 1.9.5.2
StageRecovery - 1.9.0.3
Stock Visual Enhancements - 1.3.0.4
Strategia - 1.7.3
Stock Visual Terrain - 2.1.4.1
Tracking Station Evolved - 1.0.4.1
Kerbal Alarm Clock - 3.9.1
Transfer Window Planner - 1.6.3
VesselViewerContinued - 0.8.7.1
Waypoint Manager - 2.7.4

 

Edited by avalancha
Mod versions
Link to comment
Share on other sites

I am having an issue with the LV-N "Nerv" Atomic Rocket Motor in VAB and SPH on a fresh install with only latest MM installed.

The engine appears to be running (with flame animation) in SPH an VAB and also does not appear in the staging column as a selectable part. Also the delta-V does not show for said engines.

When going to launch site, the engines appear in the staging column and can be arranged but it is still annoying to have this bug while building.

Reproduced the bug on two different computers with fresh KSP installs and only newest MM installed.

Link to comment
Share on other sites

3 hours ago, Knorfinator said:

I am having an issue with the LV-N "Nerv" Atomic Rocket Motor in VAB and SPH on a fresh install with only latest MM installed.

The engine appears to be running (with flame animation) in SPH an VAB and also does not appear in the staging column as a selectable part. Also the delta-V does not show for said engines.

When going to launch site, the engines appear in the staging column and can be arranged but it is still annoying to have this bug while building.

Reproduced the bug on two different computers with fresh KSP installs and only newest MM installed.

What KSP version?  If it's 1.6, I would avoid using mods with it for the moment due to a known issue which we're looking at.  If not, please upload KSP.log for us to inspect, that usually has some clue as to what the issue is.

And welcome to the forums! :D

Link to comment
Share on other sites

On 12/30/2018 at 9:40 PM, blowfish said:

@Tonka Crash avoid using mods with 1.6 for now, there's a rather serious issue which ModuleManager makes much worse (I think this is likely a manifestation of that).  Squad is aware of it, currently waiting until the new year to see if they'll fix or not (fixing on the ModuleManager side would not be ideal).  If you absolutely have to use 1.6 with mods, let KSP load to the main menu, quit, and then reload KSP without changing anything (so that ModuleManager loads from cache) and do this every time you add, remove, or change a mod.

By any means, this problem is related to the following StackDump, or this is something completely different?

[EXC 05:20:42.622] NullReferenceException: Object reference not set to an instance of an object
        KSP.UI.Screens.PartListCategories.BulkheadProfile.ExclusionCriteria (.AvailablePart aP)
        EditorPartListFilter`1[AvailablePart].FilterList (System.Collections.Generic.List`1 parts, System.Func`2 filter)
        EditorPartListFilterList`1[AvailablePart].FilterList (System.Collections.Generic.List`1 list)
        KSP.UI.Screens.EditorPartList.RefreshPartList ()
        KSP.UI.Screens.EditorPartList.Refresh ()
        KSP.UI.Screens.EditorPartList.Refresh (State state)
        KSP.UI.Screens.PartCategorizer+<UpdateDaemon>c__Iterator5.MoveNext ()
        UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress)

 

Link to comment
Share on other sites

20 minutes ago, Lisias said:

By any means, this problem is related to the following StackDump, or this is something completely different?

Not completely sure, I think that might be related to a part missing it’s bulkhead profiles ... apparently KSP doesn’t deal with that very well

Link to comment
Share on other sites

1 hour ago, blowfish said:

Not completely sure, I think that might be related to a part missing it’s bulkhead profiles ... apparently KSP doesn’t deal with that very well

We had this topic in the modded support section as well:

There is definitly an issue with missing 'bulkheadprofiles' entries. As soon as a part misses a valid entry, the exception posted by @Lisias will appear and the part list no longer updates properly until leaving the editor.

Link to comment
Share on other sites

I'm trying to create a config for the SimpleFuelSwitch mod and this is pretty much the first time I'm writing a MM patch which contains more than a couple of row, so I have a couple of questions here^^

The Config is supposed to add every fuel type to every fuel tank but it is also configurable in a separate config file. The config file is not part of the mod, this is just my idea how to realize this via MM.

My testing config file contains these values:

SFS_Alternative_Config
{
	//LF_Only tanks	
	LF_Add_LFO = true
	LF_Add_Ox = false
	LF_Add_Mono = false
	LF_Add_Xe = true
	
	//LFO tanks	
	LFO_Add_LF = false
	LFO_Add_Ox = true
	LFO_Add_Mono = true
	LFO_Add_Xe = true
	
	//MonoProp tanks
	Mono_Add_LF = false
	Mono_Add_LFO = false
	Mono_Add_Ox = true
	Mono_Add_Xe = false
	
	//Xenon tanks
	Xe_Add_LF = true
	Xe_Add_LFO = true
	Xe_Add_Ox = true
	Xe_Add_Mono = true
}

The actual patch (not finished yet):

//Add dummy modules to write the config settings into the required parts
//These modules can be used to set up MM filter to progress further 

//Take care of LF only tanks
@PART[*]:HAS[@RESOURCE[LiquidFuel],!RESOURCE[Oxidizer],!RESOURCE[IntakeAir]]
{
	//Add dummy module
	MODULE
	{
		name = SFS_LF
		LF_Add_LFO = #$@SFS_Alternative_Config/LF_Add_LFO$
		LF_Add_Ox = #$@SFS_Alternative_Config/LF_Add_Ox$
		LF_Add_Mono = #$@SFS_Alternative_Config/LF_Add_Mono$
		LF_Add_Xe = #$@SFS_Alternative_Config/LF_Add_Xe$
		LF_Amount = #$/RESOURCE[LiquidFuel]/amount$
		LF_MaxAmount = #$/RESOURCE[LiquidFuel]/maxAmount$		
	}	
	//Remove stock LF resources
	//!RESOURCE[LiquidFuel] {}
}

//Take care of LFO tanks
@PART[*]:HAS[@RESOURCE[Oxidizer],@RESOURCE[LiquidFuel],!MODULE[ModuleEnginesFX],!MODULE[ModuleCommand]]
{
	//Add dummy module
	MODULE
	{
		name = SFS_LFO
		LFO_Add_LF = #$@SFS_Alternative_Config/LFO_Add_LF$
		LFO_Add_Ox = #$@SFS_Alternative_Config/LFO_Add_Ox$
		LFO_Add_Mono = #$@SFS_Alternative_Config/LFO_Add_Mono$
		LFO_Add_Xe = #$@SFS_Alternative_Config/LFO_Add_Xe$
		LF_Amount = #$/RESOURCE[LiquidFuel]/amount$
		LF_MaxAmount = #$/RESOURCE[LiquidFuel]/maxAmount$
		Ox_Amount = #$/RESOURCE[Oxidizer]/amount$
		Ox_MaxAmount = #$/RESOURCE[Oxidizer]/maxAmount$
	}	
	//Remove stock LFO resources
	//!RESOURCE[LiquidFuel] {}
	//!RESOURCE[Oxidizer] {}
}

//Take care of monoprop tanks
@PART[*]:HAS[@RESOURCE[MonoPropellant],!MODULE[ModuleCommand]]
{
	//Add dummy module
	MODULE
	{
		name = SFS_MONO
		Mono_Add_LF = #$@SFS_Alternative_Config/Mono_Add_LF$
		Mono_Add_LFO = #$@SFS_Alternative_Config/Mono_Add_LFO$
		Mono_Add_Ox = #$@SFS_Alternative_Config/Mono_Add_Ox$
		Mono_Add_Xe = #$@SFS_Alternative_Config/Mono_Add_Xe$
		Mono_Amount = #$/RESOURCE[MonoPropellant]/amount$
		Mono_MaxAmount = #$/RESOURCE[MonoPropellant]/maxAmount$
	}	
	//Remove stock LFO resources
	//!RESOURCE[MonoPropellant] {}
}

//Take care of xenon tanks
@PART[*]:HAS[@RESOURCE[XenonGas]]
{
	//Add dummy module
	MODULE
	{
		name = SFS_XENON
		Xe_Add_LF = #$@SFS_Alternative_Config/Xe_Add_LF$
		Xe_Add_LFO = #$@SFS_Alternative_Config/Xe_Add_LFO$
		Xe_Add_Ox = #$@SFS_Alternative_Config/Xe_Add_Ox$
		Xe_Add_Mono = #$@SFS_Alternative_Config/Xe_Add_Mono$
		Xe_Amount = #$/RESOURCE[XenonGas]/amount$
		Xe_MaxAmount = #$/RESOURCE[XenonGas]/maxAmount$
	}	
	//Remove stock LFO resources
	//!RESOURCE[XenonGas] {}
}

//Add SimpleFuelSwitch module if any fuel type is added
//LF tanks            
@PART[*]:HAS[@MODULE[SFS_LF]:HAS[#LF_Add_LFO[true]]|[#LF_Add_Ox[true]]|[#LF_Add_Mono[true]]|[#LF_Add_Xe[true]]]
{	
	MODULE
	{
		name = ModuleSimpleFuelSwitch
	}
}

//LFO tanks
@PART[*]:HAS[@MODULE[SFS_LFO]:HAS[#LFO_Add_LF[true]]|[#LFO_Add_Ox[true]]|[#LFO_Add_Mono[true]]|[#LFO_Add_Xe[true]]]
{	
	MODULE
	{
		name = ModuleSimpleFuelSwitch
	}
}

//MonoProp tanks
@PART[*]:HAS[@MODULE[SFS_MONO]:HAS[#Mono_Add_LFO[true]]|[#Mono_Add_Ox[true]]|[#Mono_Add_LF[true]]|[#Mono_Add_Xe[true]]]
{	
	MODULE
	{
		name = ModuleSimpleFuelSwitch
	}
}

//Xenon tanks
@PART[*]:HAS[@MODULE[SFS_XENON]:HAS[#Xe_Add_LFO[true]]|[#Xe_Add_Ox[true]]|[#Xe_Add_Mono[true]]|[#Xe_Add_LF[true]]]
{	
	MODULE
	{
		name = ModuleSimpleFuelSwitch
	}
}

//Add fuel resources for SimpleFuelSwitch

//LF tanks
//Add default fuel
@PART[*]:HAS[@MODULE[SFS_LF],@MODULE[ModuleSimpleFuelSwitch]]
{
	MODULE
	{
		name = ModuleSwitchableResources
		resourcesId = liquid_fuel_only
		displayName = #SimpleFuelSwitch_LiquidFuel
		selectorFieldName = #SimpleFuelSwitch_fuelTypeLabel
		isDefault = true
		RESOURCE
		{
			name = LiquidFuel
			amount = #$/MODULE[SFS_LF]/LF_Amount$
			maxAmount = #$/MODULE[SFS_LF]/LF_MaxAmount$
		}
	}
}

//Add LFO
@PART[*]:HAS[@MODULE[SFS_LF]:HAS[#LF_Add_LFO[true]]]
	MODULE
	{
		name = ModuleSwitchableResources
		resourcesId = liquid_fuel_oxidizer
		displayName = #SimpleFuelSwitch_LiquidFuelAndOxidizer
		selectorFieldName = #SimpleFuelSwitch_fuelTypeLabel
		RESOURCE
		{
			name = LiquidFuel
			amount = #$/MODULE[SFS_LF]/LF_Amount$
			@amount *= 0.45
			maxAmount = #$/MODULE[SFS_LF]/LF_MaxAmount$
			@maxAmount *= 0.45
		}
		RESOURCE
		{
			name = Oxidizer
			amount = #$/MODULE[SFS_LF]/LF_Amount$
			@amount *= 0.55
			maxAmount = #$/MODULE[SFS_LF]/LF_MaxAmount$
			@maxAmount *= 0.55
		}
	}
}

//Add MonoProp
@PART[*]:HAS[@MODULE[SFS_LF]:HAS[#LF_Add_Mono[true]]]
{
	MODULE
	{
		name = ModuleSwitchableResources
		resourcesId = mono_only
		displayName = #SimpleFuelSwitch_Mono
		selectorFieldName = #SimpleFuelSwitch_fuelTypeLabel
		RESOURCE
		{
			name = MonoPropellant
			amount = #$/MODULE[SFS_LF]/LF_Amount$
			@amount *= 1.25 
			maxAmount = #$/MODULE[SFS_LF]/LF_MaxAmount$
			@maxAmount *= 1.25 
		}
	}
}

//Add Ox_Only
@PART[*]:HAS[@MODULE[SFS_LF]:HAS[#LF_Add_Ox[true]]]
{
	MODULE
	{
		name = ModuleSwitchableResources
		resourcesId = oxidizer_only
		displayName = #SimpleFuelSwitch_OxOnly
		selectorFieldName = #SimpleFuelSwitch_fuelTypeLabel
		RESOURCE
		{
			name = Oxidizer
			amount = #$/MODULE[SFS_LF]/LF_Amount$
			@amount /= 0.45
			@amount *= 0.55
			maxAmount = #$/MODULE[SFS_LF]/LF_MaxAmount$
			@maxAmount /= 0.45
			@maxAmount *= 0.55
		}
	}
}

//Add Xenon
@PART[*]:HAS[@MODULE[SFS_LF]:HAS[#LF_Add_Xe[true]]]
{
	MODULE
	{
		name = ModuleSwitchableResources
		resourcesId = xenon_only
		displayName = #SimpleFuelSwitch_Xenon
		selectorFieldName = #SimpleFuelSwitch_fuelTypeLabel
		RESOURCE
		{
			name = XenonGas
			amount = #$/MODULE[SFS_LF]/LF_Amount$
			@amount *= 50 
			maxAmount = #$/MODULE[SFS_LF]/LF_MaxAmount$
			@maxAmount *= 50
		}
	}
}

//LFO tanks
//Add default fuel
@PART[*]:HAS[@MODULE[SFS_LFO],@MODULE[ModuleSimpleFuelSwitch]]
{
	MODULE
	{
		name = ModuleSwitchableResources
		resourcesId = liquid_fuel_oxidizer
		displayName = #SimpleFuelSwitch_LiquidFuelAndOxidizer
		selectorFieldName = #SimpleFuelSwitch_fuelTypeLabel
		isDefault = true
		RESOURCE
		{
			name = LiquidFuel
			amount = #$/MODULE[SFS_LFO]/LF_Amount$
			maxAmount = #$/MODULE[SFS_LFO]/LF_MaxAmount$
		}
		RESOURCE
		{
			name = Oxidizer
			amount = #$/MODULE[SFS_LFO]/Ox_Amount$
			maxAmount = #$/MODULE[SFS_LFO]/Ox_MaxAmount$
		}
	}
}

//Add LF_Only
@PART[*]:HAS[@MODULE[SFS_LFO]:HAS[#LFO_Add_LF[true]]]
{
	MODULE
	{
		name = ModuleSwitchableResources
		resourcesId = liquid_fuel_only
		displayName = #SimpleFuelSwitch_LiquidFuel
		selectorFieldName = #SimpleFuelSwitch_fuelTypeLabel
		RESOURCE
		{
			name = LiquidFuel
			amount = #$/MODULE[SFS_LFO]/LF_Amount$
			@amount += #$/MODULE[SFS_LFO]/Ox_Amount$
			maxAmount = #$/MODULE[SFS_LFO]/LF_MaxAmount$
			@maxAmount += #$/MODULE[SFS_LFO]/Ox_MaxAmount$
		}
	}
}

//Add MonoProp
@PART[*]:HAS[@MODULE[SFS_LFO]:HAS[#LFO_Add_Mono[true]]]
{
	MODULE
	{
		name = ModuleSwitchableResources
		resourcesId = mono_only
		displayName = #SimpleFuelSwitch_Mono
		selectorFieldName = #SimpleFuelSwitch_fuelTypeLabel
		RESOURCE
		{
			name = MonoPropellant
			amount = #$/MODULE[SFS_LFO]/LF_Amount$
			@amount += #$/MODULE[SFS_LFO]/Ox_Amount$
			@amount *= 1.25
			maxAmount = #$/MODULE[SFS_LFO]/LF_MaxAmount$
			@maxAmount += #$/MODULE[SFS_LFO]/Ox_MaxAmount$
			@maxAmount *= 1.25
		}
	}
}

//Add Ox_Only
@PART[*]:HAS[@MODULE[SFS_LFO]:HAS[#LFO_Add_Ox[true]]]
{
	MODULE
	{
		name = ModuleSwitchableResources
		resourcesId = oxidizer_only
		displayName = #SimpleFuelSwitch_OxOnly
		selectorFieldName = #SimpleFuelSwitch_fuelTypeLabel
		RESOURCE
		{
			name = Oxidizer
			amount = #$/MODULE[SFS_LFO]/LF_Amount$
			@amount += #$/MODULE[SFS_LFO]/Ox_Amount$
			@amount *= #$/MODULE[SFS_LFO]/Ox_Amount$
			@amount /= #$/MODULE[SFS_LFO]/LF_Amount$
			maxAmount = #$/MODULE[SFS_LFO]/LF_MaxAmount$
			@maxAmount += #$/MODULE[SFS_LFO]/Ox_MaxAmount$
			@maxAmount *= #$/MODULE[SFS_LFO]/Ox_Amount$
			@maxAmount /= #$/MODULE[SFS_LFO]/LF_Amount$
		}
	}
}

//Add Xenon
@PART[*]:HAS[@MODULE[SFS_LFO]:HAS[#LFO_Add_Xe[true]]]
{
	MODULE
	{
		name = ModuleSwitchableResources
		resourcesId = xenon_only
		displayName = #SimpleFuelSwitch_Xenon
		selectorFieldName = #SimpleFuelSwitch_fuelTypeLabel
		RESOURCE
		{
			name = XenonGas
			amount = #$/MODULE[SFS_LFO]/LF_Amount$
			@amount += #$/MODULE[SFS_LFO]/Ox_Amount$
			@amount *= 50
			maxAmount = #$/MODULE[SFS_LFO]/LF_MaxAmount$
			@maxAmount += #$/MODULE[SFS_LFO]/Ox_MaxAmount$
			@maxAmount *= 50
		}
	}
}

//MonoProp tanks
//Add default fuel
@PART[*]:HAS[@MODULE[SFS_MONO],@MODULE[ModuleSimpleFuelSwitch]]
{
	MODULE
	{
		name = ModuleSwitchableResources
		resourcesId = mono_only
		displayName = #SimpleFuelSwitch_Mono
		selectorFieldName = #SimpleFuelSwitch_fuelTypeLabel
		isDefault = true
		RESOURCE
		{
			name = MonoPropellant
			amount = #$/MODULE[SFS_MONO]/Mono_Amount$			
			maxAmount = #$/MODULE[SFS_MONO]/Mono_MaxAmount$		
		}		
	}
}

//Add LF_Only
@PART[*]:HAS[@MODULE[SFS_MONO]:HAS[#Mono_Add_LF[true]]]
{
	MODULE
	{
		name = ModuleSwitchableResources
		resourcesId = liquid_fuel_only
		displayName = #SimpleFuelSwitch_LiquidFuel
		selectorFieldName = #SimpleFuelSwitch_fuelTypeLabel
		RESOURCE
		{
			name = LiquidFuel
			amount = #$/MODULE[SFS_MONO]/Mono_Amount$	
			@amount *= 0.8
			maxAmount = #$/MODULE[SFS_MONO]/Mono_MaxAmount$	
			@maxAmount *= 0.8
		}
	}
}

//Add LFO
@PART[*]:HAS[@MODULE[SFS_MONO]:HAS[#Mono_Add_LFO[true]]]
{
	MODULE
	{
		name = ModuleSwitchableResources
		resourcesId = liquid_fuel_oxidizer
		displayName = #SimpleFuelSwitch_LiquidFuelAndOxidizer
		selectorFieldName = #SimpleFuelSwitch_fuelTypeLabel
		RESOURCE
		{
			name = LiquidFuel
			amount = #$/MODULE[SFS_MONO]/Mono_Amount$	
			@amount *= 0.36
			maxAmount = #$/MODULE[SFS_MONO]/Mono_MaxAmount$	
			@maxAmount *= 0.36
		}
		RESOURCE
		{
			name = Oxidizer
			amount = #$/MODULE[SFS_MONO]/Mono_Amount$	
			@amount *= 0.44
			maxAmount = #$/MODULE[SFS_MONO]/Mono_MaxAmount$	
			@maxAmount *= 0.44
		}
	}
}

//Add Ox_Only
@PART[*]:HAS[@MODULE[SFS_MONO]:HAS[#Mono_Add_Ox[true]]]
{
	MODULE
	{
		name = ModuleSwitchableResources
		resourcesId = oxidizer_only
		displayName = #SimpleFuelSwitch_OxOnly
		selectorFieldName = #SimpleFuelSwitch_fuelTypeLabel
		RESOURCE
		{
			name = Oxidizer
			amount = #$/MODULE[SFS_MONO]/Mono_Amount$	
			@amount *= 0.44
			@amount /= 0.45
			maxAmount = #$/MODULE[SFS_MONO]/Mono_MaxAmount$	
			@maxAmount *= 0.44
			@maxAmount /= 0.45
		}
	}
}

//Add Xenon
@PART[*]:HAS[@MODULE[SFS_MONO]:HAS[#Mono_Add_Xe[true]]]
{
	MODULE
	{
		name = ModuleSwitchableResources
		resourcesId = xenon_only
		displayName = #SimpleFuelSwitch_Xenon
		selectorFieldName = #SimpleFuelSwitch_fuelTypeLabel
		RESOURCE
		{
			name = XenonGas
			amount = #$/MODULE[SFS_MONO]/Mono_Amount$	
			@amount *= 40
			maxAmount = #$/MODULE[SFS_MONO]/Mono_MaxAmount$	
			@maxAmount *= 40
		}
	}
}

//Xenon tanks
//Add default fuel
@PART[*]:HAS[@MODULE[SFS_XENON],@MODULE[ModuleSimpleFuelSwitch]]
{
	MODULE
	{
		name = ModuleSwitchableResources
		resourcesId = xenon_only
		displayName = #SimpleFuelSwitch_Xenon
		selectorFieldName = #SimpleFuelSwitch_fuelTypeLabel
		isDefault = true
		RESOURCE
		{
			name = XenonGas
			amount = #$/MODULE[SFS_XENON]/Xe_Amount$			
			maxAmount = #$/MODULE[SFS_XENON]/Xe_MaxAmount$
		}
	}
}

//Add LF_Only
@PART[*]:HAS[@MODULE[SFS_XENON]:HAS[#Xe_Add_LF[true]]]
{
	MODULE
	{
		name = ModuleSwitchableResources
		resourcesId = liquid_fuel_only
		displayName = #SimpleFuelSwitch_LiquidFuel
		selectorFieldName = #SimpleFuelSwitch_fuelTypeLabel
		RESOURCE
		{
			name = LiquidFuel
			amount = #$/MODULE[SFS_XENON]/Xe_Amount$
			@amount *= 0.02
			maxAmount = #$/MODULE[SFS_XENON]/Xe_MaxAmount$
			@maxAmount *= 0.02
		}
	}
}

//Add LFO
@PART[*]:HAS[@MODULE[SFS_XENON]:HAS[#Xe_Add_LFO[true]]]
{
	MODULE
	{
		name = ModuleSwitchableResources
		resourcesId = liquid_fuel_oxidizer
		displayName = #SimpleFuelSwitch_LiquidFuelAndOxidizer
		selectorFieldName = #SimpleFuelSwitch_fuelTypeLabel
		RESOURCE
		{
			name = LiquidFuel
			amount = #$/MODULE[SFS_XENON]/Xe_Amount$
			@amount *= 0.009
			maxAmount = #$/MODULE[SFS_XENON]/Xe_MaxAmount$
			@maxAmount *= 0.009
		}
		RESOURCE
		{
			name = Oxidizer
			amount = #$/MODULE[SFS_XENON]/Xe_Amount$
			@amount *= 0.011
			maxAmount = #$/MODULE[SFS_XENON]/Xe_MaxAmount$
			@maxAmount *= 0.011
		}
	}
}

//Add MonoProp
@PART[*]:HAS[@MODULE[SFS_XENON]:HAS[#Xe_Add_Mono[true]]]
{
	MODULE
	{
		name = ModuleSwitchableResources
		resourcesId = mono_only
		displayName = #SimpleFuelSwitch_Mono
		selectorFieldName = #SimpleFuelSwitch_fuelTypeLabel
		RESOURCE
		{
			name = MonoPropellant
			amount = #$/MODULE[SFS_XENON]/Xe_Amount$
			@amount *= 0.025
			maxAmount = #$/MODULE[SFS_XENON]/Xe_MaxAmount$
			@maxAmount *= 0.025
		}
	}
}

//Add Ox_Only
@PART[*]:HAS[@MODULE[SFS_XENON]:HAS[#Xe_Add_Ox[true]]]
{
	MODULE
	{
		name = ModuleSwitchableResources
		resourcesId = oxidizer_only
		displayName = #SimpleFuelSwitch_OxOnly
		selectorFieldName = #SimpleFuelSwitch_fuelTypeLabel
		RESOURCE
		{
			name = Oxidizer
			amount = #$/MODULE[SFS_XENON]/Xe_Amount$
			@amount *= 0.011
			@amount /= 0.45
			maxAmount = #$/MODULE[SFS_XENON]/Xe_MaxAmount$
			@maxAmount *= 0.011
			@maxAmount /= 0.45
		}
	}
}

Basically:

  • I'm writing the config values into a dummy module
  • add this module to each tank that is supposed to be changed (so I can use the name of the dummy module in the filter)
  • If at least one of these values is true, add the module 'ModuleSimpleFuelSwitch'
  • If the dummy module AND ModuleSimpleFuelSwitch is available, add the default fuel type
  • If the dummy module is available, add other fuels as well
  • (Missing so far: remove stock resource entries and the dummy modules after everything is done)

So my questions so far:

Is it possible to multiply factions of numbers, so I can simplify terms like this:

maxAmount = #$/MODULE[SFS_XENON]/Xe_MaxAmount$
@maxAmount *= 0.011
@maxAmount /= 0.45

This 'OR' query does not work properly and actually just checks the very first value (:HAS[#LF_Add_LFO[true] in this case):

@PART[*]:HAS[@MODULE[SFS_LF]:HAS[#LF_Add_LFO[true]]|[#LF_Add_Ox[true]]|[#LF_Add_Mono[true]]|[#LF_Add_Xe[true]]]

I cannot figure out what's wrong there...ideas?

In general: Is this a proper approach? Does it make sense to split the patch in these small steps? Any suggestions for improvements? :)

edit:

Apparently, using the 'OR' operator in a :HAS block will only parse the first value:

@PART[*]:HAS[@MODULE[SFS_LF]:HAS[#LF_Add_LFO[true]]|@MODULE[SFS_LF]:HAS[#LF_Add_Ox[true]]]

^ this doesn't work.

BUT, the 'AND' operator works fine, so:

@PART[*]:HAS[@MODULE[SFS_LF]:HAS[!#LF_Add_LFO[false]],@MODULE[SFS_LF]:HAS[!#LF_Add_Ox[false]]]

^ will do the job.

Basically, I cannot check multiple entries to be 'true' but I can check multiple values to be not 'false'. Sounds like a bug to me :o

Nope, still doesn't work if both values are 'false'

Edited by 4x4cheesecake
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...