base_food
Food Base Item.
The food base is an item which a bunch of helpers for handling edible items.
Functions
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
-
ITEM
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
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.
Returns
-
ITEM
AutoRegister()
View source »Register an item, attempting to pull the item's UID from the file name.
See Also
Clone()
View source »Clone an item. Returns a new ITEM, with base set to the first item.
Returns
-
ITEM
Food(hunger)
View source »Mark this item as a food item, restoring a given amount of hunger.
Parameters
-
hunger
int
The amount of hunger to restore.
GetBatch()
View source »Gets an item's batch
Returns
-
int
Batch Size
GetCategory()
View source »Gets an item's category
Returns
-
string
Item's Category
GetCost()
View source »Gets the Market Cost.
Returns
-
int
Item's Cost
GetDesc()
View source »Alias of ITEM:GetDescription
Returns
-
string
Item's Description
See Also
GetDescription()
View source »Gets an item's description
Returns
-
string
Item's Description
GetHungerRestoration()
View source »Gets the amount of hunger this food restores.
Returns
-
int
The amount of hunger restored.
GetInitialStock()
View source »Gets the initial dynamic economy stock for this item.
Returns
-
int
Stock
GetModel()
View source »Get an item's model.
Returns
-
string
Model path.
GetName()
View source »Gets an item's name.
Returns
-
string
Name
GetPlural()
View source »Gets an item plural.
Returns
-
string
Pluralised name.
GetPrice()
View source »Alias of ITEM:GetCost
Returns
-
int
Item's Cost
See Also
GetSize()
View source »Gets an item's inventory size.
Returns
-
int
Size
GetStore()
View source »Get the item can be bought in the store.
Returns
-
bool
Buyable status.
GetStoreModel()
View source »Get an item's model in the market / inventory.
Returns
-
string
Model path.
GetStoreSkin()
View source »Get an item's skin in the store page.
Returns
-
int
Model skin index.
GetSupporter()
View source »Gets if the item is for supporters.
Returns
-
bool
If supporter is required.
GetSupporterPlus()
View source »Gets if the item is for supporter plus.
Returns
-
bool
If supporter plus is required.
GetTeam()
View source »Gets an item's team
Returns
-
int
Item's Team.
Merge(data)
View source »Merge a table of data into the item.
Parameters
-
data
tab
Key/Value pairs of data.
Returns
-
ITEM
New(base, data)
View source »Create a new item.
Parameters
-
base
string
UniqueID of the baseclass.
-
data
tab
Optional data to fill into the item.
Returns
-
ITEM
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
string
optional
UniqueID to set, not required if set prior.
Set(name, value)
View source »Set a single key on the item.
Parameters
-
name
string
Key to set.
-
value
Value to set.
Returns
-
ITEM
SetBatch(data)
View source »Sets the number of items created in a press of the manufacture button.
Parameters
-
data
int
Batch
Returns
-
ITEM
SetCat(data)
View source »Alias of ITEM:SetCategory
Parameters
-
data
string
New category
Returns
-
ITEM
See Also
SetCategory(data)
View source »Sets the category of an item.
Parameters
-
data
string
New category
Returns
-
ITEM
SetCost(cost)
View source »Sets the Market Cost.
Parameters
-
cost
int
Cost.
Returns
-
ITEM
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
-
ITEM
See Also
SetDesc(data)
View source »Alias of ITEM:SetDescription
Parameters
-
data
string
New Description
Returns
-
ITEM
See Also
SetDescription(data)
View source »Sets the Description of an item.
Parameters
-
data
string
New Description
Returns
-
ITEM
SetHungerRestoration(value)
This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.
Sets the amount of hunger this food restores.
Parameters
-
value
int
The new hunger value for this item.
See Also
SetInitialStock(data)
View source »Sets the initial dynamic economy stock for this item.
Parameters
-
data
int
Initial Stock Count
Returns
-
ITEM
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
-
ITEM
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
-
ITEM
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
string or true
optional
Returns
-
ITEM
SetPrice(data)
View source »Alias of ITEM:SetCost
Parameters
-
data
int
Cost.
Returns
-
ITEM
See Also
SetSize(data)
View source »Sets the inventory size of this item.
Parameters
-
data
int
Size
Returns
-
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.
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
-
ITEM
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
-
ITEM
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
-
ITEM
SetSupporterPlus(data)
View source »Sets if the item is for supporter plus.
Parameters
-
data
bool
Supporter Required.
Returns
-
ITEM
SetTeam(data)
View source »Sets the team of an item.
Parameters
-
data
int
Team Index
Returns
-
ITEM
Untradable()
View source »Marks an item as untradable. This disables dropping and giving, but can be overwritten later.
Returns
-
ITEM
Fields
__index
View source »The lookup index for the item metatable.
-
__index
table
category
View source »Inventory / Market Category
-
category
string
cost
View source »Item Cost
-
cost
int
The cost of the item as bought in the market. Also used for inventory valuations and refund sales.
description
View source »Description of the item.
-
description
string
model
View source »Model Path
-
model
string
Path of the model used in the F1 menu / dropped states.
name
View source »Item Name.
-
name
string
The localised name, as shown in the F1 menu.
size
View source »Item Size
-
size
number
The inventory space used per item.
skin
View source »Skin used in the F1 menu.
-
skin
int
store
View source »Market Availability
-
store
bool