Downpour Reference/BepInEx Files

From Rain World Modding
Jump to navigation Jump to search

DLL files are stored in and loaded directly from the mod folders. This page describes how BepInEx is handled in Downpour.

Directory Structure

Toggleable DLLs

The DLL files for your mod will go within a cooresponding location in your mod's folder. DLL files included this way can be toggled on and off using the in-game REMIX menu. DLL files can be called any name, but need to be placed into the following folders to be recognized:

  • your-mod-folder/plugins/*.dll - Location for any BepInPlugins.
  • your-mod-folder/patchers/*.dll - Location for any patch mods.

Here, "your-mod-folder" is a subfolder in Rain World/RainWorld_Data/StreamingAssets/mods (see Downpour Reference/Mod Directories). Its exact name does not affect the mod loading, but it is a good idea to name it something sensible anyways.

Note that Downpour does not attempt to hot-reload DLL mods. If a mod is toggled on or off in the REMIX menu that contains a DLL file, the game will force a relaunch to finish the mod applying process.

Mod Lifecycle Functions

The following lifecycle functions exist in the RainWorld class (you need to hook them) that can be useful for initializing/uninitializing, loading/unloading resources for your mod when it is toggled on and off.

Method Meaning
OnModsInit() Called when the game is first launched if your mod is one of the enabled mods. Also called any time mods are applied in the REMIX menu if your mod is one of the enabled mods. Because it is called any time the apply button is pressed, expect that this function can be called multiple times in a single game session, so provide checks to ensure you are not double-loading resources if it is called again.
PreModsInit() Called right before the OnModsInit() function.
PostModsInit() Called right after the OnModsInit() function.
OnModsEnabled() Unlike the init function, this is not called when the game is launched. It is called when mods are applied in the REMIX menu, if your mod is now enabled, but only if it was previously disabled. This is unlike the init function which will be called whenever your mod is enabled even if it was previously enabled as well. This function recieves an argument which contains a list of all newly enabled mods that weren't previously enabled.
OnModsDisabled() The opposite of the above function. Called when mods are applied in the REMIX menu, if the mod is now disabled, but only if it was previously enabled. This function recieves an argument which contains a list of all newly disabled mods that were previously enabled.
PreModsDisabledEnabled() Called before any of the enabled/disabled/init functions are called. Only part of the apply mods workflow; does not get called on game launch.
PostModsDisabledEnabled() Called after all of the enabled/disabled/init functions are finished being called. Only part of the apply mods workflow; does not get called on game launch.

Utility Files

For convenience, the following Assembly-CSharp associated files are automatically generated and available for use:

  • BepInEx/plugins/HOOKS-Assembly-CSharp.dll - Hookgen for Assembly-CSharp
  • BepInEx/utils/PUBLIC-Assembly-CSharp.dll - Assembly-CSharp with all members public