26place
Multiversal Mechatronics - KSP All the ideas and discussions
9 votes Vote

MechJeb ComputerModule 3rd party plugins

A powerful idea that from my knowledge would be pretty simple to implement- in MechJebCore.cs, where the ComputerModule list is populated, instead of hardcoding the entries, use reflection to find all types that extend from ComputerModule and create them using C#'s Activator class.

For example, the following line of code does this (replace all the "modules.Add"s with this)
modules = AppDomain.CurrentDomain.GetAssemblies().SelectMany(assembly => assembly.GetTypes()).Where(type => type.BaseType == typeof(ComputerModule)).Select(type => Activator.CreateInstance(type, this)).OfType().ToList();

Basically, this allows people like myself to take advantage of the (quite awesome) already-existing framework of Mechjeb without forking it. It also allows the user to install more than one mechjeb mod.

Shard, 26.09.2012, 11:59
Idea status: under consideration

Comments

Leave a comment