core.metatables.sh_base_item
(no description)
Functions
AddAction(id)
View source »Add an action to this item
Parameters
-
id
item_action_ids or string
ID name for this action
Returns
-
item_action_builder action
AddLocalisationValue(field, value)
View source »Add a localisation variable to a given field. This is fed into L.
Parameters
-
field
string
The name of the field to add the localisation value for.
-
value
Value to pass to L.
Returns
-
self
AutoFunction(name, key)
View source »Creates an automatically named accessor function pair. It also returns a single param function, which sets a default value and returns the item.
Parameters
-
name
string
Function Key (Resolves to [GS]et
).
-
key
string
Internal key to set.
Returns
-
function
-
any
fun(data: any): base_item
Example Usage
local setDefault = ITEM:AutoFunction("SpecialValue", "internal_flag")
-- This creates ITEM:SetSpecialValue() and ITEM:GetSpecialValue().
-- Calling this function sets a value on ITEM.internal_flag.
-- Calling setDefault, sets the value now, returning the item. This is useful for chaining.
ITEM:AutoFunction("SomeValue", "this_defaults_to_false")(false)
See Also
AutoLocalise()
View source »Fill in as many fields as possible with localisation.
AutoRegister()
View source »Register an item, attempting to pull the item's UID from the file name.
See Also
Build()
View source »Creates the action, automatically registers it to this item and returns the action
Returns
-
item_action
Clone()
View source »Clone an item. Returns a new ITEM, with base set to the first item.
DisableAutoActions()
View source »Disable the automated action conversion for legacy items
Returns
-
self
GetBatch()
View source »Gets an item's batch
GetCategory()
View source »Gets an item's category
GetCategory()
View source »Gets an item's category
See Also
GetCost()
View source »Gets the Market Cost.
GetDesc()
View source »Alias of ITEM:GetDescription
See Also
GetDescription()
View source »Gets an item's description
GetInitialStock()
View source »Gets the initial dynamic economy stock for this item.
GetModel()
View source »Get an item's model.
GetName()
View source »Gets an item's name.
GetPlural()
View source »Gets an item plural.
GetPrice()
View source »Alias of ITEM:GetCost
See Also
GetSize()
View source »Gets an item's inventory size.
GetSkin()
View source »Get an item's skin.
GetStore()
View source »Get the item can be bought in the store.
GetStoreModel()
View source »Get an item's model in the market / inventory.
GetStoreSkin()
View source »Get an item's skin in the store page.
GetSupporter()
View source »Gets if the item is for supporters.
GetSupporterPlus()
View source »Gets if the item is for supporter plus.
GetTeam()
View source »Gets an item's team
Merge(data)
View source »Merge a table of data into the item.
Parameters
-
data
tab
Key/Value pairs of data.
Returns
-
self
New(base, data)
View source »Documentation for this section is incomplete and needs expanding.
Parameters
-
base
`T`
UniqueID of the item base to use
-
data
table or nil
Optional table of data
Returns
-
T or base_item
Created item class
Register(id)
View source »Register an item. This must be the last call in an item chain, as it does processing on the item.
Parameters
-
id
Set(name, value)
View source »Set a single key on the item.
Parameters
-
name
string
Key to set.
-
value
Value to set.
Returns
-
self
SetAction(func)
View source »Documentation for this section is incomplete and needs expanding.
Parameters
-
func
fun(baseItem: base_item, item: Item, client: Player, ...: any):
boolean
SetBatch()
View source »Sets the number of items created in a press of the manufacture button.
SetCat(data)
View source »Alias of ITEM:SetCategory
Parameters
-
data
string
New category
Returns
-
self
See Also
SetCategory(data)
View source »Sets the category of an item.
Parameters
-
data
string
New category
Returns
-
self
SetCondition(func)
View source »Documentation for this section is incomplete and needs expanding.
Parameters
-
func
fun(baseItem: base_item, item: Item, client: Player, ...: any):
boolean
SetCost()
View source »Sets the Market Cost.
SetData(name, value)
This function is deprecated and may be removed in a future version.
Set a single key on the item.
Parameters
-
name
string
Key to set.
-
value
Value to set.
Returns
-
self
See Also
SetDesc(data)
View source »Alias of ITEM:SetDescription
Parameters
-
data
string
New Description
Returns
-
self
See Also
SetDescription(data)
View source »Sets the Description of an item.
Parameters
-
data
string
New Description
Returns
-
self
SetIcon(icon)
View source »Documentation for this section is incomplete and needs expanding.
Parameters
-
icon
string
SetInitialStock()
View source »Sets the initial dynamic economy stock for this item.
SetMaxStack(val)
View source »Set the items max stack This is the maximum amount of items that can be stacked
Parameters
-
val
int
Max Stack
Returns
-
self
SetModel(model, skin, autoStore)
View source »Sets the model of the item. If model is true, the model and skin will be pulled from the store model. If autostore is true, model and skin will be pushed to the store model.
Parameters
-
model
string or true
Model path.
-
skin
int
Skin index.
-
autoStore
bool
optional
Should this call also automatically set the store models.
Returns
-
self
SetName(name, plural)
View source »Sets the name of an item.
If plural is undefined, defaults to "
Parameters
-
name
string
New name.
-
plural
string or false
default: <name>s
Optional plural to set.
Returns
-
self
SetName(name)
View source »Documentation for this section is incomplete and needs expanding.
Parameters
-
name
string
SetPlural(name)
View source »Sets the item's plural. If nil/false, item's name + s is used. If true, item's name is used. Otherwise passed name is used.
Parameters
-
name
SetPrice()
View source »Alias of ITEM:SetCost
See Also
SetSize()
View source »Sets the inventory size of this item.
SetSkin(skin, autoStore)
View source »Sets the skin of the item. If skin is true, it is pulled from the store skin.
Parameters
-
skin
int or true
skin
-
autoStore
bool
optional
If skin should be pushed to store skin.
SetSortRank(rank)
View source »Documentation for this section is incomplete and needs expanding.
Parameters
-
rank
integer
SetStackable(val)
View source »Set the item as stackable This means it can never contain unique data and adds a stack count Items will be able to stack up to the MaxStack value This is intended for use by simple items that never need unique data By default, an item not stackable
Parameters
-
val
bool
Unique Status
Returns
-
self
SetStore(val)
View source »Set if the item is in store, and its batch amount. If boolean, store is directly set. If 0, store is set to false. Otherwise store is set true and the value
Parameters
-
val
bool or int
Store Setting / Batch Amount
Returns
-
self
SetStoreModel(model, skin)
View source »Sets the store model of the item. If model is true, the model and skin will be pulled from the regular model.
Parameters
-
model
string or true
Model path.
-
skin
int
Skin index.
Returns
-
self
SetStoreSkin(skin, autoStore)
View source »Sets the store skin of the item. If skin is true, it is pulled from the item skin.
Parameters
-
skin
int or true
skin
-
autoStore
bool
optional
If skin should be pushed to item skin.
SetSupporter(data)
View source »Sets if the item is for supporters.
Parameters
-
data
bool
Supporter Required.
Returns
-
self
SetSupporterPlus(data)
View source »Sets if the item is for supporter plus.
Parameters
-
data
bool
Supporter Required.
Returns
-
self
SetTeam()
View source »Sets the team of an item.
Untradable()
View source »Marks an item as untradable. This disables dropping and giving, but can be overwritten later.
Tables
base_item
View source »The base item metatable for all items.
Fields
-
actions
table
item_action>
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
any
fun(self:
, item: Item, client: Player, invFrom: Inventory, invTo: Inventory): canTransfer? boolean Called to check if the item can be transferred.
-
any
fun(self:
, item: Item, client: Player, invFrom: Inventory, invTo: Inventory): canTransfer? boolean Called to check if the item can be transferred.
-
any
fun(self:
, item: Item, client: Player, invFrom: Inventory, invTo: Inventory): canTransfer? boolean Called to check if the item can be transferred.
-
any
fun(self:
, item: Item, client: Player, invFrom: Inventory, invTo: Inventory): canTransfer? boolean Called to check if the item can be transferred.
-
any
fun(self:
, item: Item, client: Player, invFrom: Inventory, invTo: Inventory): canTransfer? boolean Called to check if the item can be transferred.
-
any
fun(self:
, item: Item, client: Player, invFrom: Inventory, invTo: Inventory): canTransfer? boolean Called to check if the item can be transferred.
-
any
fun(self:
, item: Item, client: Player, invFrom: Inventory, invTo: Inventory): canTransfer? boolean Called to check if the item can be transferred.
-
any
fun(self:
, item: Item, client: Player, invFrom: Inventory, invTo: Inventory): canTransfer? boolean Called to check if the item can be transferred.
-
any
fun(self:
, item: Item, client: Player, invFrom: Inventory, invTo: Inventory): canTransfer? boolean Called to check if the item can be transferred.
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
-
self
fun(self:
, item: Item) ItemCreated? Called when this item is created as an instanced item
item_action
View source »Documentation for this section is incomplete and needs expanding.
Fields
-
id
string
-
name
string
-
icon
string
-
sortRank
integer
-
base_item
fun(baseItem:
, item: Item, client: Player, ...: any): action boolean
-
base_item
fun(baseItem:
, item: Item, client: Player, ...: any): action boolean
-
DMenu
fun(actionMenu:
, item: Item) onMenuOption?
item_action_builder
View source »Documentation for this section is incomplete and needs expanding.
Fields
-
private
item
base_item
-
private
item
base_item
-
private
item
base_item
-
base_item
fun(baseItem:
, item: Item, client: Player, ...: any): private boolean
-
base_item
fun(baseItem:
, item: Item, client: Player, ...: any): private boolean
-
private
item
base_item
-
private
item
base_item
Fields
ITEM.__index
View source »The lookup index for the item metatable.