Creating New Item Class
All Item classes must be placed under namespace Plugin.Items
Some code will not work in 1.1 version. This page will be updated later.
Class Functions
Init() - [OPTIONAL] class initialization(called when item spawned, both on Player and ItemPickup).
Update() - [OPTIONAL] called every frame on clients.
ServerUpdate() - [OPTIONAL] called every frame on server.
OnPickup() - [OPTIONAL] called when item pickuped(on Player).
OnDrop() - [OPTIONAL] called when item dropped(on Player).
OnUse() - [OPTIONAL] called when Player use this item.
OnHolster() - [OPTIONAL] called when Player holster this item.
OnDestroy() - [OPTIONAL] called on class destroy.
[1.1] CanDrop() - [OPTIONAL] return true if item can be dropped [DEFAULT: true].
[1.1] CanEquip() - [OPTIONAL] return true if player can equip item [DEFAULT: true].
[1.1] CanHolster() - [OPTIONAL] return true if player can holster item [DEFAULT: true].
GetName() - [REQUIRED] return displayed item name, return string [DEFAULT: "item"].
GetImage() - [REQUIRED] return image ID that displayed in inventory, return string [DEFAULT: "item"].
OnRefine(int type) - [OPTIONAL] return item ID(empty to destroy item) when item used in SCP-914(type: 0 - rough, 1 - coarse, 2 - 1:1, 3 - fine, 4 - very fine), return string [DEFAULT: ""].
GetKeyData() - [OPTIONAL] return information about key card, return KeyData class [DEFAULT: null].
Local Properties
player - return current Player class, if player contains it in inventory.
itemPickup- return current ItemPickup class, if item dropped.
Local Functions
SendToEveryone(string FunctionName, params object[] arguments) - send command to every player to call function with arguments.
SendToClient(string FunctionName, NetworkConnection connection, params object[] arguments) - send command to player with connection to call function with arguments.
SendToServer(string FunctionName, params object[] arguments) - send command to server to call function with arguments.
Invoke(Function, float seconds) - same logic as UnityEngine.Object.Invoke, call function after time.
Example
Example Solution can be downloaded here: Link to archive
Testing
Now we can compile this plugin and move library to server plugins folder according to Folder Structure Now we can spawn our item:
Last updated