ShotgunNinja / Kerbalism

Hundreds of Kerbals were killed in the making of this mod.
The Unlicense
43 stars 19 forks source link

Changes to implement a Profile importing scheme #111

Open PiezPiedPy opened 7 years ago

PiezPiedPy commented 7 years ago

Changes to implement a Profile importing scheme

I needed a way to import processes for my personal changes and came up with some small code changes that enable Profiles that are stored in any config file to be imported into the loaded profile, this also allows modders to include their own Supplies, Rules or Processes and not have to edit the default profile.

The code also checks a field supplied in the imported profile to determine if the profile should be imported or not. This mechanism works by searching the GameData directory for a matching directory that is named in the moddir field of the profile.

Using

Simply create a Profile node named KerbalismSupport and include the necessary script to define the Supplies, Rules and Processes you need, as you would with the default profile. The KerbalismSupport profile node must have a modname field which is used for logging and a moddir field which is used to decide if a mods support profile should be loaded.

Profile
{
    name = KerbalismSupport    // name must be KerbalismSupport
    modname = FooBar Zoo       // Just a name for display purposes
    moddir = FooBar/Zoo           // Could use Zoo if you wish

    Supply
    {
    etc...

Example: FooBarZoo.cfg

see the commits here Profile-Import-Test. If you have any suggestions fire away, code is ready for a Pull ;)

ShotgunNinja commented 7 years ago

I am interested, but for now let's keep this on hold because the rule system is going to change in the near future. In particular I'm going to lift the MM patching limitation that currently exist for profiles. So that what you propose may be implemented purely as MM patches creating or editing new rules.

PiezPiedPy commented 7 years ago

I saw you where up to something from reading some of the other posts, so decided on putting up an issue rather than a PR.