


The R.E.P.O Mod Library is a mod library for the game R.E.P.O, designed to provide a comprehensive set of utility functions and shared data management for modding the game. Created by Lillious & .Zer0, this library offers extensive control over player mechanics, game state tracking, and system interactions.
Supports the latest version of R.E.P.O
Compatible with MelonLoader v0.7.0 modding framework
Compatibility may vary with BepInEx modding framework using the BepInEx.MelonLoader.Loader plugin
Currently still in early development, so expect missing features and bugs
The R.E.P.O Mod Library provides a comprehensive set of utilities that enable:
using MelonLoader;
using Repo_ExampleMod;
using Repo_Library;
// MelonInfo attribute to define the mod information
[assembly: MelonInfo(typeof(Example), "R.E.P.O Example Mod", "1.0.0", "Example")]
// MelonGame attribute to specify the game the mod is for
[assembly: MelonGame("semiwork", "REPO")]
// Namespace for the mod
namespace Repo_ExampleMod
{
public class Example : MelonMod
{
private readonly Library Repo_Lib = new Library();
// Override the unity update method
public override void OnUpdate()
{
// Check if player is in game
if (!Repo_Lib.IsInGame()) return;
// Get the player controller
PlayerController playerController = Repo_Lib.GetPlayerController();
// Check if player is sprinting
if (Repo_Lib.IsSprinting(playerController))
{
// Set the sprint energy drain to 0
Repo_Lib.SetSprintEnergyDrain(playerController, 0f);
// Set the player's energy to the max energy
Repo_Lib.SetPlayerCurrentEnergy(playerController,
Repo_Lib.GetPlayerMaxEnergy(playerController));
}
}
}
}
The following provides information about the utility functions available in the game system. These functions are categorized based on their purpose and functionality.
| Function | Description |
|---|---|
SetSteamId(ulong steamId) |
Sets the player's Steam ID |
GetSteamId() |
Returns the player's Steam ID |
SetPlayerController(PlayerController playerController) |
Associates a PlayerController with the player data |
GetPlayerController() |
Returns the player's PlayerController instance |
SetPlayerCollision(PlayerCollision playerCollision) |
Sets the player's collision component |
GetPlayerCollision() |
Returns the player's collision component |
| Function | Description |
|---|---|
SetInititialized(bool value) |
Sets the initialization status of the scene |
IsInitialized() |
Checks if the game has been initialized |
SetInMainMenu(bool value) |
Sets whether the player is in the main menu |
IsInMainMenu() |
Checks if the player is in the main menu |
SetInLobby(bool value) |
Sets whether the player is in the lobby |
IsInLobby() |
Checks if the player is in the lobby |
SetInShop(bool value) |
Sets whether the player is in the shop |
IsInShop() |
Checks if the player is in the shop |
SetInArena(bool value) |
Sets whether the player is in the arena |
IsInArena() |
Checks if the player is in the arena |
SetInTruckLobby(bool value) |
Sets whether the player is in the truck lobby |
IsInTruckLobby() |
Checks if the player is in the truck lobby |
SetInGame(bool value) |
Sets whether the player is in an active game |
IsInGame() |
Checks if the player is in an active game |
| Function | Description |
|---|---|
SetLevels(List<Level> levels) |
Sets the available game levels |
GetLevels() |
Returns the list of available game levels |
SetMenuLevels(List<Level> levels) |
Sets the available menu levels |
GetMenuLevels() |
Returns the list of available menu levels |
SetMap(GameObject map) |
Sets the current map GameObject |
GetMap() |
Returns the current map GameObject |
GetMapContoller() |
Returns the Map component controller from the current map |
SetLevelGenerator(GameObject levelGenerator) |
Sets the level generator GameObject |
GetLevelGenerator() |
Returns the level generator GameObject |
GetLevelGeneratorController() |
Returns the LevelGenerator component from the level generator |
GetGameDirector(GameObject gameDirector) |
Returns the GameDirector component from the specified GameObject |
SetGameDirector(GameObject gameDirector) |
Sets the GameDirector component from the specified GameObject |
GetGameDirectorController() |
Returns the GameDirector component from the current map |
SetPostProcessing(PostProcessing postProcessing) |
Sets the PostProcessing component for the current map |
GetPostProcessing() |
Returns the PostProcessing component for the current map |
| Function | Description |
|---|---|
SetStatsManager(StatsManager statsManager) |
Sets the stats manager instance |
GetStatsManager() |
Returns the stats manager instance |
SetRunManager(RunManager runManager) |
Sets the run manager instance |
GetRunManager() |
Returns the run manager instance |
SetGraphicsManager(GraphicsManager graphicsManager) |
Sets the graphics manager instance |
GetGraphicsManager() |
Returns the graphics manager instance |
SetGameplayManager(GameplayManager gameplayManager) |
Sets the gameplay manager instance |
GetGameplayManager() |
Returns the gameplay manager instance |
SetAssetManager(AssetManager assetManager) |
Sets the asset manager instance |
GetAssetManager() |
Returns the asset manager instance |
SetAudioManager(AudioManager audioManager) |
Sets the audio manager instance |
GetAudioManager() |
Returns the audio manager instance |
SetNetworkManager(NetworkManager networkManager) |
Sets the network manager instance |
GetNetworkManager() |
Returns the network manager instance |
| Function | Description |
|---|---|
GetEnemyCount() |
Returns the current number of enemies in the level |
GetEnemies() |
Returns a list of all enemies in the current level |
FreezeEnemies(bool freeze) |
Freezes or unfreezes all enemies in the current level by toggling their controller components |
DisableEnemies(bool disable) |
Disables or enables all enemies in the current level (note: some enemies might be reactivated by the game) |
DrawLineToEnemy() |
Draws a line from the player to all enemies in the level and displays distance |
ClearEnemyLines() |
Clears all enemy lines drawn by DrawLineToEnemy() |
SetEnemies(GameObject[] enemies) |
Sets the list of enemies in the current level |
GetEnemies() |
Returns the list of enemies in the current level |
| Function | Description |
|---|---|
GetItemsInMap() |
Returns a list of items in the map |
SetDisableItemDurability() |
Disables durability of all items in the map |
SetEnableItemDurability() |
Enables durability of all items in the map |
SpawnItem(GameObject item, Vector3 position) |
Spawns an item at the specified position (AssetManager.instance.surplusValuableSmall) |
SetItems(GameObject[] items) |
Sets the list of items in the map |
GetItems() |
Returns the list of items in the map |
DrawLineToItem() |
Draws a line from the player to all items in the map and displays distance |
ClearItemLines() |
Clears all item lines drawn by DrawLineToItem() |
| Function | Description |
|---|---|
RespawnPlayer(PlayerController playerController) |
Instantly moves the player to a default spawn point (0, 0, -21) |
TeleportPlayer(PlayerController playerController, Vector3 position) |
Teleports the player to a specified position |
AntiGravity(PlayerController playerController, float time) |
Applies anti-gravity effect to the player for the specified duration |
HealPlayer(GameObject playerAvatar, int health) |
Heals the player by the specified amount |
DestroyObject() |
Destroys breakable objects close to the player |
SetPlayerAvatar(GameObject playerAvatar) |
Sets the player's avatar GameObject |
GetPlayerAvatar() |
Returns the player's avatar GameObject |
| Function | Description |
|---|---|
SetPlayerCurrentEnergy(PlayerController playerController, float energy) |
Sets the player's current energy level |
SetPlayerMaxEnergy(PlayerController playerController, float energy) |
Sets the player's maximum energy capacity |
GetPlayerMaxEnergy(PlayerController playerController) |
Gets the player's maximum energy capacity |
SetSprintEnergyDrain(PlayerController playerController, float energy) |
Sets the energy drain rate when sprinting |
SetCrouchSpeed(PlayerController playerController, float speed) |
Sets the player's movement speed while crouching |
GetMovementSpeed(PlayerController playerController) |
Gets the player's normal movement speed |
SetMovementSpeed(PlayerController playerController, float speed) |
Sets the player's normal movement speed |
SetSprintSpeed(PlayerController playerController, float speed) |
Sets the player's sprint movement speed |
GetSprintSpeed(PlayerController playerController) |
Gets the player's sprint movement speed |
IsSprinting(PlayerController playerController) |
Checks if the player is currently sprinting |
SetSprinting(PlayerController playerController, bool value) |
Forces the player's sprint state on or off |
SetSpeedUpgradeAmounts(PlayerController playerController, int amount) |
Sets the number of speed upgrades the player has |
GetCustomGravity(PlayerController playerController) |
Gets the custom gravity value for the player |
SetCustomGravity(PlayerController playerController, float gravity) |
Sets a custom gravity value for the player |