Sign in to follow this  
Uzza

[0.90]Addon Controller 1.1 - Toggle addons and parts for individual saves

Recommended Posts

Addon Controller

Javascript is disabled. View full album

Introduction

This is a project I've started working on to get functionality that I think would be very useful to have, and I imagine others also would.

The basic idea is that you should not have to exit the game and change stuff in the GameData folder just because you want a different game experience.

The goal is therefore that you should be able to, for example, have a save with Realism Overhaul that does not conflict with a save intended for stock only, and you should be able to seamlessly switch between them.

I'd imagine the journey to get to that point would be long, but as the Chinese proverb goes, a journey of a thousand miles begins with a single step.

I hope you guys enjoy this plugin (to the extent possible this early in development), and Id love to hear some feedback on what' good, bad or can be improved.

For addons supported, check the list at the bottom.

Features

  • Disable addons for a given save (addon support required)
  • Disable part modules for a given save
  • Disable specific parts for a given save

Version history

v1.1.0

  • Updated for 0.90 support.

v1.0.0

  • Added support for disabling part modules (stock part modules not included).

v0.5.0

  • Added warning message that is shown when there are parts in active flight that have been disabled.

v0.4.3

  • Fixed issue where no parts were loaded when starting a brand new game.

v0.4.2

  • Made some optimizations to the UI for when there are no saved games present.

v0.4.1

  • UI performance optimizations; Removes slight hickup when opening parts tree for the first time and other small optimizations.

v0.4.0

  • Replaced old part and addon lists with a tree view instead, improving usability.
  • Removed ability to force addons off, based on mod developer feedback. Can now only be done if addons supports it.
  • Verified KSP 0.25 compatible.

v0.3.0

  • Added UI to manage settings ingame.

v0.2.0

  • Added ability to toggle parts on/off per save.

v0.1.0

  • Initial release. Added ability to disable addons per save.

How to use

The main UI, which is available in the main menu, consists of a list of saves, all installed addons, and all available parts.

To select a save to change settings for just click it and go on and change what you want. Selecting a different save clears the changes you have done though, so don't forget to save!

Changing parts is pretty straightforward. Just uncheck the parts you don't want to be available in the selected save.

Addons is a bit less straightforward. To be able to turn off addons, they have to have added support for AddonController. If your favorite mod doesn't have support, you have to ask it's developer to add it.

Limitations

As mentioned above, diabling addons will be limited until developers add support in their addons.

Also, after discussions with sarbian about ModuleManager, it seems it's infeasible to implement a way to turn patches on/off on the fly. So integrations with ModuleManager is on hold indefinitely unless a good solution can be found.

As a result, mods that includes changes to other parts using patches will still perform those changes, even if the mod has support for disabling it.

For addon developers

The API can be found by looking at the AddonControllerApi and RefelctionAddonControllerApi classes. The RefelctionAddonControllerApi class is built so it does not need an assembly reference, so just copy the class to your addon project and start using it, and it'll return correct values i.e. return true on AddonIsAllowed when not installed, and the actual value when it is.

If you add support using the API, please comment so I can compile a list of supported addons.

Development thread

Future plans

  • Expand the API available to other addons.
  • Show part information when hovering over them in the part list.
  • Add support for KSP-AVC.

Download

Download latest version here.

Source code and old releases are available on Bitbucket.

Licence: GPLv3

Also available on kerbalstuff.

Installation

Just copy the dll to the GameData folder.

Uninstall

Just delete the dll.

Blocked parts will have to be repurchased from the science center though if they're in unlocked tech nodes.

Addon support

Enabling/disabling parts

Because of how parts are disabled, every part is supported. This means that any and all parts you add will allow you to toggle them.

Enabling/disabling part modules

Support for disabling part modules are universal. Stock part modules have been excluded for the time being however.

Enabling/disabling addons

If you want to see your favorite addon support AddonController, please ask the developers if they can add support.

Supported

None so far. If an addon works but is not listed, please comment so I can add it.

WIP

RemoteTech

Not supported

FAR/NEAR

Edited by Uzza
Updated for KSP 0.90

Share this post


Link to post
Share on other sites

Hi! Welcome to the forums!

May I ask you.

Is this a application or a mod or a plugin?

Share this post


Link to post
Share on other sites

Not sure about the difference between a mod or plugin, but it's not a standalone application.

It's a bit like ModuleManager though in that it hooks up at game startup to do it's magic. But instead of modifying anything directly it toggles other addons (and later parts) that's loaded, basically having the same effect of removing them from the GameData directory. That's the theory anyway.

Share this post


Link to post
Share on other sites

This seems like it could be a very nifty little tool! Hopefully this will grow and devs will provide the needed support for this if it deems itself necessary.

Share this post


Link to post
Share on other sites

I have updated the plugin, so it now has the functionality to enable/disable specific parts based on what is configured for each save.

I've also created a Mercurial repository on Bitbucket for source control and more easy viewing of the source online.

Share this post


Link to post
Share on other sites

Does it need to be XML? Most the other configuration in KSP is done in a JSON like data structure. I have found XML difficult to deal with in the best of times...

Share this post


Link to post
Share on other sites

