The RAPI class provides convenient methods for various actions, including adding new items and showing the cursor, making modding tasks easier and more accessible.

Checks if the game is running on a dedicated server.

Returns true if the game is running on a dedicated server, false otherwise.

// RAPI.IsDedicatedServer()
public static bool IsDedicatedServer()

Checks if the current active scene is the main menu.

Returns true if the current active scene is the main menu, false otherwise.

// RAPI.IsCurrentSceneMainMenu()
public static bool IsCurrentSceneMainMenu()

Checks if the current active scene is the main game scene.

Returns true if the current active scene is the main game scene, false otherwise.

// RAPI.IsCurrentSceneGame()
public static bool IsCurrentSceneGame()

Gets the username associated with a SteamID.

Returns the player's username.

// RAPI.GetUsernameFromSteamID(Steamworks.CSteamID)
public static string GetUsernameFromSteamID(CSteamID steamid)

Toggle the mouse cursor with high priority (mostly used by the mod loader).

// RAPI.TogglePriorityCursor(System.Boolean)
public static void TogglePriorityCursor(bool status)

Toggle the mouse cursor.

// RAPI.ToggleCursor(System.Boolean)
public static void ToggleCursor(bool status)

Gets the local player object from the network.

Returns the local player object.

// RAPI.GetLocalPlayer()
public static Network_Player GetLocalPlayer()

Broadcasts a chat message to all players.

// RAPI.BroadcastChatMessage(System.String)
public static void BroadcastChatMessage(string message)

Gives a specified amount of items to the local player.

// RAPI.GiveItem(Item_Base,System.Int32)
public static void GiveItem(Item_Base item, int amount)

Allows an item to be placed on a specific block quad type.

// RAPI.AddItemToBlockQuadType(Item_Base,RBlockQuadType)
public static void AddItemToBlockQuadType(Item_Base item, RBlockQuadType quadtype)

Disallows an item from being placed on a specific block quad type.

// RAPI.RemoveItemFromBlockQuadType(System.String,RBlockQuadType)
public static void RemoveItemFromBlockQuadType(string itemUniqueName, RBlockQuadType quadtype)

Registers a new item.

// RAPI.RegisterItem(Item_Base,System.Boolean)
public static void RegisterItem(Item_Base item, bool ignoreMaxValues = false)

Unregisters an item, removing it from inventories and world.

// RAPI.UnregisterItem(Item_Base)
public static void UnregisterItem(Item_Base item)

Sets the in-hand prefab object for a specific item.

// RAPI.SetItemObject(Item_Base,UnityEngine.GameObject,RItemHand)
public static void SetItemObject(Item_Base item, GameObject prefab, RItemHand parent = RItemHand.rightHand)

Sends a network message to all players.

// RAPI.SendNetworkMessage(Message,System.Int32,Steamworks.EP2PSend,Target,Steamworks.CSteamID)
public static void SendNetworkMessage(Message message, int channel = 0, EP2PSend ep2psend = EP2PSend.k_EP2PSendReliable, Target target = Target.Other, CSteamID fallbackSteamID = new CSteamID())

Listens for network messages on a specific network channel.

Returns the received network message.

// RAPI.ListenForNetworkMessagesOnChannel(System.Int32)
public static NetworkMessage ListenForNetworkMessagesOnChannel(int channel = 2)

Last updated