Skip to content
James edited this page Dec 30, 2019 · 12 revisions

R2API is designed to provide an abstraction layer in order to expose and simplify APIs to allow developers to modify Risk of Rain 2 more easily, while still keeping mod interoperability in mind.

Contents:

R2API provides 3 files, each with a different purpose:

Assembly-CSharp.R2API.mm.dll

This is a MonoMod patch and is ran before any plugin is initialized

  • It fixes certain behaviour in the CatalogModHelper class
  • It prevents the game for searching non-game assemblies to prevent stuttering.
  • It prevents certain methods from inlining so that they can be hooked.

MMHOOK_Assembly-CSharp.dll

This assembly provides the On and IL hooks to R2API and other mods.

R2API.dll

R2API consists of two parts: it's submodules and it's utility functions.

R2API SubModules:

Starting with the December Content Update for Risk of Rain 2, mods will need to explicitly request submodules to be loaded. These are loaded under the R2API namespace.

AssetAPI

AssetAPI provides a way to load assetbundles into the game. Often used in combination with ResourcesAPI

AssetPlus

AssetPlus is an external project for loading language tokens/files, sounds and fonts. It's core repo may be found here

CommandHelper

Currently located under Utils.CommandHelper, CommandHelper allows mods to initialize their convars and concommands.

DifficultyAPI

DifficultyAPI adds a unified way for difficulty mods to add themselves to the menu.

EntityAPI

EntityAPI

InventoryAPI

InventoryAPI

ItemAPI

ItemAPI adds a unified way to add Items, equipment, and elites to the game

ItemDropAPI

ItemDropAPI creates a way for custom items and equipment to drop, while also allowing modders to prevent certain pickups from dropping.

LoadoutAPI

LoadoutAPI

LobbyConfigAPI

LobbyConfigAPI adds a unified way to add rules to the pregame lobby.

PlayerAPI

PlayerAPI is not a valid submodule at the time of writing. If it were, it'd provide an abstraction layer to the playerstats for an easier way of modifiying these.

ResourcesAPI

ResourcesAPI creates a detour for mods to load in their own resources/assets.

SurvivorAPI

SurvivorAPI adds a unified way to add additional survivors.

SkinAPI

SurvivorAPI Ask Rein

Skill

SurvivorAPI Ask Rein

R2API Utilities

These are generally located under R2API.Utils namespace.

Notification

Currently located under R2API namespace, this class is for creating generic notifcations.

ChatMessage

Eases up creating (colored) chat messages on mods.

ManualLogSourceExtension

After using R2API.Utils, this allows mods to generate block messages on their Logger provided by BepInEx.

Reflection

After using R2API.Utils, this extends types and objects with cacheable reflection methods. See the Risk of Thunder Wiki.