An api to allow developers to create configurable parameters for lethal company. These configurations can be modified in-game using a built in menu, persist during sesions and are save-dependant on each game file.
License
—
Deps
3
Install Size
—
Vulns
✓ 0
Published
Oct 25, 2024
$ dotnet add package Amrv.ConfigurableCompanyConfigurable Company provides an enhanced experience for both players and developers adding an in-game menu where you can change you gameplay settings.
| Player information | Developer guide |
|---|
PRO TIP
This plugin does not add content on it's own, it's an API.
If you want content alongside it install Lethal Company Variables.
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.

As the image shows, configuration are split into pages (Seen at the top left of the image) and then into categories.

INFO
You don't need to share configurations with your friends, they are automatically synchronized.

The tooltip shows the configuration name, a description on what it does and some tags with extra information. These tags can be:
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.
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);
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
}
}