Tool
Tool System
Understanding Special Slots
The lvs_inventory system supports special slots for specific item types. The tool system uses the special slot named 'tool'.
How Tools Work
When a recipe requires a tool (e.g., tool = { name = 'lvs_wrench', degrade = 0.05 }), the system:
Checks if the player has an item in their tool special slot
Verifies the item name matches the required tool name
Checks tool durability (if
degradeis set)Reduces durability by
degrade * 100per craftDestroys the tool when durability reaches 0
Creating Tool Items
1. Define the item in your lvs_shops config/shops.lua file:
shops = {
{
type = 'youtool',
...
items = {
{
type = 'tool', -- category name
name = 'lvs_wrench',
price = 1000,
metadata = {
type = 'tool',
durability = 100
}
},
{
type = 'tool',
name = 'lvs_screwdriver',
price = 250,
metadata = {
type = 'tool',
durability = 100
}
}
}
...
},
...
}2. The item must have metadata.type = 'tool' to fit in the tool slot.
When giving the item via command or script, include the tool type:
Tool Durability Mechanics
Starting durability: 100 (or custom value in metadata)
Durability loss:
recipe.tool.degrade * 100per craftExample:
degrade = 0.05→ loses 5 durability per craft → 20 crafts until destroyedWhen durability reaches 0: Tool is automatically removed from inventory
If
degrade = 0: Tool has infinite durability (no loss)
Last updated