You are viewing a potentially older version of this package. View all versions.
AMRV-ConfigurableCompany-1.1.0 icon

ConfigurableCompany

An API to allow modders to create save-dependant configurations that remain between matches, all with the simplicity of a click

Date uploaded 7 months ago
Version 1.1.0
Download link AMRV-ConfigurableCompany-1.1.0.zip
Downloads 7510
Dependency string AMRV-ConfigurableCompany-1.1.0

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2100 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2100

README

Configurable company

This mod does not add content by itself, its an API for other modders that want an easy way to achieve file-dependant configurations that the user can modify ingame easily using an interface.

User information

Configurable company will generate a menu when you click Host that will allow you to set variations of different aspects of the game. These variations will be stored among the save file of the game so you can have three different configurations.


Modder information

This is only relevant if you plan on using the API

Creating a configuration


To create a new configuration use the class ConfigurationBuilder wich allows to instantiate new builders for the configuration.

Here is a visualization of how any configuration could be created:

ConfigurationBuilder.NewConfig("modder_config_name")
.SetName("Configuration name")
.SetType(ConfigurationType.Boolean)
.SetValue(true)
.SetTooltip("lines")
.Build();

The configuration system requires you to use a unique identifier for your individual configurations, I recommend setting it to something like modder_configuration_name as you can only use alphanumeric characters and underscores.

  • SetName(string) changes the displayed name of the configuration.
  • SetType(ConfigurationType) sets what kind of values are accepted, you can choose one of the following:
    • Boolean true or false values
    • Integer only whole numbers, positive or negative
    • Float whole or decimal numbers, also positive or negative
    • String any kind of text (capped at 38 characters)
    • Percent a float value in the range of 0 to 100
  • SetValue(?) specifies the default value when there is no previous one (OPTIONAL)
  • SetTooltip(string...) modifies the tooltip that is displayed when a player hovers over the configurations. You can pass the whole tooltip string as one or invoke the method as SetTooltip("line one","line two"...) and so on.
  • SetSyncronized(boolean) every configuration marked with this flag will be sent over any user who joins the server. However it is still possible that they will not use the configuration if they don't have the correct mods installed

Finally you must call the Build() method, as this will return you the configuration itself for you to use (you should really keep configurations as variables of type Configuration).

Alternatively you can just call Configuration.Create(identifier, name, category, type, defaultValue) but due to the complexity of the arguments, you might want to use the ConfigurationBuilder.

WARNING Keep in mind that your configurations must be created before the configuration menu is displayed, make sure to call any initializers for static variables or class references before this happens. As a suggestion, I recommend you to declare these configurations inside your main class as static variables.

Accessing other configurations


If you plan to access other declared configurations, you can do so by calling Configuration.TryGet(identifier, out Configuration result) wich will try to get it and will return false if it does not exist, this allows you to keep soft dependencies with other mods.

About categories


Although not yet implemented, categories will be a way to sort different types of configuration into containers that will allow you to organize the configuartions.

You can still declare them and use them, however there will be no change until they are implemented.

To create a new category just call ConfigurationBuilder.NewCategory in the same way you call it to create a new configuration.

Categories will only be visual so you can only provide them with a display name.

CHANGELOG

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 and RNGProvider 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 and bool 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 in ConfigDisplay to implement your own actions depending if the configuration matches it's default value or current saved value.
  • Added optional override method ValueEquals tin ConfigDisplay 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 and IntegerRangeType 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 and CConfigs.
  • 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 and paste 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

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 an int (for the index) or as a T (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