Part Item
Each part is defined as an entry in your parts table with configurable fields for how it behaves during installation, usage, and interaction with vehicles.
📄 Fields:
label
string
✅
The display name of the part.
searchChance
number
✅
Chance this item is found in a search. Set to 0 to make it unsearchable. Think of it like names in a hat—more entries = higher odds.
weight
number
✅
Weight of the part in the inventory (e.g., 1000 = 1kg).
tools
table
❌
Tools required to fit this part. Format: { itemName = quantity }.
consumables
table
❌
Items that will be consumed when installing this part. Same format as tools.
anim
table
❌
Animation config when applying the part.
→ dict
string
⚠️
Animation dictionary. Must specify either dict or scenario.
→ clip
string
✅
Animation clip name.
→ flag
number
❌
Optional animation flags.
→ time
number
❌
Time in seconds to complete the install animation.
reqParts
array
❌
Names of other parts required before this one can be installed.
model
string
❌
Prop model name shown in hand or placed during install (e.g. "prop_oilcan_01a").
applyRange
number
❌
Max distance from the vehicle to allow this part to be installed.
applyAtBone
string
❌
The bone name where this part applies (e.g., "engine").
canStart
function
❌
Function run to check if the car can start based on this part. Parameters:<br/>→ itemExists: boolean (is part installed?)<br/>→ _type: string (part name)<br/>Should return: boolean, message.
removePart
function
❌
Function triggered when removing the part. Parameters:<br/>→ self: vehicle object<br/>→ entity: number (vehicle entity ID)<br/>→ _type: string (part name).
addPart
function
❌
Function triggered when adding the part. Same parameters as removePart.
💡 Example
luaCopyEditparts = {
oil_filter = {
label = "Oil Filter",
searchChance = 15,
weight = 250,
tools = { wrench = 1 },
consumables = { oil = 1 },
anim = {
dict = "anim@amb@clubhouse@tutorial@bkr_tut_ig3@",
clip = "machinic_loop_mechandplayer",
flag = 16,
time = 5
},
reqParts = { "engine_cover" },
model = "prop_oilcan_01a",
applyRange = 2.0,
applyAtBone = "engine",
canStart = function(installed, part)
return installed, installed and "" or "Engine won't start without oil filter."
end,
removePart = function(self, entity, part)
-- custom logic to clean up or detach
end,
addPart = function(self, entity, part)
-- apply tuning or set vars
end
}
}Last updated