While this sounds like a neat idea, I have to admit my skepticism (and not a little fear) regarding plugins that go around blocking other plugins. I think it might be much safer to offer an exposed interface for toggling functionality and let plugin authors adopt it (as toolbar did).

Share this post


Link to post
Share on other sites
Does it need to be XML? Most the other configuration in KSP is done in a JSON like data structure. I have found XML difficult to deal with in the best of times...

I already had utility functions to do xml serialization, which is why I picked it. XML itself is not that difficult to used though I think, and easy to understand as long as you don't have a massively complex structure.

While this sounds like a neat idea, I have to admit my skepticism (and not a little fear) regarding plugins that go around blocking other plugins. I think it might be much safer to offer an exposed interface for toggling functionality and let plugin authors adopt it (as toolbar did).

The blocking of other plugins from loading was my initial implementation, but as my tests showed not all plugins clear everything at the end of the Unity lifecycle, which is why I created the simple class I reference under "Limitations" that other developers can use, which also doesn't require a hard reference on my assembly.

Removing the loading block, or adding an explicit setting to turn it on, is something I can do if people think it's better.

Share this post


Link to post
Share on other sites

The plugin has just been updated to v 0.3, which includes a UI to make it much easier to change the settings.

I also made forcing addons off an explicit option per addon, instead turning all plugins off as default. So addons are now only forced off if you configure it to.

OP has been updated with the new information. Download the new version here.

Share this post


Link to post
Share on other sites

Any feedback/comments/anything? I would have imagined at least someone would find this plugin useful and would have tried it out.

Share this post


Link to post
Share on other sites

Did some testing and mostly it was working perfectly. Now i can have different save files with different plugins active and play out different scenarios, add on top of that the 0.25 release where even more configurations can be done to save files!

Maybe now when Squad added a difficulty menu in the game creation screen you might be able to integrate a tab where mod-selection is placed for better control when starting a new game. Also grouping the addons selection to have a better overview of the different parts of a addon you can turn on and off that you have to click to expand. Saves space on the screen. =)

Share this post


Link to post
Share on other sites

I have just updated the addon to version 0.4.0, with a new and improved UI. Should make it easier to manage the settings when you have a large number off addons and parts.

Unfortunately I have also removed the ability to force disable addons, so now disabling addons actually only work if they have implement support.

This is based on input from mod developers though, and getting them on-board is the important part.

Please tell me what you think. I can't improve this if I don't get any feedback and what's good or bad.

New version can be downloaded through this link. Also updated first post appropriately.

Share this post


Link to post
Share on other sites

This is exactly the mod I've been looking for. I'll try it out as soon as I can.

Edit: Absolutely brilliant. Exactly what I've been wanting for a really long time. Two thumbs up!

Edited by Zeenobit

Share this post


Link to post
Share on other sites
This is exactly the mod I've been looking for. I'll try it out as soon as I can.

Edit: Absolutely brilliant. Exactly what I've been wanting for a really long time. Two thumbs up!

I'm really happy to hear that. Thanks. :)

If there are any addons you'd want to see have support for being togglable, please ask their developers if they can add support.

The more that are on board, the better this will be.

Share this post


Link to post
Share on other sites

You know Start Menu lags to hell when you press on "Parts" submenu

Edited by nismobg

Share this post


Link to post
Share on other sites
You know Start Menu lags to hell when you press on "Parts" submenu

I did not know that, which might be because my machine is not half-bad. What does your machine look look like, and roughly how many parts do you have installed?

Also, is it slow immediately or after you expand a few nodes?

Do you have zip, instead of a rar?

I didn't, but I've added it. Zip is here. I've also added it to first post.

Edited by Uzza

Share this post


Link to post
Share on other sites
I did not know that, which might be because my machine is not half-bad. What does your machine look look like, and roughly how many parts do you have installed?

Also, is it slow immediately or after you expand a few nodes?

Running about 70Mods, not many part mods however. i7 2600 with 16g RAM, so it's not about your machine being "better" then mine. Again when you press on "parts" fps goes to 0.1~.

Share this post


Link to post
Share on other sites
Running about 70Mods, not many part mods however. i7 2600 with 16g RAM, so it's not about your machine being "better" then mine. Again when you press on "parts" fps goes to 0.1~.

Ah, now I see what you mean. When you click on parts the first time, I build the node tree if it doesn't exist, and then cache it.

I'll see if there's some optimizations I can make to speed up the process of building it.

Edit: DOH! Found the performance problem, and it was quite obvious actually.

I sorted the tree every time a new node was added to it, which if adding for example 300 nodes builds up to a substantial amount of time.

Changed it to sort only after the entire tree is complete, and the issue is gone!

Edit 2: Did some more optimizations in general in the UI trying to reduce the rendering time, allowing even more parts to be shown at once in the list.

I've uploaded a new version.

Edited by Uzza

Share this post


Link to post
Share on other sites

I personally wouldn't call WinRAR bloat. It's a very useful piece of archiving software. People obviously have different opinions on that though.

Share this post


Link to post
Share on other sites

Hello,

I would like to report that having no save games and installing this mod will result in a dreadful slow menu in KSP. After I created a game the speed went back to normal.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this