useResource
useResource(
entity,resource): {current:number;maximum:number;reserved?:number;spentTick?:number|null; } |undefined
An entity’s amount of the resource, read from the world: { current, maximum, reserved }, or undefined while it has none. What
<ResourceBar> draws, and the way to draw it any other way, such as
an orb, a ring or a number.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
entity |
Entity | null |
resource |
ResourceHandle |
Returns
Section titled “Returns”Type Literal
Section titled “Type Literal”{ current: number; maximum: number; reserved?: number; spentTick?: number | null; }
| Name | Type | Description |
|---|---|---|
current |
number |
- |
maximum |
number |
- |
reserved? |
number |
What a running cast holds back. Health has none, since no cast holds health back; every other resource has it. |
spentTick? |
number | null |
The tick of the last spend, which its regeneration waits regenDelaySeconds from, or null before the first. Health has none: its wait runs from LastHitTrait. |
undefined