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 implem
截圖 共 2 張
模組介紹 作者原文
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 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 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 = FloatConfigurationGet();
float floatValue = FloatConfigurationGet();
float floatValueWithDefault = FloatConfigurationGet(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
}
}
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。
下面這些內容需要先安裝,否則該模組不會生效: