Sittable
Based on game build 714014 | Last updated: 2026-03-03
Overview
Sittable enables an entity to be occupied by a character (typically for sitting), managing occupier lifecycle and tag state (cansit). It integrates with the burnable component to propagate fire events to occupants when the sittable object ignites. The component tracks whether the entity is currently occupied, who occupies it, and updates tags and events accordingly.
Usage example
local inst = CreateEntity()
inst:AddComponent("sittable")
-- Automatically adds "cansit" tag and fires "becomesittable"
inst.components.sittable:SetOccupier(player)
assert(inst.components.sittable:IsOccupied())
inst.components.sittable:EjectOccupier()
Dependencies & tags
Components used: burnable (optional, checked dynamically)
Tags: Adds cansit on initialization; removes cansit when occupied; removes cansit on removal from entity.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
occupier | Entity or nil | nil | The entity currently occupying the seat (e.g., a player). |
Main functions
SetOccupier(occupier)
- Description: Sets or clears the occupier of the sittable entity. Updates event callbacks and tags based on occupancy state.
- Parameters:
occupier(Entityornil) — the entity sitting, ornilto vacate the seat. - Returns: Nothing.
- Error states: No-op if the new occupier is identical to the current one.
IsOccupied()
- Description: Checks whether the entity is currently occupied.
- Parameters: None.
- Returns:
trueif an occupier exists, otherwisefalse.
IsOccupiedBy(occupier)
- Description: Checks whether the specific entity is the current occupier.
- Parameters:
occupier(Entity) — the entity to check against the current occupier. - Returns:
trueifoccupiermatches the current occupier and is non-nil, otherwisefalse.
EjectOccupier()
- Description: Clears the occupier state (without calling
SetOccupier(nil)) and fires"becomeunsittable"if occupied. - Parameters: None.
- Returns: Nothing.
- Error states: Does not update callbacks or clean up occupier references beyond the event push.
OnRemoveFromEntity()
- Description: Cleanup method called when the component is removed from its entity. Cleans up event callbacks, removes the
cansittag, and fires"becomeunsittable". - Parameters: None.
- Returns: Nothing.
Events & listeners
- Listens to:
"onremove"(on occupier) — triggersSetOccupier(nil)when the occupier is removed."onignite"(on self) — fires only ifburnableexists; notifies the occupier of fire.
- Pushes:
"becomesittable"— fires when the entity becomes available to sit (tagcansitadded or occupier cleared)."becomeunsittable"— fires when the entity becomes occupied or is being removed (tagcansitremoved)."sittableonfire"— pushed to the occupier when the sittable entity ignites.