Parts

Parts that need to be added to the vehicle for completion.

If bone and bone doesnt exist on the vehicle, it will default to fitted to prevent unfinishable projects


label:

type: string

Example
label = "Coolant",

searchChance:

type: number

Set to 0 if you dont want this item to be searchable

  • Think of names in a hat, how many times is this name in the hat?

Example
searchChance  = 10,

weight:

type: number

  • The weight of the item in the inventory

Example
weight = 1,

tools?:

type: table (object)

  • Tools required to fit this part ex: {funnel = 1}

    • item?: number Quantity required

Example
tools = {wrench = 1},

consumables?:

type: table (object)

  • Consumables required to fit this part, these will be removed.

    • item?: number Quantity required

Example
consumables = {bolts = 5},

anim?:

type: table (object)

  • dict?: string

    • Must specify either scenario or dict

  • clip: string

  • flag?: number

  • time?: number time required to fit the part

Example
anim = {
    dict = "anim@amb@clubhouse@tutorial@bkr_tut_ig3@",
    anim = "machinic_loop_mechandplayer",
    time = 10000
},

reqParts?:

type: table (array)

  • other part names required before fitting this part

Example
reqParts = {"engine"},

model?:

type: string (prop name)

  • the model name of part that is carried in hand/placed on floor whilst installing

Example
model = "prop_oiltub_03",

applyRange?:

type: number

  • the maximum range from vehicle this part can be installed

Example
applyRange = 1.5,

applyAtBone?:

type: string

  • the bone where this part needs to be applied at (ex: "engine" for coolant)

Example
applyAtBone = "engine",

canStart?:

function triggered when trying to start project vehicle

type: function(itemExists, _type)

Parameters

type: boolean

if this part is applied or not

Return

Wether or not the car can start, based on this part

Example
canStart = function(itemExists, _type)
      if not itemExists then
            return false, string.format("Missing wheel %s", _type == "wheel_lf" and "left front" or _type == "wheel_rf" and "right front" or _type == "wheel_lr" and "left rear" or _type == "wheel_rr" and "right rear")
      end
end,

removePart?:

function triggered to remove parts from base vehicle

type: function(self, entity, _type)

type: object

the car object

Example
removePart  = function(self, entity, _type)
      SetVehicleColours(entity, 14, 14)
end,

addPart?:

function triggered when part is added

type: function(self, entity, _type)

type: object

the car object

Example
    addPart     = function(self, entity, _type)
      local thisCar = projectCar.getByEntity(entity)
      local colorData = thisCar.parts['carpaint'].colors
      if colorData then
        local primaryColor = colorData.primary
        if primaryColor then
          SetVehicleCustomPrimaryColour(entity, primaryColor.r, primaryColor.g, primaryColor.b)
        end
        local secondaryColor = colorData.secondary
        if secondaryColor then
          SetVehicleCustomSecondaryColour(entity, secondaryColor.r, secondaryColor.g, secondaryColor.b)
        end
      end
    end,

Last updated