sarbian

[1.8.x] Module Manager 4.1.0 (October 16th 2019) - Right To Ludicrous Speed

Recommended Posts

So I've been learning how to manipulate CFGs using MM over the last month and I think I have it down pretty good, but I'd like another set of eyes to look over my understanding of how things work. (old programmer habits die hard)

Here is a sample of a MM edit I'm working on. This one should remove the ability for K&K nuclear reactors and centrifuges to store their own fuel and byproducts. (thus forcing the player to actually use the storage tanks) If someone could verify my code before I commit it I'd appreciate it!

@PART[KKAOSS_Centrifuge|KKAOSS_Nuclear_Reactor]:NEEDS[PlanetarySurfaceStructures]:FOR[RemodeledTechTree]
{
	!Resource,* {} // Remove all resources from the parts
	!MODULE:HAS[#name[ModuleKPBSNuclearStorage]] // Remove the Nuclear Storage Module from the parts
	@MODULE:HAS[#name[ModuleResourceConverter]] // Find all Resource Converter Modules
	{
		@INPUT_RESOURCE:HAS[#FlowMode[NO_FLOW]] // Find all NO_FLOW FlowModes within Input Resources within all Resource Converter Modules
		{
			@FlowMode = STAGE_PRIORITY_FLOW // Replace all NO_FLOW Flowmodes with STAGE_PRIORITY_FLOW
           			 			// This allows the resources to move to and from the storage tanks
		}
		@OUTPUT_RESOURCE:HAS[#FlowMode[NO_FLOW]] // Same as above but for Output Resources
		{
			@FlowMode = STAGE_PRIORITY_FLOW
		}
	}
}

Any pointers if I messed something up would be appreciated! Thanks!

Share this post


Link to post
Share on other sites
8 hours ago, RobertaME said:

!Resource,* {}

RESOURCE nodes in parts are all caps, it is case sensitive

8 hours ago, RobertaME said:

!MODULE:HAS[#name[ModuleKPBSNuclearStorage]]

This can be simplified to !MODULE[ModuleKPBSNuclearStorage], also you need brackets after it for it to be recognized as a node (as with !RESOURCE,* {})

8 hours ago, RobertaME said:

@MODULE:HAS[#name[ModuleResourceConverter]]

As above :)

Share this post


Link to post
Share on other sites

Thank you! That did the trick! Code now looks like this...

// KPBS Nuclear Reactor & Centrifuge without internal fuels (to mandate the use of storage tanks)
@PART[KKAOSS_Centrifuge|KKAOSS_Nuclear_Reactor]:NEEDS[PlanetarySurfaceStructures]:FOR[RemodeledTechTree]
{
	!RESOURCE,* {}						// Remove all resources from the parts
	!MODULE[ModuleKPBSNuclearStorage] {}			// Remove the Nuclear Storage Module from the parts
	@MODULE[ModuleResourceConverter]			// Find all Resource Converter Modules
	{
		@INPUT_RESOURCE:HAS[#FlowMode[NO_FLOW]]		// Find all NO_FLOW FlowModes within Input Resources within all Resource Converter Modules
		{
			@FlowMode = STAGE_PRIORITY_FLOW		// Replace all NO_FLOW Flowmodes with STAGE_PRIORITY_FLOW
		}						// This allows the resources to move to and from the storage tanks
		@OUTPUT_RESOURCE:HAS[#FlowMode[NO_FLOW]]	// Same as above but for Output Resources
		{
			@FlowMode = STAGE_PRIORITY_FLOW
		}
	}
}

...which in-game now looks like this...

bAzgbP3.jpg

https://imgur.com/a/olve3n3

 

Share this post


Link to post
Share on other sites

Got a Few Questions About How to edit in game sound.

Is this the correct Syntax?
 

@PART[*]:HAS[@MODULE[ModuleDecouple]
{
	@PART
			{
			@sound_decoupler_fire = Squad/Sounds/decoupleFire_1
			}
}
Edited by IronKerbal

Share this post


Link to post
Share on other sites
On 9/15/2019 at 2:24 AM, IronKerbal said:

 


@PART[*]:HAS[@MODULE[ModuleDecouple]]
{
		@sound_decoupler_fire = Squad/Sounds/decoupleFire_1
}

 

@PART already looks for the part and defines which part you want to edit.

If the sound is placed into another MODULE - just as an example! - like DECOUPLER, then you would have to add a @DECOUPLER, if it is just written on the same level as name, weight etc., you do not need to. So, your second @PART and its { }  should be removed.

Edited by KerbMav
added a missing bracket

Share this post


Link to post
Share on other sites
19 hours ago, IronKerbal said:

@PART:HAS[@MODULE[ModuleDecouple]]
{
	@sound_decoupler_fire = Squad/Sounds/decoupleFire_1
}

 

I made a couple of edits, as KerbMav said you don't want the nested @PART nodes, also you were missing a bracket.  The [*] after @PART is fine but also isn't necessary, it basically says "has some name value" which all PART nodes do

Edited by blowfish

Share this post


Link to post
Share on other sites

Ok thanks! Im gonna try that out now.

I will let you know if anything goes wrong.

Share this post


Link to post
Share on other sites

When I Applied the Config to Ksp, The decoupler Sound was Non-Existent.
 
Do you know why is that so?

Edited by IronKerbal

Share this post


Link to post
Share on other sites
52 minutes ago, IronKerbal said:

When I Applied the Config to Ksp, The decoupler Sound was Non-Existent.
 
Do you know why is that so?

I'm not too familiar with this module.  A good place to start would be to check ModuleManager.ConfigCache and ensure that the final configs look the way you want them to (including spelling and capitalization)

Share this post


Link to post
Share on other sites
1 hour ago, IronKerbal said:

When I Applied the Config to Ksp, The decoupler Sound was Non-Existent.
 
Do you know why is that so?

Looking at the Squad parts, I see lines like this in their parts .cfg files at the first level:

	sound_decoupler_fire = decouple

I can't find any file that fits the template "decouple.*" under "GameData/Squad/".  So it might be referencing something elsewhere, like one of the asset files.  Or it may be referring to the stock decoupler sound file but with only a partial file name.

The file "GameData/Squad/Sounds/sound_decoupler_fire.wav" does exist and sure sounds like the stock sound.

I would advice doing what @blowfish suggested and checking the stock parts in "ModuleManager.ConfigCache" to see if what should be happening is happening.  I'd also suggest trying these two MM .cfg's to see what an explicit reference to the stock sound does.

This one assumes there may be special handling of the value if it just appears to be a file name and not a relative pathname.

@PART:HAS[@MODULE[ModuleDecouple]]
{
	@sound_decoupler_fire = sound_decouple_fire
}

This one tries the relative pathname to the stock file.

@PART:HAS[@MODULE[ModuleDecouple]]
{
	@sound_decoupler_fire = Squad/Sounds/sound_decouple_fire
}

Share this post


Link to post
Share on other sites

was just going to say that that belongs on the top level - might I suggest using a % or & instead of the @?

@PART:HAS[@MODULE[ModuleDecouple]]:AFTER[SQUAD]
{
	&sound_decoupler_fire = Squad/Sounds/sound_decouple_fire
}

 

Edited by zer0Kerbal

Share this post


Link to post
Share on other sites
10 minutes ago, zer0Kerbal said:

was just going to say that that belongs on the top level - might I suggest using a % or & instead of the @?


@PART:HAS[@MODULE[ModuleDecouple]]:AFTER[SQUAD]
{
	&fx_gasBurst_white = 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, decouple
}

 

Excellent! I didn't know about that. Someone should add it to the Module Manager's Handbook and Syntax!

Share this post


Link to post
Share on other sites
1 hour ago, Jacke said:

sound_decoupler_fire = Squad/Sounds/sound_decouple_fire

 

oops should have been

sound_decoupler_fire = Squad/Sounds/sound_decouple_fire

I was just working on other patches for decouplers- and making a shielded PicoPortBasic when I saw this and the copy paste went sideways - :P

Share this post


Link to post
Share on other sites

So I tried some the decoupler sound modifer and it did nothing:(
Same sound.

I will try the fx editor now
 

 

Edited by IronKerbal

Share this post


Link to post
Share on other sites

I have a weird problem to report. I've not come across other examples of this on the forums. 

Module Manager causes clean installations to crash on start; apparently after loading resources - during the part loading phase. This is the case with every clean install of KSP I attempt; no mods except module manager. Installations boot without; then crash when module manager is introduced. Notably, the install becomes corrupted (in some un-obvious way) - it will continue to crash in the exact same way - even after module manger is removed. 

This replicates across every clean install I have attempted; I redownload each from Steam - so it is always a blank copy. With or without Making History. I've tried both 4.0.3 and 4.0.2. KSP is the latest version, 1.7.3.

 

This is one of my logs. Based on a clean install; which was booted once without module manager. Crashes after module manager is added. And continues to crash after module manager is removed. 

https://drive.google.com/file/d/1Sgy1iEaJhd2wbqRR4FUZz3KFmFg9Xv4n/view?usp=sharing

 

Please help! In all my years of playing I've never had anything but the best experience with module manager. 

Edited by MulDoom

Share this post


Link to post
Share on other sites
2 hours ago, MulDoom said:

I have a weird problem to report. I've not come across other examples of this on the forums. 

Module Manager causes clean installations to crash on start; apparently after loading resources - during the part loading phase. This is the case with every clean install of KSP I attempt; no mods except module manager. Installations boot without; then crash when module manager is introduced. Notably, the install becomes corrupted (in some un-obvious way) - it will continue to crash in the exact same way - even after module manger is removed. 

This replicates across every clean install I have attempted; I redownload each from Steam - so it is always a blank copy. With or without Making History. I've tried both 4.0.3 and 4.0.2. KSP is the latest version, 1.7.3.

 

This is one of my logs. Based on a clean install; which was booted once without module manager. Crashes after module manager is added. And continues to crash after module manager is removed. 

https://drive.google.com/file/d/1Sgy1iEaJhd2wbqRR4FUZz3KFmFg9Xv4n/view?usp=sharing

 

Please help! In all my years of playing I've never had anything but the best experience with module manager. 

@MulDoomI dont see any Fatals or errors or even warnings in the log! It must be something in the Computer itself...
So, I cant really do anything about this, sorry...

Share this post


Link to post
Share on other sites

@MulDoom

Clarify please:

By crash you mean the program exited? Or freeze?

You installed Module Manager and it crashed and then you removed Module Manager and it still crashes? 

Or to rephrase that last part: You were able to run it once without Module Manager. Did you try running it twice in a row without Module Manager? (i.e. run the game, get to the main menu. Exit game. Run the game a 2nd time)

One last question: Did you verify the integrity of your game files? (in the steam library, right click Kerbal Space Program and then click properties at the bottom of the menu that pops up. Click the Local Files tab. Then click button that says 'VERIFY INTEGRITY OF GAME FILES...')

Share this post


Link to post
Share on other sites

T

10 minutes ago, Starwaster said:

By crash you mean the program exited? Or freeze?

The program exited. No error is thrown. It silently 'crashes'.

 

10 minutes ago, Starwaster said:

You were able to run it once without Module Manager. Did you try running it twice in a row without Module Manager? (i.e. run the game, get to the main menu. Exit game. Run the game a 2nd time)

Yes. I can open the fresh (validated) installs several times in a row. Once module manager is added to gamedata that install never works again however. It silently crashes (exits) at the same spot every time. 

10 minutes ago, Starwaster said:

One last question: Did you verify the integrity of your game files? (in the steam library, right click Kerbal Space Program and then click properties at the bottom of the menu that pops up. Click the Local Files tab. Then click button that says 'VERIFY INTEGRITY OF GAME FILES...')

Yes. I've actually deleted it several times. This problem persists with fresh installs. 

 

It's really weird, right? Maybe it is my computer. But I've also isolated a causal relationship. 

Edited by MulDoom

Share this post


Link to post
Share on other sites

@MulDoom

Try this. Reproduce the problem as you have been so that you get it into a state where it's crashing. Then delete Module Manager dll and all of the files it created (just to be thorough)

Then go back to the main KSP folder and rename PartDatabase.cfg to PartDatabase.txt (rename, don't delete because last step)

Run KSP. If it doesn't crash then submit the PartDatabase.txt file here. And the new PartDatabase.cfg file that got created.

Honestly, this sounds like an old bug from a few months back which was actually a stock bug triggered by Module Manager but which did not actually require Module Manager to trigger

Edited by Starwaster

Share this post


Link to post
Share on other sites

@Starwaster Running Module Manager for the first time deletes 'PartDatabase.cfg'. It is not recreated. 

I now see 'PartDatabase.cfg' files are missing from all my broken installs. This missing file is the cause of the crashing. 

I can recopy a vanilla 'PartDatabase.cfg'' into a broken install; this gets Vanilla + Module Manager (only) to load. However, adding any part mod creates crashes. 

 

Its only the first time Module Manager is run that  'PartDatabase.cfg' gets disappeared. Or when a mod that adds parts is installed. When either of those situations occurs  'PartDatabase.cfg' is deleted and not recreated.

 

I've tried install locations on different drives, for what its worth. And run the executable as an administrator. And previous installs I have discovered load fine - those are MM 4.0.2 1.7.0 JNSQ experiments FWIW.

 

I am pretty stumped. I appreciate your help. 

Edited by MulDoom

Share this post


Link to post
Share on other sites

@MulDoom could you get output_lot.txt?  It tends to include some info about actual crashes that KSP.log doesn't.  It should be in AppData\LocalLow\Squad\Kerbal Space Program\ from your home directory

Share this post


Link to post
Share on other sites

@blowfish

https://drive.google.com/file/d/1lTpUato7hVzonI66Hia_JqsiGTcrJdfG/view?usp=sharing

 

The only mod I have installed in Inline Ballute [KERMANGEDDONINDUSTRIES]. This is to provoke the crash. 

 

 

 

PartLoader: Creating part database
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

PartLoader: Compiling Part 'KermangeddonIndustries/InlineBallutes/Ballute062/InlineBallute062'
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

EffectList: Created 15 effect types
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

Cannot find a PartModule of typename 'ModuleAeroReentry'
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

PartLoader: Part 'KermangeddonIndustries/InlineBallutes/Ballute062/InlineBallute062' has no database record. Creating.
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

DragCubeSystem: Creating drag cubes for part 'InlineBallute062'
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

Crash!!!
Edited by MulDoom

Share this post


Link to post
Share on other sites
14 minutes ago, MulDoom said:

@blowfish

https://drive.google.com/file/d/1lTpUato7hVzonI66Hia_JqsiGTcrJdfG/view?usp=sharing

 

The only mod I have installed in Inline Ballute. This is to provoke the crash. 

Yeah, so somehow Unity itself is crashing.  It does seem to be somehow related to PartDatabase.cfg though ... all ModuleManager does is remove that file forcing KSP to regenerate it, which usually works fine, I admittedly don't know what could be different on your system.  Does anyone else here have more insight?

Share this post


Link to post
Share on other sites

Do you have msi afterburner or a similar overlay? With the last windows update it can crash some DX9 apps 

Share this post


Link to post
Share on other sites

@MulDoom Are there any folders being added in your KSP folder after it crashes? (the folder name will start with the date of the crash). If so they will have some additional error information in the files, including a memory dump file. (which I'm really not up for debugging one of those right now...) Also, have you rebooted your computer since this started happening? If not then do that. I've had weird crashes before that were resolved by rebooting.

@blowfish Assuming restarting his PC doesn't help, my next guess would be mono files somewhere that they don't belong; duplicate dlls with mismatched versions.

Share this post


Link to post
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.