Getting one
client:getLocalPlayer():getPlayerComposition()
Methods
| Method | Returns | Description |
|---|
getEquipmentIds() | {number} | The equipment ids, one per KitType index: an item is ITEM_OFFSET + its id, a kit KIT_OFFSET + its id, 0 nothing. The player's own arr… |
|---|
getEquipmentId(KitType) | number | The item worn in slot type, -1 for none (or a kit). |
|---|
getKitId(KitType) | number | The kit in slot type, -1 for none (or an item). |
|---|
getColors() | {number} | The five body colours; all 0 when the kit's colours could not be read. |
|---|
getGender() | number | 0 male, 1 female; 0 when the kit's gender could not be read. |
|---|
isFemale() | boolean | Whether the gender is 1. getGender() is the value itself. |
|---|
getTransformedNpcId() | number | The NPC the player renders as, -1 for none; -1 when the kit's NPC id could not be read. |
|---|
setTransformedNpcId(number) | () | Render the player as NPC id (-1: as itself again), as the client's own model build reads its kit every frame; this composition's `getTran… |
|---|
setHash() | () | Recompute the appearance hash from the player's kit (its equipment ids and colours) through the client's own hash, so the player's model fo… |
|---|
Fields
| Field | Type | Description |
|---|
KIT_OFFSET | number | What getEquipmentIds() adds to a kit id: 256. |
|---|
ITEM_OFFSET | number | What getEquipmentIds() adds to an item id: 2048. |
|---|
Method details
getEquipmentIds: (PlayerComposition) -> {number}
The equipment ids, one per KitType index: an item is ITEM_OFFSET + its id, a kit KIT_OFFSET + its id, 0 nothing. The player's own array, as a 1-based view (like client:getIntStack()): ids[i] reads the player's kit now (the ids as read once the player has gone), #ids is 12, for i, id in ids walks it, and ids[i] = id writes the kit on the game thread, so setHash() then dresses the player (devtools' wear). The write raises on a client whose table has the kit writes off. This composition's getEquipmentId and getKitId keep the ids it was read with; after a new appearance a kept array reads the new ids. Copy it with a loop (ipairs and table.* take tables only).
getEquipmentId: (PlayerComposition, KitType) -> number
The item worn in slot type, -1 for none (or a kit).
getKitId: (PlayerComposition, KitType) -> number
The kit in slot type, -1 for none (or an item).
getColors: (PlayerComposition) -> {number}
The five body colours; all 0 when the kit's colours could not be read.
getGender: (PlayerComposition) -> number
0 male, 1 female; 0 when the kit's gender could not be read.
isFemale: (PlayerComposition) -> boolean
Whether the gender is 1. getGender() is the value itself.
getTransformedNpcId: (PlayerComposition) -> number
The NPC the player renders as, -1 for none; -1 when the kit's NPC id could not be read.
setTransformedNpcId: (PlayerComposition, number) -> ()
Render the player as NPC id (-1: as itself again), as the client's own model build reads its kit every frame; this composition's getTransformedNpcId() keeps the value it was read with (ask getPlayerComposition() again). Game thread only; raises on a client whose table has the kit writes off.
setHash: (PlayerComposition) -> ()
Recompute the appearance hash from the player's kit (its equipment ids and colours) through the client's own hash, so the player's model follows a changed kit. Game thread only; raises on a client whose table has the kit writes off.