Bedazzler
Overview
The Bedazzler component is attached to items that can apply a "bedazzle" effect to other entities. It is responsible for checking if a target is in a valid state to be bedazzled and for executing the bedazzling action, which in turn activates the bedazzlement component on the target and consumes uses from the item.
Dependencies & Tags
Dependencies:
finiteuses(on self): Used to consume charges when theBedazzleaction is performed.bedazzlement(on target): This component is activated on the target entity.burnable(on target): Checked to see if the target is currently burning.freezable(on target): Checked to see if the target is currently frozen.
Tags:
- This component checks for the tags
burntandbedazzledon the target entity but does not add or remove any tags itself.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
inst | Entity | The entity instance | A reference to the entity this component is attached to. |
use_amount | number | 1 (in Bedazzle call) | The number of uses to consume from the finiteuses component. Set via SetUseAmount. Defaults to 1 if not set. |
Main Functions
SetUseAmount(use_amount)
- Description: Sets the number of uses that the item will consume from its
finiteusescomponent each time it successfully bedazzles a target. - Parameters:
use_amount(number): The number of uses to consume per action.
CanBedazzle(target)
- Description: Checks if a target entity is in a valid state to be bedazzled. It returns
falseand a reason string if the target is burning, burnt, frozen, or already bedazzled. - Parameters:
target(Entity): The entity to check for bedazzling eligibility.
- Returns:
(boolean, string): Returnstrueif the target can be bedazzled, orfalseand a reason key (e.g., "BURNING", "FROZEN") if it cannot.
Bedazzle(target)
- Description: Applies the bedazzle effect to a target. This function calls the
Startmethod on the target'sbedazzlementcomponent and consumes a specified number of uses from its ownfiniteusescomponent. - Parameters:
target(Entity): The entity to apply the bedazzle effect to.