ConfigurableCompany
A robust and powerful API for configuration handling and synchronization in real time. Create file-dependant configurations that can be changed while in game by the players. (The developer MUST implement their own configurations)
Last updated | 2 months ago |
Total downloads | 407578 |
Total rating | 16 |
Categories | Mods Tools Libraries Misc BepInEx Client-side Server-side |
Dependency string | AMRV-ConfigurableCompany-3.7.0 |
Dependants | 289 other packages depend on this package |
This mod requires the following mods to function
BepInEx-BepInExPack
BepInEx pack for Mono Unity games. Preconfigured and ready to use.
Preferred version: 5.4.2100README
Configurable Company
Configurable Company provides an enhanced experience for both players and developers adding an in-game menu where you can change you gameplay settings.
WARNING
This plugin does not add content on it's own, it's an API.
If you want content alongside it install Lethal Company Variables.
Player information | Developer guide |
---|
Player information
How to open
To open the menu you must go into the HOST
panel. There you will be able to see a button at the top-left of the screen. Clicking it will open the menu.
Using the in-game menu allows you to set a specific setting for your current file, you can have your first save with x10
enemy spawning and your second one with x0
enemy spawning.
If you need detalied information about how to use the menu you should Check the thunderstore wiki page
Developer guide
INFO
If you want an easy-to-read guide I recommend you looking Lethal comapny modding wiki for configurable company. However you can also check the thunderstore wiki or the mod's github page.
This API will allow you as a developer to add configurations to the game easily. These configurations will be displayed in an in-game menu where the user will be able to change them.
Configurations will change automatically so I suggest you listen to changes with events if you need the value automatically updated.
How to create configurations
public static CConfig FloatConfiguration = new CConfigBuilder()
{
Category = MyPluginCategories.Normal,
ID = "my-mod-id_configuration_float-configuration",
Name = "Does something",
Tooltip = "This is my cool description of the configuration",
Value = 69.420f
};
And you can get the value easily too:
int intValue = FloatConfiguration<int>Get();
float floatValue = FloatConfiguration<float>Get();
float floatValueWithDefault = FloatConfiguration<float>Get(10f);
You can even use BepInEx configurations:
CConfig myConfig = ConfigAPI.ConfigFromBepInEx(config);
Listening to events
The API includes a lot of events you can access and listen to. If you want to see the full list, navigate to the wiki section about events.
Here is an example on how you could listen to configuration changes:
First we need to register the listener (you might want to do this when your plugin starts)
CEvents.ConfigEvents.ChangeConfig.AddListener(MyListenerMethod);
Now we need the method to execute
public static void MyListenerMethod(CEventChangeConfig myEvent) {
CConfig changedConfig = myEvent.Config;
ChangeReason reason = myEvent.Reason;
bool succeeded = myEvent.Success;
bool converted = myEvent.Converted;
object oldValue = myEvent.OldValue;
object requestedValue = myEvent.RequestedValue;
object newValue = myEvent.NewValue;
// Here you can do whatever you need with the information
if (myEvent.Success) {
// Configuration changed correctly
}
}