Item Definition Structure
Items are defined inshared/items.lua files across resources:
Required Fields
string
required
Unique item identifierRules:
- Lowercase, no spaces
- Use underscores for multi-word items
- Descriptive and consistent
"water", "weapon_pistol", "lockpick", "driver_license"string
required
Display name shown to playersExamples:
"Water Bottle", "Pistol", "Lockpick", "Driver's License"number
required
Item weight in kilogramsGuidelines:
- Small items: 0.1 - 0.5 kg
- Medium items: 0.5 - 2 kg
- Large items: 2 - 10 kg
- Very heavy: 10+ kg
Optional Fields
Display Properties
string
Detailed item description shown in tooltipsExample:
string
default:"default.png"
Image filename in
ui/assets/items/ directoryFormat: PNG, recommended 150x150pxExample: "water.png", "weapon_pistol.png"Usage Properties
boolean
default:"false"
Whether the item can be used from inventoryExample:
boolean
default:"false"
Whether the item is removed from inventory when usedNote: This is a client interpretation flag. The actual removal must be implemented in the use code.Example:
number|boolean
default:"false"
Stack size limit. Use
false for non-stackable items, or a number for the maximum stack size.Example:boolean
default:"false"
Whether item is completely removed when durability reaches 0Example:
number
default:"0"
Time in seconds for the item to fully degrade. Set to
0 for no decay.Example:boolean
default:"false"
Whether to close the inventory UI after using the itemExample:
boolean
default:"false"
Whether the item is metallic (affects metal detectors, etc.)Example:
string
Character state key that is added when item is used and removed when item is lostExample:
Item Types
Thetype field uses numeric codes to categorize items:
Rarity Levels
Therarity field also uses numeric codes:
Complete Item Examples
Consumable Item
Weapon Item
Tool Item
Document Item
Material Item
Phone Item (with Durability)
Item Metadata
Metadata stores instance-specific data for unique or stackable items:Common Metadata Fields
Accessing Metadata
Creating Custom Items
Step 1: Define the Item
Step 2: Register with Items Component
Step 3: Handle Item Usage
Step 4: Add Item Image
Placeenergy_drink.png (150x150px) in:
Item Categories and Organization
Group related items for easy management:Best Practices
Consistent Naming
Consistent Naming
Use a consistent naming scheme:
Realistic Weights
Realistic Weights
Balance gameplay with realism:
Clear Descriptions
Clear Descriptions
Write helpful descriptions:
Appropriate Pricing
Appropriate Pricing
Balance economy:
Metadata Defaults
Metadata Defaults
Provide sensible defaults:
Item Validation
Validate items before adding to inventory:Next Steps
Inventory - Exports
Inventory management methods
Inventory - Events
Inventory events
Items System
Using and creating items
Crafting System
Item crafting and recipes