Carnivaldecor
Overview
This component marks an entity as a piece of carnival decoration. Its primary responsibility is to find nearby entities with a carnivaldecorranker component and register itself with them, contributing to a local decoration score. It automatically handles deregistering itself when the entity is removed from the world.
Dependencies & Tags
Dependencies:
- This component's logic requires other entities in the world to have the
carnivaldecorrankercomponent to function correctly.
Tags:
- Adds the
carnivaldecortag to the entity upon initialization. - Removes the
carnivaldecortag when the component is removed.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
inst | Entity | self.inst | A reference to the entity instance holding this component. |
value | number | 1 | The decoration score this entity provides. |
Main Functions
GetDecorValue()
- Description: Returns the decoration value of this entity.
- Parameters: None.
OnRemoveFromEntity()
- Description: A lifecycle hook called when the component is being removed from the entity. It removes the
carnivaldecortag and deregisters the entity from any nearby carnival decor rankers. - Parameters: None.
OnRemoveEntity()
- Description: A lifecycle hook called when the entity is being removed from the world. It deregisters the entity from any nearby carnival decor rankers to ensure the score is updated correctly.
- Parameters: None.