Notice
If you are using KSP 1.9.x, KSP 1.11.x or KSP 1.12.x you need to install KSP Recall.
(Now also on CurseForge!))
TweakScale lets you change the size of a part. Not just that, but it will figure out how much fuel is in the resized part. And if it's an engine, it will become more powerful by scaling it bigger, or weaker by scaling it smaller.
This plugin was initially made by Gaius Goodspeed, and I heartily recommend you also take a look at his parts.
TweakScale is already used by Gaius' parts above, and ZodiusInfuser's Infernal Robotics model rework, which I also recommend to anyone who likes having fun.
TweakScale uses Swamp-Ig's KSPAPIExtensions.
TweakScale is made available under the terms of the Creative Commons Attribution-NonCommercial-ShareAlike license.
Forum page
Source on GitHub
Current Version: 1.20 (2014-06-12 22:15 UTC)
From Version 1.5.0.1, KSPAPIExtensions.dll should no longer reside in GameData, but in Gamedata/TweakScale/Plugins. If you have a KSPAPIExtensions.dll in your Gamedata/ folder, please delete it.
Please add TweakScale to your mod!
If you are a mod author and you want to bundle TweakScale with your mod, please do! A few notes:
- Please place your TweakScale .cfgs in your mod's folder, not in the TweakScale folder. This way users can delete TweakScale and install a new version without breaking your mod.
- If your mod is already on the list of supported mods, please post here or PM me, and I will remove support, giving you full control over the .cfgs.
Anyways, features:
Scaling Control
You as the author of a part or addon get complete control over which parts you want to offer in which sizes. Should that fuel tank only be available in size 2.5m and 3.75m? Make it so! That RCS thruster on the other hand, could be scalable freely between half regular scale and double regular scale.
Mass Control
For heavy, solid parts, mass increases with the cube of the scale - you scale it in three dimensions, after all. For parts that are a thin layer of aluminium plates over a rigid skeleton - like fairings, crew compartments, empty fuel tanks - mass probably scales closer to the square of the scale.
Rescales Stock parts
Engines, RCS thrusters, fuel tanks, boosters, reaction wheels, air intakes, control surfaces and solar panels are supported, and have their physical properties updated to sensible values when rescaled.
Integration with Modular Fuel Tanks, Real Fuels and KSP Interstellar
TweakScale correctly changes fuel volumes on tanks using Modular Fuel Tanks and Real Fuels. It correctly adjusts power output, waste heat, microwave transmission and other stuff for KSP Interstellar parts. Thus far, the following are supported:
- Solar Sails
- Microwave Receivers
- Atmospheric Scoops
- Atmospheric Intakes
- Heat Radiators
- Alcubierre Drives
- Engines (Except the Vista Engine)
- Antimatter Storage Tanks
- Generators
- Fusion Reactors
Fission reactors, antimatter reactors and antimatter-initiated reactors are not yet supported. (Awaiting better formulae for those and the Vista engine)
How to Use
First add a part that's the wrong size:
Right click:
See how it says 3.75m? Well, the command capsule is 2.5m, so let's change it. You do this by pressing the << >> buttons or dragging the slider.
See how well it fits?
Examples
For a part that should be available in 62.5cm, 1.25m, 2.5m, 3.75m and 5m configurations, and by default is 1.25m, use the following definition:
MODULE { name = TweakScale defaultScale = 1.25 type = stack }
If the part should instead be freely rescalable, use this:
MODULE { name = TweakScale type = free }
And for a part that should be available in 25%, 50%, 100% and 200% scales, use:
MODULE { name = TweakScale type = surface }
But I said you had full control of scales, didn't I? If you want your parts to be available only in 2.5m and 3.75m versions, use this definition:
MODULE { name = TweakScale type = stack scaleFactors = 2.5, 3.75 scaleNames = 2.5m, 3.75m }
If your mod has a collection of parts that will all be available in the same set of sizes, you might want to make your own scale type:
SCALETYPE { name = MyMod freeScale = false massFactors = 0.0, 0.0, 1.0 scaleFactors = 0.5, 1.0, 2.0 scalenames = Small, Medium, Large defaultScale = 1.0 }
After defining this once, you can then start using it for your parts:
MODULE { name = TweakScale type = MyMod }
As you can see the scale type uses the same names as the module definition, and they can even inherit from other scale types (if you want to change just a small detail).
Adding module support
You can now add support for your own modules! For a simple module that's happy with having its values changed when OnLoad is called, this is how:
TWEAKSCALEEXPONENTS { name = MyPartModule flooberRate = 2 }
When a user rescales a part with a MyPartModule module, TweakScale will automatically update the flooberRate of the part with the square of the scale (so if it's a 2.5m part and it's scaled to 3.75m, the flooberRate will be 2.25 times its usual value [3.75/2.5 = 1.5; 1.5^2 = 2.25]).
New in 1.10 is the ability to change fields of fields - that is, myPartModule.someStruct.value or myPartModule.someList[x]:
TWEAKSCALEEXPONENTS { name = ModuleGenerator outputList { rate = 3 } }
The above config will scale all members of the list outputList on ModuleGenerator, to the cube of the current scale.
Note that this system works for any depth:
TWEAKSCALEEXPONENTS { name = ModuleMyModule foo { bar { quxRate = 3 } } }
The above would scale ModuleMyModule.foo[x].bar.quxRate.
New in 1.19 is tech requirements:
MODULE { name = TweakScale type = stack techRequired = basicRocketry, start, generalRocketry, advRocketry, heavyRocketry }
Here, each option in the stack SCALETYPE will be unlocked by a corresponding tech. If there are fewer techRequired than scaleNames/scaleFactors, the unmatched scales will be unlocked by default.
It might be that your module would benefit more from using a list of values than an exponent. In that case, you may specify the list in the tweakscale module statement in the .cfg:
MODULE { name = TweakScale type = stack defaultScale = 3.75 MODULE { name = ModuleEngines maxThrust = 1, 2, 3, 4, 5 } }
Here, a 62.5cm version would have a maxThrust of 1, 1.25m would be 2, and so on until the 5m version has a maxThrust of 5.
If more advanced logic is required, TweakScale offers an IRescalable interface. Its definition is as follows:
public interface IRescalable { void OnRescale(ScalingFactor factor); }
ScalingFactor has the properties 'absolute' and 'relative'. Most likely, you want to use absolute. relative is the change in scale since last time OnRescale was called, while absolute is the change in scale in relation to defaultScale. absolute and relative have properties linear, quadratic, cubic and squareRoot, which are shorthands for different scaling factors.
IRescalable can be used in conjunction with .cfg exponents. In that case, TweakScale will first call IRescalable's OnRescale, followed by updates from .cfgs. (this may be changed in the future, as I'm not sure it's the best solution)
Due to limitations in .NET, an IRescalable either has to be implemented in an assembly of its own, or the entire assembly will be made dependent on TweakScale.
An example implementation of an IRescalable may be:
class MyModuleUpdater : TweakScale.IRescalable { MyPartModule _module; public MyModuleUpdater(MyPartModule module) { _module = module; } public void OnRescale(TweakScale.ScalingFactor factor) { _module.flooberRate = _module.flooberRate * factor.relative.quadratic; _module.ReactToFlooberRate(13); } }
and the new updater may be registered with TweakScale thusly:
[KSPAddon(KSPAddon.Startup.EditorAny, false)] internal class MyEditorRegistrationAddon : TweakScale.RescalableRegistratorAddon { public override void OnStart() { TweakScale.TweakScaleUpdater.RegisterUpdater((MyPartModule mod) => new MyModuleUpdater(mod)); } } [KSPAddon(KSPAddon.Startup.Flight, false)] internal class MyFlightRegistrationAddon : TweakScale.RescalableRegistratorAddon { public override void OnStart() { TweakScale.TweakScaleUpdater.RegisterUpdater((MyPartModule mod) => new MyModuleUpdater(mod)); } }
For an example implementation, check out how Real Fuels support is implemented.
In case someone's confused:
- MODULE { name = TweakScale ... } goes in the PART you want scalable. (or a ModuleManager .cfg, of course)
- TWEAKSCALEEXPONENTS and SCALETYPE go top-level in some .cfg. It doesn't matter which, it doesn't matter where. As long as it's called .cfg and is somewhere in gamedata, it'll be correctly registered. The suggested location is Gamedata/MyMod/MyMod_TweakScale.cfg
Version History:
Version 1.20 (2014-06-12 22:15 UTC)
- New algorithm for rescaling attach nodes. Tell me what you think!
- Added Deadly Reentry Continued and Large Structural/Station Components.
1.19 (2014-06-06 10:56 UTC)
- Added support for tech requirements for non-freeScale parts.
1.18 (2014-06-04 00:58 UTC)
- Factored out Real Fuels and Modular Fuel Tanks support to separate dlls.
1.17 (2014-06-03 22:21 UTC)
- Fixed bug where attachment nodes were incorrectly scaled after reloading. This time with more fix!
- Added support for Near Future Technologies.
1.16 (2014-06-03 21:31 UTC)
- Fixed bug where attachment nodes were incorrectly scaled after reloading.
1.15 (2014-06-03 20:50 UTC)
- Finally squished the bug where crafts wouldn't load correctly. This bug is present in 1.13 and 1.14, and affects certain parts from Spaceplane+, MechJeb, and KAX.
1.14 (2014-06-03 19:50 UTC)
- Fixed a bug where nodes with the same name were moved to the same location regardless of correct location. (Only observed with KW fairing bases, but there could be others)
1.13 (2014-06-02 18:25 UTC)
- Added support for MechJeb, Kerbal Aircraft eXpanion, Spaceplane+, Stack eXTensions, Kerbal Attachment System, Lack Luster Labs, Firespitter, Taverio's Pizza and Aerospace, Better RoveMates, and Sum Dum Heavy Industries Service Module System.
- Fixed a bug where Modular Fuel Tanks were not correctly updated.
1.12 (2014-06-02 11:10 UTC)
- Added support for КОСМОС.
- No longer scaling heatDissipation, which I was informed was a mistake.
1.11 (2014-06-01 20:24 UTC)
- Removed silly requirement of 'name = *' for updating all elements of a list.
- Added .cfg controlled scaling of Part fields.
1.10 (2014-06-01 14:53 UTC)
- Added support for nested fields.
1.9 (2014-05-31 00:57 UTC)
- Fixed a bug where rescaleFactor caused erroneous scaling.
- Added (some) support for Kethane parts.
1.8.1 (2014-05-30 22:41 UTC)
Don't use 1.8.1, either.
1.8
Don't use 1.8
1.7 (2014-05-22 21:09 UTC)
- Removed spurious debug log printing.
- You can now use a list of value instead of an exponent!
- Exponents and value lists can be specified per part, not just per module type. (And per-part values take precedence)
- Fixed erroneous scale for Rockomax 48-7S, and added missing scale for KW Rocketry 2.5m Nose Cone.
1.6 (2014-05-22 14:04 UTC)
- Fixed a problem where parts were scaled back to their default scale after loading, duplicating and changing scenes.
- Fixed defaultScale for Rockomax 48-7S (was 625, should be .625. Who'd guess someone'd notice that, eh?)
1.5.0.1 (2014-05-21 00:36 UTC)
- Fixed a bug in 1.5 where scale was not correctly preserved.
- Updated KSPAPIExtensions.dll - please delete the version in GameData/.
- Added support for KSO.
1.5 (2014-05-20 22:23 UTC)
- Changed from hardcoded updaters to a system using .cfgs.
- Made registration of custom IRescalables possible.
1.4 (2014-05-20 17:53 UTC)
- Fixes compatibility with GoodspeedTweakScale (but not old versions of TweakScale, but that should be a much, much smaller problem anyway).
- Added scaling support for KW Rocketry, NovaPunch and KSP Interstellar.
1.3 (2014-05-19 22:49 UTC)
- Fixed a bug where parts would get rescaled to stupid sizes after loading.
- Breaks compatibility with old version of the plugin (pre-1.0) and GoodspeedTweakScale.
1.2 (2014-05-18 22:00 UTC)
- Fixed default scale for freeScale parts.
- Fixed node sizes, which could get absolutely redonkulous. Probably not perfect now either.
- B9 Aerospace, Talisar's Cargo Transportation Solutions, and NASA Module Manager configs.
- Now does scaling at onload, removing the problem where the rockets gets embedded in the ground and forcibly eject at launch.
- Fixed a silly bug in surface scale type.
1.1 (2014-05-17 23:30 UTC):
- Added scaling support for B9 Aerospace and Talisar's Cargo Transportation Solutions.
- Will now correctly load (some) save games using an older version of the plugin.
1.0 (2014-05-16 18:00 UTC):
- Initial Release!
Known Issues/TODO:
- More mods should be supported. I'm open to suggestions.
- Enlarged engines burn too hot.
- Exhaust trails are the wrong size. I think.
- Support for more modules (addons)?
- Tech tree support (unlock sizes).
- Suboptimal interactions with Procedural Parts and Procedural Fairings - parts may intersect after loading.
- I have no idea how FAR feels about the updating of drag and lift.
- Apparently tweakable everything with TweakScale causes problems (ref post 200). More information needed.
- Fairings may be erroneously scaled (ref post 22) Unable to replicate. I'd love to have a .craft file showing this problem.
- Weird TWR in MechJeb. (ref post 22)
- Camera can end up in weird positions. (ref post 22)
- Add ModuleEngineConfig support.
- Do what Taverius says about engines and possibly other stuff.
- kolago (post 144) would like to see what the rescaled values are. Still on the fence about this.
This is my first time installing mods for the KSP, but it's strange that I can't get this plugin to work. I would be very happy if you could help me with this problem.
KSP LogFile: https://drive.google.com/file/d/1ZkIoIOLcPLCe8V04hBCn-9ysMFPrBFB_/view?usp=sharing
Weird…
There is a rogue file inside your TweakScale's installation!
[LOG 18:30:33.066] [UIPartActionsExtendedRegistration] Elected unopposed version= 1.7.5.0 at D:\Games\Kerbal Space Progra\GameData\TweakS cale\Plugins\KSPAPIExtensions.dll
Delete this file and things should work. I don't have the slightest idea about how this file ended up there, I just checked the last 5 releases and they are ok.
To tell you the true, perhaps removing the whole
TweakScale
directory and reinstalling from scratch could be a better idea!I remember doing something stupid on 2.4.6.9 I think, but this release is not available on CurseForge.
Hi,
I found incompatibility between tweak scale and configurable containers.
If you create fuel tank and resize him then you have more fuel capacity but after you start launch and revert flight to hangar then configurable containers recalcule your fuel capacity and set max value from base value.
Please set conflict relationship in CKAN.
Thank you.
It's not a conflict - it's lack of support.
This will be tackled down on this Companion:
https://github.com/net-lisias-ksp/TweakScaleCompantion_FuelSwitches/issues/2
In the mean time, in order to prevent another drama on the mentioned (competing) distribution channel, I'm working on a TweakScale solution that will prevent the problems you mentioned while the Companion is not ready.
https://github.com/net-lisias-ksp/TweakScale/issues/254
This will provide a maintainable interface where these mishaps can be tackled down without the need of harsh (and most of the time, unduly) measures.
Hi
My tweakscale suddenly stopped working and i dont remember what mods i added at that time or if i even did but heres the log (Edit) To be more clear whats wrong the rescaling of parts dosent work
https://drive.google.com/file/d/1kMtnH4_F3_keSjw9d5E-UH_0sH8vQi48/view?usp=sharing
Thanks in advance for the help
Hi!
You have a problem with BDArmory!
''' [EXC 00:17:47.278] Add to mod list threw an exception in loading BDAnimationModules, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null: System.T ypeLoadException: VTable setup of type BDAnimationModules.BDAdjustableLandingGear failed at (wrapper managed-to-native) System.RuntimeType.GetMethodsByName_native(System.RuntimeType,intptr,System.Reflection.BindingFlags,bool) at System.RuntimeType.GetMethodsByName (System.String name, System.Reflection.BindingFlags bindingAttr, System.Boolean ignoreCase, System.RuntimeType reflectedType) [0x0001b] in <9577ac7a62ef43179789031239ba8798>:0 at System.RuntimeType.GetMethodCandidates (System.String name, System.Reflection.BindingFlags bindingAttr, System.Reflection.CallingConventions ca llConv, System.Type[] types, System.Boolean allowPrefixLookup) [0x00010] in <9577ac7a62ef43179789031239ba8798>:0 at System.RuntimeType.GetMethodImpl (System.String name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Refle ction.CallingConventions callConv, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) [0x00000] in <9577ac7a62ef43179789031239ba8 798>:0 at System.Type.GetMethod (System.String name, System.Reflection.BindingFlags bindingAttr) [0x0000e] in <9577ac7a62ef43179789031239ba8798>:0 at ModuleManager.ModListGenerator.GetAdditionalModsFromStaticMethods (ModuleManager.Logging.IBasicLogger logger) [0x00039] in <a0f9d7e5c0864d32839c501c53536c2a>:0 '''
You have a problem with a thingy called
BDAnimationModules
. Somehow, the one on your rig is not suitable for modern KSP (or the DLL is corrupted).You need to install a new, appropriate copy of that DLL, or remove BDArmory from your rig.
You will need to reach BDArmory guys in order to get further help on this!
In reply to lisiast:
I removed BdArmory and BahaSP (I found that that file/mod had BDAnimationModules) but tweakscale still refuses to work i also removed some other mods that suddenly stopped working and prevented KSP from starting up
Heres the log
https://drive.google.com/file/d/1kMtnH4_F3_keSjw9d5E-UH_0sH8vQi48/view?usp=sharing
Thanks in advance again
Rinse, repeat! :)
This time, you forgot to install Toolbar Control, a dependency for CTB:
``` [AssemblyLoader] Exception when getting assembly attributes: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
Additional information about this exception:
System.TypeLoadException: Could not load type of field 'ClickThroughFix.ClearInputLocks:toolbarControl' (4) due to: Could not load file or assembly ' ToolbarControl, Version=0.1.9.4, Culture=neutral, PublicKeyToken=null' or one of its dependencies. assembly:ToolbarControl, Version=0.1.9.4, Culture=n eutral, PublicKeyToken=null type:<unknown type> member:(null) signature:<none> (Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35) ```
In reply to lisiast:
Thank you!
Turns out i also by accident put CTB and TC into the normal ksp files and not in gamedata
Very much appriciated
Hi!
For whatever reason, my tweakscale install has suddenly stopped working. I am able to see the ingame menu, but my attempts to change the size of parts fails to work for whatever reason. Attached is my KSP.log, as I don't really know what I am looking for within it.
Thanks for the help!
https://drive.google.com/file/d/1Q7GUkEItMn9mXIaVRbD2XiS8rCPVe9cQ/view?usp=sharing
It's MiniAVC.
[EXC 07:09:35.222] TypeLoadException: Could not resolve type with token 01000024 (from typeref, class/assembly KSP_AVC.Addon, KSP-AVC, Version=1.1 .6.2, Culture=neutral, PublicKeyToken=null) UnityEngine.DebugLogHandler:LogException(Exception, Object) ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object) UnityEngine.Debug:CallOverridenDebugHandler(Exception, Object)
You need to update it.
A bork on KSP-AVC triggers a bug inside KSP guts, and from that point every other add'on (inclusing, but not limited to TweakScale) borks too and cease to work.
Update (or remove) KSP-AVC and you should be fine!
In reply to lisiast:
So strangely enough, I went about uninstalling MiniAVC, at least through CKAN, yet my problem still remains with not being able to tweak the scale of parts in the VAB. I will drop another log in the event that is needed.
https://drive.google.com/file/d/1sDi5-OHYQu-xMISYLlY7U3wM1Je2BCKa/view?usp=sharing
Test message.
Sadly, It doesnt work... When I Change Scale, I won't do anything.
https://drive.google.com/file/d/1V9V5O37XIovc6rkDfGtwI61OJiKMB02-/view?usp=sharing
What should I do?
Like, https://drive.google.com/file/d/1KlvYI1MN3EWokzG_qMqU6DYGmRUrZ-Cv/view?usp=sharing
Hi!
You have a problem on KSPUtil:
Being not bad enough, you also have FIVE Module Managers DLLs on your rig. This is TERRIBLE because due a bug on KSP's Assembly Loader/Resolver thingy, the older one is used and you lose the new features and bug fixes of the newer one.
So you need to delete the following files from your GameData:
KSPUtil is something inside KSP itself, so I think it's borking because your ModuleManager setup is messed up. Fix the Module Manager issue and then publish another KSP.log if something else borks on you!
Cheers!
In reply to lisiast:
Thank you for your help very much!
Im having the issue where tweak scale doesnt work. i can use the resize tool but nothing happens, and the other older versions dont work aswell.
You are probably being bitten by a KSP bug triiggered when some Add'On borks on loading - when this happens, everything trying to load something later borks the same, and TweakScale needs to load some auxiliary DLLs.
Check if all TweakScale files are installed (including the DLLs on the PluginData folder). If everything looks fine, publish the KSP.log on DropBox, GoogleDrive or something like that and send me the link - I will be able to pinpoint the problem for sure by inspecting it!