sarbian

[1.4.0-1.7.x] Module Manager 4.0.3 (August 9th 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
15 hours ago, 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.

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

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.