Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit3bb1da2647

README.md

Part

Attach parts to the slots of another object: a wheel to a wheel mount, an engine to an engine bay, a weapon to a hardpoint, a module to a socket. Part declares the kinds of slot a part fits. Put it on the root of a bundle that fills slots (a wheel, an engine, a seat, a turret, a wall module): the bundle then fits every Slot whose kind its fits names. The declaration lives in the bundle's template, so a part installed from another world's package fits by kind the same way. Any other instantiable asset declares the kinds it fits with a fits list in its .metadata.

Fields

FieldTypeNotes
fits{ string }The slot kinds this part fits.

Methods

MethodReturnsNotes
:fitsKind(kind)booleanWhether fits names kind.

Usage

-- Author a wheel part and save it as a bundle
local wheel = entity.spawn("SportWheel")
wheel.component.add("Model", { model = "@builtin::meshes.cylinder" })
wheel.component.add("Part", { fits = { "wheel" } })
asset.create("bundle", "SportWheel", { entity = wheel })

Assembly:candidates(path) lists the bundles that fit a slot, and Assembly:fits(path, part) says why one does not.