No options, no button
I'm trying to add in my mod options using a reference to ModLib.Definitions.dll. Is it enough to add in module a class that inherits from SettingsBase? I did it and it just does not work. I can't even see a button Mod Options in the game menu. ModLib is installed and activated.
And when I add some mod that uses MBOptionScreen I can see mod options button. There are tabs there for modlib and my mod, but they are empty.
Yes, all you need to do is inherit from SettingsBase and ModLib will automatically find and add your settings to the menu. MBOptionScreen breaks modlib at the moment, the author thinks it good practice to specifically mess with modlib. I would recommend developing your mod without any other mods installed, as this will allow you to isolate any bugs that may happen. To get the options to show, you need to install MCM: https://www.nexusmods.com/mountandblade2bannerlord/mods/612 and make sure that it is loaded before ModLib. Then go into Mod Options -> MCM settings -> Disable ModLib override.
It is a real problem I guess. A lot of mods are based on MBOptionScreen. I can test a mod on clean setup but for end-user that's definetly will not be the case. I hope you guys will find a solution that will be good for the comunity. Anyway thanks for your work.
MCM does not 'specifically' mess with ModLib. MCM provides it's own ModLib substitute because there is no way to use IL/Harmony to make the old and new ModLib work together with your original library.
Since the goal of MCM is to show options from every possible API, it was decided to create a 'frankenstein' that combines the old and the new ModLib assemblies in a way that mods that depend on them will work, but ModLib as a standalone mod will not be able to show those settings itself, because MCM's ModLib substitute does not include the whole ModLib's code and only uses the necessary minimal amount for mods to work.
I do not consider that 'breaking' ModLib. While it's true that ModLib will not work as an independent mod, MCM replaces it's functionality to ensure that everything will work. Isn't the goal of ModLib to provide an API for mods to show settings? MCM provides a full implementation for options to be shown. There is no difference for the end user. You still can use ModLib's Option Screen by disabling MCM.
ModLib's override is shipped by default right now. There is a work in progress to modularize MCM and make ModLib's override optional, check the beta experimental release. This will ensure that the original ModLib will still function, but if any mod will use the old ModLib implementation, it wont work.