AdvancedConfigBuilder

Updated 2 years ago

Xan.ROR2VoidPlayerCharacterCommon.ROOInterop.AdvancedConfigBuilder

This class assists in creating configuration values that are automatically registered to the applicable ConfigFile as well as to Risk Of Options.

Public Fields and Properties

ConfigFile BackingConfig { get; private set; }

This is the ConfigFile that was used to construct this builder. All generated configs are written to this file.

ConfigurationReplicator Replicator { get; private set; }

For more information on what this does, see the ConfigurationReplicator page. This is null until CreateConfigAutoReplicator is called.

const string REPLICATED_NOTICE

This value is managed by the host of the session. In multiplayer environments, you will not be able to change this setting, and will always use what the host has it set to.

Public Constructors

AdvancedConfigBuilder(Type classContainingConfigs, ConfigFile cfg, Sprite icon, string modId, string modName, string modDesc)

This constructor receives a type for a class containing all ReplicatedConfigEntry values. It is strongly recommended to make this class a static class. The system uses reflection to find static members decorated with [ReplicatedConfiguration] when calling CreateConfigAutoReplicator. The other information such as the icon, mod ID, mod name, and mod description are used in Risk of Options.

Public Methods

void CreateConfigAutoReplicator()

Instructs the Configuration Replicator to scan the config container class (see the constructor) for instances of ReplicatedConfigEntry<T> and store them for network control.

void SetCategory(string category)

Sets the category used by the builder. All options created after this method call will be in the provided category (this allows removing the category from the config-entry-creating method calls).

ReplicatedConfigEntry<float> BindReplicated(string name, string description, float @default, float min = 0f, float max = float.MaxValue, float? increment = null, RestartType restartRequired = RestartType.NoRestartRequired, string formatString = null, IsDisabledDelegate isDisabledDelegate = null)

Binds the provided floating point value as a network-managed config entry. This means that the host of the session controls the effective value seen by all connected clients. This automatically registers the option to Risk of Options. For information on RestartType, scroll down.

ConfigEntry<float> BindLocal(string name, string description, float @default, float min = 0f, float max = float.MaxValue, float? increment = null, RestartType restartRequired = RestartType.NoRestartRequired, string formatString = null, IsDisabledDelegate isDisabledDelegate = null)

Binds the provided floating point value as a locally-managed config entry. This means that the value exists separately per client and is not managed over the network. This automatically registers the option to Risk of Options. For information on RestartType, scroll down.

ReplicatedConfigEntry<int> BindReplicated(string name, string description, int @default, int min = 0, int max = int.MaxValue, RestartType restartRequired = RestartType.NoRestartRequired, string formatString = null, IsDisabledDelegate isDisabledDelegate = null)

Binds the provided 32 bit integer value as a network-managed config entry. This means that the host of the session controls the effective value seen by all connected clients. This automatically registers the option to Risk of Options. For information on RestartType, scroll down.

ConfigEntry<int> BindLocal(string name, string description, int @default, int min = 0, int max = int.MaxValue, RestartType restartRequired = RestartType.NoRestartRequired, string formatString = null, IsDisabledDelegate isDisabledDelegate = null)

Binds the provided 32 bit integer value as a locally-managed config entry. This means that the value exists separately per client and is not managed over the network. This automatically registers the option to Risk of Options. For information on RestartType, scroll down.

ReplicatedConfigEntry<TEnum> BindReplicated<TEnum>(string name, string description, TEnum @default, RestartType restartRequired = RestartType.NoRestartRequired, IsDisabledDelegate isDisabledDelegate = null) where TEnum : Enum

Binds the provided enumeration as a network-managed config entry. This means that the host of the session controls the effective value seen by all connected clients. This automatically registers the option to Risk of Options. For information on RestartType, scroll down.

ConfigEntry<TEnum> BindLocal<TEnum>(string name, string description, TEnum @default, RestartType restartRequired = RestartType.NoRestartRequired, IsDisabledDelegate isDisabledDelegate = null) where TEnum : Enum

Binds the provided enumeration as a locally-managed config entry. This means that the value exists separately per client and is not managed over the network. This automatically registers the option to Risk of Options. For information on RestartType, scroll down.

