Metadata, Durability & Expiration
Nord stores arbitrary item metadata per item instance.
Metadata defaults
metadataDefaults = {
battery = 100,
ownerName = '',
quality = 100
}
Metadata can also be supplied when adding an item:
exports.nord_inventory:AddItem(source, 'phone', 1, {
number = '555-0102',
battery = 84
})
Durability
durability = {
initial = 100,
lossPerUse = 4
}
Shorthand:
durability = 4 -- lose 4% per successful use
Durability makes the item unique/non-stackable. For normal items, wear is applied after a successful use. At zero durability, the item is destroyed unless destroyAtZero = false.
Firearms
For firearms, lossPerUse is treated as wear per fired round. Equipping, holstering and reloading do not consume firearm durability.
Expiration
expiry = {
seconds = 48 * 60 * 60
}
Shorthand:
expiry = 86400 -- 24 hours
New instances receive a server timestamp. Expired items are pruned when inventories are loaded/opened and during normal cleanup, including items that expired while the player was offline.
Storage format
Lifecycle state lives in the item's metadata JSON, so durability/expiry does not require a separate item-instance SQL table.