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)
Date uploaded | 3 months ago |
Version | 3.5.0 |
Download link | AMRV-ConfigurableCompany-3.5.0.zip |
Downloads | 31163 |
Dependency string | AMRV-ConfigurableCompany-3.5.0 |
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
}
}
CHANGELOG
3.7.0
Fixed
- Event invocation not working under certain circumstances
- Presets list not updating after adding/removing a preset
- Memory optimizations and memory freeing at the start of the game
- Updated mod to v65
- Fixed menu loader appearing on clients after joining a game
Added
- New popup menu to confirm important actions (saving, deleting or modifying saves)
Removed
- Disabled some redundant debug logs (only on release version)
3.6.0
Fixed
- Added a loading screen to represent the progress loading the mod and menu
- Added code optimizations to load 10 times faster
Added
- Seeds now will be saved with the configurations
Modified
- Presets will not default to any specific preset, rather it will remain empty until one is selected
3.5.0
Fixed
- Presets not working with low monitor resolutions
- Menu state for categories not saving
Added
- Menu state for sections now will save among state for categories
- Added
SpecialSeed
to allow custom seeds that might trigger special effects - Added more accessors for
BuildTooltip
class
Modified
- Configuration randomization now allows for seeds formed from base 36 characters (all numbers and letters)
- Configuration randomization now has an extra parameter, InfoProvider which determines what kind of seed is being used
- The menu will notify the user when used without any other mod that adds configurations
3.4.0
Fixed
- Change reason for synchronization was set to READ_FROM_FILE, now has been changed to SYNCHRONIZATION
- Sliders will now display the correct state according to their modification
Added
- Configurations can now be randomized, by default it will select a value close to default but you can implement your randomizer for your configurations using the
CRandomizer
class andRNGProvider
for custom random algorithms. - Added a help button with information about how to use the menu.
Modified
- Updated all wikies with the usage of the menu
3.3.2
Added
string
andbool
configurations can now be converted to more types
3.3.1
Fixed
- Fixed a regression causing the mod to soft crash when the preset folder didn't exist
3.3.0
Fixed (hotfix in previous release)
- Fixed Configurable company crashing always
- Fixed preset creationg not updating instantly
Added
- Configurations now display their name in italic when they are not saved
- Configurations now display their name in bold when they do not match their default value.
- Added optional override method
OnModifiedState
inConfigDisplay
to implement your own actions depending if the configuration matches it's default value or current saved value. - Added optional override method
ValueEquals
tinConfigDisplay
to implement your checker for the current value. - Sections now have an arrow to indicate their open state
Modified
- Presets will now use the saved configurations rather than save the temporal values and use them
3.2.0
Fixed
- Fixed
DecimalRangeTypes
andIntegerRangeType
returning minimum value two times as tuple. - Fixed
InputValidator
instantiation warning spam.
Added
- Added
CBind<T>
to directly access configuration values as a specific type. - Added
ConfigChangeSingle
to listen for changes on a specific configuration. - Added configuration presets. These presets will be shared with your profile.
- Added builder accesors for easier creation of
CCategories
,CSections
andCConfigs
. - New wiki page for first steps and first config.
Modified
- Configuration categories can now be closed from the sidebar.
- Configuration sections can now be hidden or shown for better organization.
3.1.0
Fixed
- Hard crash when trying to get value of range configuration type
- Typo on
CConfigBuilder
Toggleable
Added
- Accesibility methods for
RangeTypes
Removed
- Accesibility methods for number variables now require to input both arguments
- Unnecesary console logs in release version
3.0.1
Modified
- Code cleanup
Fixed
- Now you can change configurations for BetterSaves's new file
- Fixed incorrect Canvas attachment of the menu with some mods
3.0.0
Modified
- Configurations now are not shared between profiles
- Reworked the whole interface
- Reimplemented everything
Added
- Configurations now will synchronize in real time
- Added sections to split categories even more
- New configuration type
Range
wich accepts any agrupation of two values (array[2], Tuple<,> and ValueTuple<,>)
Fixed
- Compatibility issues with many mods such as better saves
2.6.0
Fixed
- Menu not appearing when hosting after joining a game
Added
- Configurations can be reverted by clicking while holding Shift key
- Configurations can be reset by clicking while holding Ctrl + Shift
- Added
experimental
tag - Added buttons to
copy
andpaste
configurations so you can share them with your friends
Deprecated
- The attribute
Needs restart
is now obsolete, it will be removed in future releases.
The decision has been made because developers should try to make their settings modificable even after the game has started. This might be hard to understand but Ill be glad to help anyone who needs asistance with it, you can also check Lethal company variables and see how it implements this functionality.
Removed
- Removed the log entry when loading configurations from file
2.5.2
Modified
- Now configurations will not depend upon the region/language of the computer
2.5.3
- Updated project target framework for
net standard 2.1
2.5.2
Added
- BetterSaves compatibility
Modified
- Internal changes to in-game menu for better compatibility implementation
Fixed
- Configurations won't reset to their previous state when clicking
[ BACK ]
button
2.5.1
Added
- Added public project repository
- Added Issues
- Added github wiki
- Added new contact methods
- Added
Information / Guide
button to show a simple usage for the menu
Modified
- Updated contact information in readme
2.5.0
If you created your own ConfigurationType you MUST update your mod with the newer internal implementation
Added
- New configuration type
ConfigurationTypes.StringOfLength(int)
that allows for a string with a maximum length (this can go up to 48 characters) - New configuration type
ConfigurationTypes.Options(Enumeration / collection of values)
that let the user choose one option from a list, you can get back the value as anint
(for the index) or as aT
(for the value at the index)
Modified
- Now config getters allow to get their value as other types, for example a float config as an int without casting
- The image now is from a trusted somain so everyone should be able to see it (NuGet only)
- Added spacing to the tooltip's type range values
- Category open state now persists during sesions
- Changed icon to a more modern design
Fixed
- Removed strict casting when getting configuration values as a
T
type - Configuration values now reset correctly with newly generated configurations
2.4.1
Fixed
- Configuration pages now have a better title fitting with font scaling
Modified
- Default page and category now will only appear if a developer uses them (a getter will spawn them)
2.4.0
Added
- New configuration types: RangedInteger, RangedFloat and Slider (a slider that allows to set a min and max values)
Fixed
- Page changing to the left is now cyclic
2.3.4
Fixed
- The disabled menu information now displays correctly
- Menu not being displayed again when leaving using leaderboard button
2.3.3
Modified
- Now there is no configuration menu for challenge mode (this is a temporal change and might change depending on the result of the voting. You can vote in the official modding discord or contact directly to
the_ansuz
)
Added
- The voting information is displayed when selecting the challenge file
2.3.2
There is absolutely nothing added, some people just want to see the mod updated to make sure it works with the next update
2.3.1
Added
- v47 compatibility
Modified
- Updated mod information
- Reset file now resets even configs that are not loaded (deleting the config file)
Fixed
- Fixed change file error when there are no mod configs
2.3.0
Added
- Configurations are now organized in different pages
Fixed
- Reworked 2.2.0 changes
- Quit button not working on specific circumstances