Skip to main content

Furnituredecor

Based on game build 714014 | Last updated: 2026-03-03

Overview

FurnitureDecor manages whether an entity is visually and logically treated as a furniture decoration. It controls the presence of the furnituredecor tag based on its enabled state, and tracks whether the item is placed on top of furniture. The component provides hooks for custom logic via onputonfurniture and ontakeofffurniture callbacks.

Usage example

local inst = CreateEntity()
inst:AddComponent("furnituredecor")

-- Optional: Set custom callbacks
inst.components.furnituredecor.onputonfurniture = function(inst, furniture)
print("Item placed on furniture: " .. furniture.prefab)
end

inst.components.furnituredecor.ontakeofffurniture = function(inst, furniture)
print("Item removed from furniture: " .. furniture.prefab)
end

-- Place on furniture
inst.components.furnituredecor:PutOnFurniture(some_furniture)
inst.components.furnituredecor:SetEnabled(false)

Dependencies & tags

Components used: None identified
Tags: Adds or removes furnituredecor tag based on enabled state.

Properties

PropertyTypeDefault ValueDescription
enabledbooleantrueControls whether the furnituredecor tag is present.
on_furnitureboolean or nilniltrue when the item is placed on furniture; nil otherwise.
decor_animationstring"idle"Animation state name used for furniture decorations.
onputonfurniturefunction (optional)nilCallback invoked when the item is placed on furniture. Signature: fn(inst, furniture)
ontakeofffurniturefunction (optional)nilCallback invoked when the item is removed from furniture. Signature: fn(inst, furniture)

Main functions

SetEnabled(enabled)

  • Description: Updates the enabled state and adds or removes the furnituredecor tag accordingly.
  • Parameters: enabled (boolean) – whether the item should be considered a furniture decoration.
  • Returns: Nothing.
  • Error states: No side effects if enabled is unchanged.

IsOnFurniture()

  • Description: Returns whether the item is currently placed on a furniture entity.
  • Parameters: None.
  • Returns: true if on_furniture == true, otherwise false.

PutOnFurniture(furniture)

  • Description: Marks the item as being placed on furniture and invokes the onputonfurniture callback if defined.
  • Parameters: furniture (Entity instance) – the furniture entity the item is placed on.
  • Returns: Nothing.

TakeOffFurniture(furniture)

  • Description: Marks the item as no longer placed on furniture and invokes the ontakeofffurniture callback if defined.
  • Parameters: furniture (Entity instance) – the furniture entity the item is removed from.
  • Returns: Nothing.

OnRemoveFromEntity()

  • Description: Ensures the furnituredecor tag is removed when the component is removed from an entity.
  • Parameters: None.
  • Returns: Nothing.

Events & listeners

Not applicable.