Client
Provides client functionality for item behaviour.
Functions
Section titled “Functions”GetViewmodelItem
Section titled “GetViewmodelItem”Returns the item instance in the viewmodel. Allows you to make changes to the viewmodel item model. May return nil in various circumstances.
Returns
Section titled “Returns”MapObject?
DeductAmmo
Section titled “DeductAmmo”Decreases the ammo of the item by 1, updating UI.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
item | Item | The item. |
ApplyInterval
Section titled “ApplyInterval”Sets the last use timestamp for the item.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
item | Item | The item. | |
action | "Primary" | "Alternate" | The action. |
MuzzleFlash
Section titled “MuzzleFlash”Does the muzzle flash for an item, if applicable.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
item | Item | The item. |
Recoil
Section titled “Recoil”Recoils from an item.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
item | Item | The item. |
PlayEmptyClipSound
Section titled “PlayEmptyClipSound”Plays the empty clip sound.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
item | Item | The item. |
PrimaryFire
Section titled “PrimaryFire”Performs the primary fire action on the client, setting server data. This function does not itself replicate the fire to the server.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
item | Item | The item. | |
origin | Vector3 | The origin. | |
direction | Vector3 | The direction, not accounting for spread. | |
noEffects | boolean? | If true, the item state will not change, and visual effects will not be played. The item’s server data will still be set (regardless of noEffects, this is not yet replicated). |
Returns
Section titled “Returns”string | {string} | boolean
If returning a string, or table of strings, the primary fire was rejected with the provided reason(s). If returning a boolean, true indicates that the primary fire was successful, false indicates it was rejected with no further reason.
Aims the item if possible.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
item | Item | The item. |
Returns
Section titled “Returns”boolean
Always returns true.
TryReloadWeapon
Section titled “TryReloadWeapon”Attempts to reload the weapon. Returns true if successful, false if not.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
item | Item | The item. |
Returns
Section titled “Returns”boolean
ServerFire
Section titled “ServerFire”Tells the server that an action was performed.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
action | "Primary" | "Alternate" | The action. | |
item | Item | The item. | |
origin | Vector3 | The origin. | |
direction | Vector3 | The direction, adjusted for spread |