RAPI

Get the player username from a SteamID.

Method
Example
Method
string GetUsernameFromSteamID(CSteamID steamid)
Example
string username = RAPI.GetUsernameFromSteamID(playersteamid);
RConsole.Log("The player name is " + username);

Toggle the mouse cursor.

Method
Example
Method
void ToggleCursor(bool var)
Example
RAPI.ToggleCursor(true); // This will show the cursor.
RAPI.ToggleCursor(false); // This will hide the cursor.

Register a new item.

Method
Example
Method
void RegisterItem(Item_Base item)
Example
// Here we load the item from the assetbundle
Item_Base yournewitem = asset.LoadAsset<Item_Base>("yournewitem");
// Then we register it using RegisterItem()
RAPI.RegisterItem(yournewitem);

Set an item prefab.

Method
Example
Method
void SetItemObject(Item_Base item, GameObject prefab)
// The default hand is right. RItemHand can be leftHand or rightHand.
void SetItemObject(Item_Base item, GameObject prefab, RItemHand parent)
Example
// Here we load the item from the assetbundle
Item_Base yournewitem = asset.LoadAsset<Item_Base>("yournewitem");
// Then we register it using RegisterItem()
RAPI.RegisterItem(yournewitem);
// Then we set his prefab by loading it from the assetbundle
RAPI.SetItemObject(yournewitem, asset.LoadAsset<GameObject>("yournewitem"));

Gets the local Network_Player script.

Method
Example
Method
Network_Player GetLocalPlayer()
Example
Network_Player player = RAPI.GetLocalPlayer();
// The player variable will contain the local player script.

Give an item to the local player.

Method
Example
Method
void GiveItem(Item_Base item, int amount)
Example
RAPI.GiveItem(ItemManager.GetItemByName("raw_potato"),10);
// This will give 10 raw potatoes to the local player.

Broadcast a chat message.

Method
Example
Method
void BroadcastChatMessage(string message)
Example
RAPI.BroadcastChatMessage("I'm a message");
// Will send "I'm a message" to every players.

Allow the placement of a block on the grid system.

Method
Example
Method
void AddItemToBlockQuadType(Item_Base item, RBlockQuadType quadtype)
Example
RAPI.AddItemToBlockQuadType(YourNewItem, RBlockQuadType.quad_foundation);
// Allow "YourNewItem" to be placed on foundations.

Disallow the placement of a block on the grid system.

Method
Example
Method
void RemoveItemFromBlockQuadType(string itemUniqueName, RBlockQuadType quadtype)
Example
RAPI.RemoveItemFromBlockQuadType("YourItemUniqueName", RBlockQuadType.quad_foundation);
// Disallow the item with the uniquename "YourItemUniqueName" to be placed on foundations.
‚Äč