Skip to content

Instantly share code, notes, and snippets.

@KatiaCooksCakes
Created June 19, 2016 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KatiaCooksCakes/83ec7a7e241b3b47c9184bed49641e7b to your computer and use it in GitHub Desktop.
Save KatiaCooksCakes/83ec7a7e241b3b47c9184bed49641e7b to your computer and use it in GitHub Desktop.
//Manual Configs
KATIA_RESCALECONFIG //All names start with KATIA_ to avoid possible conflicts with other mods that might want to change the scale of things...
{
name = Default
engineScaleFactor = 1.5 //This factor works well for the F-1 engine. May need more intricate adjustments
}
KATIA_RESCALECONFIG
{
name = Merlin
engineScaleFactor = 1.3 //This factor needs to bit smaller to fit 9 engines on a 3.7m stage
thrustScaleFactor = 1.4 //Also, the engine seems a bit underpowered for its size. Increasing the thrust makes it fit in better
}
//Calculating additional values
@KATIA_RESCALECONFIG[*]
{
thrustScaleFactor = #$engineScaleFactor$ //creates the value thrustScaleFactor to scale the thrust with the engine's zize. This creates a duplicate thrustScaleFactor if it's defined above. That should not be a problem, as MM always works with the first defined value unless told else.
@thrustScaleFactor,0 != 2 //squares thrustScaleFactor, so that thrust increases proportionally with nozzle area. Uses the first thrustScaleFactor, just to be sure.
}
//Selecting parts
@PART[*]:HAS[@MODULE[SSTUModularEngineCluster]]:After[SSTU]
{
KATIA_RESCALER
{
engineScaleFactor = #$@KATIA_RESCALECONFIG[Default]/engineScaleFactor$
thrustScaleFactor = #$@KATIA_RESCALECONFIG[Default]/thrustScaleFactor$ //Takes the engineScaleFactor and thrustScaleFactor defined in the default rescaleconig above and applies them to the matching parts.
}
}
@PART[SSTU-SC-ENG-Merlin-*]:HAS[@MODULE[SSTUModularEngineCluster]]:After[SSTU]
{
%KATIA_RESCALER
{
%engineScaleFactor = #$@KATIA_RESCALECONFIG[Merlin]/engineScaleFactor$
%thrustScaleFactor = #$@KATIA_RESCALECONFIG[Merlin]/thrustScaleFactor$
}
@tags ^= :$:, merlin: //For some reason the Merlin engines can't be found through the integrated search. Adding this tag to the part should fix that.
}
//Applying the Patches
@PART[*]:HAS[@KATIA_RESCALER]:FINAL
{
@description ^= :$: Rescaled to fit the larger solar system scale.:
@MODULE[SSTUModularEngineCluster]
{
@engineScale *= #$../KATIA_RESCALER/engineScaleFactor$ //this moves up a node (from MODULE[SSTUModularEngineCluster] to PART) and selects the engineScaleFactor saved in KATIA_RESCALER on the same part. The part's default value should be 1, so multiplying and overwriting should do the same, but multiplying is more flexible.
}
@MODULE[ModuleEnginesFX]
{
@maxThrust *= #$../KATIA_RESCALER/thrustScaleFactor$ //Same as with engineScaleFactor, but this time the thrust has to be multiplied , or else it will be absolutely tiny.
} //The engine's mass wil be ignored for now, as SSTU seems to have chosen relatively high but arbitrary values fot that.
}
//Cleanup
@PART[*]:HAS[@KATIA_RESCALER[*]]:FINAL
{
!KATIA_RESCALER[*] {} //deletes the nodes containing the rescale after finished work data from the parts to reduce clutter.
}
//Notes
//I split the patches in the way I did to allow for greater flexibility when changing the parts' values. Should I decide I want to tinker with the mass or heat production of some of the engines for example, I can easily add the appropriate patches without having to add tem to every engine.
//Also, should I decide I want to tweak other engines in the future, this can easily achieved by adding the code to the 'applying the patches' section without having to rework the other parts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment