Log inGet started
Package

slots.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

slots

The rules of the slot family, shared by the Slot, Assembly and Part components: which entities are slots and the path each answers to, which part fills a slot under a configuration, whether a part fits a slot and why not, and building or removing the part that fills a slot. Content reaches it through the three components; tools that need the rules without a component require it.

API

CallReturns
Slots.holderOf(entityId)The Assembly holding the slots at the entity: the nearest one on it or above it, climbing past each one that stands on a part built into a slot. Nil when none does.
Slots.holdsOwnSlots(e)Whether an entity carries an Assembly that holds its own slots (one on an entity that is no part built into a slot).
Slots.pathOf(slot)A Slot component's path.
Slots.nameOf(slot)A Slot component's name.
Slots.discover(rootId)Every slot at and under an entity, Slot components and Humanoid role sockets, each { path, name, kind, tags, default, joint, entity, slot?, humanoid?, from }. A descendant whose own Assembly holds its slots is left out, with its subtree.
Slots.partRef(part)The AssetRef an AssetRef, identity, guid or path names, or nil and why.
Slots.declaredFits(ref)The slot kinds a part fits and where that is declared (Part, .metadata).
Slots.fits(entry, part)(fits, why, ref).
Slots.decide(config, entry)The guid filling a slot under a configuration, and its source.
Slots.currentFill(entry)The entity filling a slot and its { path, part } record.
Slots.apply(entry, guid)Make a slot hold a part, rebuilding it only when it differs.
local Slots = require("@builtin::modules.slots")
for _, s in ipairs(Slots.discover(car.id)) do print(s.path, s.kind) end

A fill entity carries the slotFill attribute: the path of the slot it fills and the guid of the part.