Groomer
Based on game build 714014 | Last updated: 2026-03-03
Overview
Groomer enables an entity to function as a dressing station (e.g., wardrobe or grooming rack), allowing other entities to enter a special "openwardrobe" state, change skins (clothing/appearance), and exit cleanly. It manages multi-user support, range-based auto-closing, fire safety (prevents use while burning), and state transitions using the stategraph system. The component also dynamically adds/removes the groomer and dressable tags based on usability.
It depends on and integrates with the burnable and talker components for safety announcements and state validation.
Usage example
local inst = CreateEntity()
inst:AddComponent("groomer")
inst:AddComponent("dressable")
inst:AddTag("wardrobe")
inst.components.groomer:SetCanBeShared(true)
inst.components.groomer:SetRange(5)
inst.components.groomer:SetCanBeDressed(true)
inst.components.groomer:SetCanUseAction(true)
Dependencies & tags
Components used: burnable, talker
Tags: Adds groomer and dressable conditionally; removes both on removal from entity.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
changers | table | {} | Map of doer entities currently in the openwardrobe state. |
enabled | boolean | true | Whether the grooming functionality is active. |
canuseaction | boolean | true | Whether this groomer appears in the player's action list (e.g., via mouseover or radial menu). |
canbedressed | boolean | nil | Whether this groomer supports dressing (i.e., skin changes). |
canbeshared | boolean | false | Whether multiple entities can use the groomer simultaneously. |
range | number | 3 | Distance threshold for auto-closing the grooming session. |
changeindelay | number | 0 | Delay before starting skin change after activation. |
occupant | entity or nil | nil | Optional entity that this groomer acts as (e.g., reference to the wardrobe itself for skin application context). |
occupantisself | boolean | nil | Used internally by GetOccupant(). |
Note: Some fields (occupantisself, canbeginchangingfn, canactivatechangingfn, changefn, onopenfn, onclosefn, applytargetskinsfn, onclosepopupfn) are hook functions—settable via metaprogramming or extension—but are not initialized in the constructor.
Main functions
SetCanUseAction(canuseaction)
- Description: Controls whether the groomer appears in player action collections (e.g., radial menus or proximity prompts). Also triggers the
canuseactioncallback to add/remove thegroomertag. - Parameters:
canuseaction(boolean) – enables or disables use. - Returns: Nothing.
SetCanBeDressed(canbedressed)
- Description: Sets whether the groomer supports dressing (i.e., enables skin/appearance changes). Triggers the
canbedressedcallback to manage thedressabletag. - Parameters:
canbedressed(boolean) – enables or disables dressing. - Returns: Nothing.
Enable(enable)
- Description: Globally enables or disables the grooming functionality. When disabled,
CanBeginChangingwill returnfalsewith reason"INUSE". - Parameters:
enable(boolean, optional) – defaults totrue. - Returns: Nothing.
SetCanBeShared(canbeshared)
- Description: Enables or disables shared usage (multiple users). When
true, removes the fire-safety listener to avoid blocking use during fire; whenfalse, adds the listener to deny use while burning. - Parameters:
canbeshared(boolean) – whether multiple entities can use simultaneously. - Returns: Nothing.
SetRange(range)
- Description: Configures the maximum distance an entity can be from the groomer before the grooming session ends automatically.
- Parameters:
range(number) – maximum distance threshold. - Returns: Nothing.
GetOccupant()
- Description: Returns the entity acting as the “occupant” of this groomer (typically the groomer’s own
inst, unlessoccupantis explicitly set). - Returns: entity or
nil– the occupant entity.
CanBeginChanging(doer)
- Description: Validates whether
doercan begin a grooming session. Checks enabled status, stategraph busy tags, fire, usage conflict, and customcanbeginchangingfnhooks. - Parameters:
doer(entity) – the entity attempting to start grooming. - Returns:
true, orfalse, reason(e.g.,"INUSE","BURNING"). - Error states: Returns
false, "BURNING"ifburnable.IsBurning()istrue; returnsfalse, "INUSE"ifenabledisfalseor the groomer is in use and not shareable.
BeginChanging(doer)
- Description: Initiates a grooming session for
doer. Enters the"openwardrobe"stategraph state and starts listening for cleanup events. If this is the first user, begins updating this component for range checks. - Parameters:
doer(entity) – the entity starting the session. - Returns:
trueif the session started successfully;falseif already in session.
EndChanging(doer)
- Description: Ends a grooming session for
doer. Cleans up listeners, restores"idle"stategraph state, and stops updating if no users remain. - Parameters:
doer(entity) – the entity ending the session. - Returns: Nothing.
EndAllChanging()
- Description: Ends grooming sessions for all active users. Used during removal from entity or fire events.
- Parameters: None.
- Returns: Nothing.
ActivateChanging(doer, skins)
- Description: Begins the actual skin change process for
doer. Validates state, then transitions to"dressupwardrobe"→"skin_change", applying the providedskinsviaApplyTargetSkins. - Parameters:
doer(entity),skins(table ornil) – the skin IDs to apply. - Returns:
trueon success;falseif validation fails (e.g., wrong state, no occupant, custom hook blocked it). - Error states: Returns
falseifskinsisnil,doeris not in"openwardrobe", occupant isnil, orcanactivatechangingfnreturnsfalse.
ApplyTargetSkins(target, doer, skins)
- Description: Applies the selected skins to
targetusing theapplytargetskinsfnhook. Typically used to update clothing/skin appearance. - Parameters:
target(entity),doer(entity),skins(table) – skin IDs to apply. - Returns: Nothing (calls the hook if defined).
OnUpdate(dt)
- Description: Periodically checks if active users are still within
rangeand visible. Ends sessions for users who exceed the threshold. - Parameters:
dt(number) – delta time. - Returns: Nothing.
Events & listeners
- Listens to:
"onignite"– handled byOnIgnite(blocks grooming when burning if not shareable)."onremove"– triggersonclosegroomer."ms_closepopup"– triggersonclosepopup."unhitched"– triggersoncloseallgroomer(closes all sessions if entity is unmounted).
- Pushes: No events directly.
Notes
- The component relies on stategraph hooks:
"openwardrobe","dressupwardrobe", and"skin_change"must exist in the entity’s stategraph. - Tags
groomeranddressableare only added conditionally based oncanuseactionandcanbedressed, respectively. - Fire handling (
OnIgnite) does not fire ifcanbesharedistrue, allowing simultaneous use even in fire.