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