RunConfigAPI
Interface to set seeds and biome information of various parts of the game
About this mod Author’s original text
RunConfigAPI
RunConfigAPI is build to simplify programmatic setting of various settings that influence the run.
Currently supporting loot seed as well as terrain seed and biomes.
This is a library so will not do anything on its own.
Usage
Adding RunConfigAPI as a reference/dependency in Visual Studio
To add RunConfigAPI as a reference to the project to have Intellisense and interface definitions,
you have to install the mod and copy the.dll file into a folder where your plan to develop your mod in.
It should look something like $YourModDevFolder/dependencies/dev.kirsho.RunConfigAPI.dll. Then add this.dll
as project reference (you might need to browse to find the.dll file).
To make sure everything works correctly, your.csproj file will have the following lines:..\..\dependencies\dev.kirsho.RunConfigAPI.dll
Setting RunConfig from server
If a remote server wants to set config settings for the users, they only need to add RunConfigAPI as a dependency!
Example implementation for such mod:
using RunConfigAPI;
namespace ExampleMod.Patches
{
[HarmonyPatch(typeof(BoardingPass), nameof(BoardingPass.StartGame))]
internal class SetRunConfigOnRunStart
{
private static void Prefix()
{
var serverSideConfig = FetchDataFromServer();
// Convert any server side structure to a common RunConfig class
// which API uses to communicate with implementations
RunConfig config = ConvertToRunConfig(serverSideConfig);
RunCapabilityApplier.Apply(config);
// If capability mods are installed, they will be called with the specified
// config and set the appropriate values
}
}
}
Exposing Capabilities
Any mods that want to expose their configuration capabilities to RunConfigAPI must implement interfaces that provided with this library
and register themselves in the CapabilityRegistry.
Note: if Plugin class implements interfaces, they could be automatically discovered by the API and dont need to register.
Example implementation for one of the interfaces:
// You need to add RunConfigAPI dll as a dependency to the project
// if you want to get Intellisense and Interface definitions
using RunConfigAPI.Capabilities;
namespace ExampleMod
{
internal class RunConfigLogger: IApplyLifecycle
{
// Will be called after all configurations are applied
// and will the seed for the run
public void AfterApply(RunConfig config)
{
Plugin.Log.LogInfo($"Final run seed: {config.Seed}");
}
}
}
// Then, in Plugin.cs
using RunConfigAPI;
namespace ExampleMod
{
[BepInDependency("dev.kirsho.RunConfigAPI", BepInDependency.DependencyFlags.HardDependency)]
[BepInAutoPlugin]
public partial class Plugin: BaseUnityPlugin
{
//...
internal static RunConfigLogger configLogger;
//...
private void Awake()
{
// some other stuff here...
configLogger = new RunConfigLogger();
// First parameter is unique string to avoid collisions
// as otherwise capabilities will be overwritten
CapabilityRegistry.Register(Plugin.Info.Metadata.GUID, configLogger);
// the rest there...
}
}
}
Example implementation inside Plugin class:
using RunConfigAPI;
[BepInDependency("dev.kirsho.RunConfigAPI", BepInDependency.DependencyFlags.HardDependency)]
[BepInAutoPlugin]
public partial class Plugin: BaseUnityPlugin, IApplyLifecycle
{
//...
// no extra fields needed
private void Awake()
{
// no need to register it yourself as API will register it on its own
// since the Plugin class implements the interface
}
public void BeforeApply(RunConfig config)
{
// Override seed before it gets set
config.Seed = 512;
}
}
Support and Suggestions
If you have any questions or suggestions, feel free to ping me (@kirsho) in modding community discord server!
Install & use Install: BepInEx plugin
- The archive from playbuff is the mod itself — usually a BepInEx plugin (a .dll or a plugin folder once unzipped).
- Recommended: use a community mod manager (such as r2modman) — pick this game, import the mod, and the manager sets up BepInEx and its dependencies for you.
- Manual route: install the BepInEx loader in the game folder, then drop the unzipped .dll or plugin folder into BepInEx/plugins/.
- Launch the game — the BepInEx console logs every plugin it loads; seeing this mod in the log means it is installed.
Mods with listed dependencies need those installed too, or they will not load. Options are usually changed in-game or in the plugin's config file.
Install these first, or the mod will not work: