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.

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.

Get a mod attribute.

Method
Example
Method
string GetModTitle(Type modClass)
string GetModDescription(Type modClass)
string GetModAuthor(Type modClass)
string GetModVersion(Type modClass)
string GetModRaftVersion(Type modClass)
string GetModIconUrl(Type modClass)
string GetModWallpaperUrl(Type modClass)
string GetModVersionCheckUrl(Type modClass)
bool GetModIsPermanent(Type modClass)
Example
RAPI.GetModVersion(typeof(YourModClass))
// This will return your mod version attribute value as a string.
// Only RAPI.GetModIsPermanent(Type modClass) returns a bool.