ReplicatedConfigEntry<bool> BindReplicated(string name, string description, bool @default, RestartType restartRequired = RestartType.NoRestartRequired, IsDisabledDelegate isDisabledDelegate = null)

Binds the provided boolean as a network-managed config entry. This means that the host of the session controls the effective value seen by all connected clients. This automatically registers the option to Risk of Options. For information on RestartType, scroll down.

ConfigEntry<bool> BindLocal(string name, string description, bool @default, RestartType restartRequired = RestartType.NoRestartRequired, IsDisabledDelegate isDisabledDelegate = null)

Binds the provided boolean as a locally-managed config entry. This means that the value exists separately per client and is not managed over the network. This automatically registers the option to Risk of Options. For information on RestartType, scroll down.

ReplicatedVector3Wrapper BindReplicated(string name, string description, Vector3 @default, Vector3 min = default, Vector3? max = null, RestartType restartRequired = RestartType.NoRestartRequired, string formatString = "{0}m")

Binds the provided Vector3 as a network-managed config entry. This means that the host of the session controls the effective value seen by all connected clients. This automatically registers the option to Risk of Options. For information on RestartType, scroll down.

LocalVector3Wrapper BindLocal(string name, string description, Vector3 @default, Vector3 min = default, Vector3? max = null, RestartType restartRequired = RestartType.NoRestartRequired, string formatString = "{0}m")

Binds the provided Vector3 as a locally-managed config entry. This means that the value exists separately per client and is not managed over the network. This automatically registers the option to Risk of Options. For information on RestartType, scroll down.

ReplicatedPercentageWrapper BindFloatPercentageReplicated(string name, string description, float @default, float min = 0f, float max = 100f, RestartType restartRequired = RestartType.NoRestartRequired, string formatString = "{0}%")

Binds the provided floating point value as a network-managed config entry. This means that the host of the session controls the effective value seen by all connected clients. This automatically registers the option to Risk of Options. For information on RestartType, scroll down. Unlike its counterpart, this value is registered as a human-readable range from 0 to 100. See ReplicatedPercentageWrapper's page for more information.

LocalPercentageWrapper BindFloatPercentageLocal(string name, string description, float @default, float min = 0f, float max = 100f, RestartType restartRequired = RestartType.NoRestartRequired, string formatString = "{0}%")

Binds the provided floating point value as a locally-managed config entry. This means that the value exists separately per client and is not managed over the network. This automatically registers the option to Risk of Options. For information on RestartType, scroll down. Unlike its counterpart, this value is registered as a human-readable range from 0 to 100. See ReplicatedPercentageWrapper's page for more information.

ReplicatedMinMaxWrapper BindMinMaxReplicated(string name, string description, float defaultMin, float defaultMax, float min = 0f, float max = 1f, RestartType restartRequired = RestartType.NoRestartRequired, string formatString = "{0}")

Binds the provided pair of floating point values as network-managed config entries. This means that the host of the session controls the effective value seen by all connected clients. This automatically registers the option to Risk of Options. For information on RestartType, scroll down. These values are used to define the minimum and maximum of a range of values, usually this range is used for RNG.

LocalMinMaxWrapper BindMinMaxLocal(string name, string description, float defaultMin, float defaultMax, float min = 0f, float max = 1f, RestartType restartRequired = RestartType.NoRestartRequired, string formatString = "{0}")

Binds the provided pair of floating point values as locally-managed config entries. This means that the value exists separately per client and is not managed over the network. This automatically registers the option to Risk of Options. For information on RestartType, scroll down. These values are used to define the minimum and maximum of a range of values, usually this range is used for RNG.

string ToMarkdownTable()

An experimental and currently unused method that dumps information about each and every registered configuration option into a markdown table.

Public Enums

RestartType

RestartType is a way of relaying what kind of interaction a setting requires before it applies.

RestartType.NoRestartRequired

The applicable setting immediately applies as soon as the option changes. No additional action is required.

RestartType.NextRespawn

The applicable setting applies only on newly created instances of whatever it applies to. An example of this is the Full Size Character option used on the Void characters; characters only change size upon spawning and not during runtime.

RestartType.RespawnGame

The applicable setting relies on data that is only mutable during the startup phase, thus it requires a full game restart to apply.