Watersource
Overview
This component tracks whether an entity qualifies as a water source and dynamically maintains the watersource tag on the entity based on its availability. It provides a simple interface to mark the source as used (via the Use() method) and ensures tag consistency when the component is attached or removed.
Dependencies & Tags
- Tags used/managed:
watersource- Adds the tag when
availableistrue. - Removes the tag when
availableisfalseor when the component is removed from the entity.
- Adds the tag when
- Dependencies: None identified.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
available | boolean | true | Indicates whether the water source is currently available. Controls the presence of the watersource tag. |
onusefn | function? | nil | Optional callback function invoked when Use() is called. Not initialized in _ctor but supported via external assignment. |
override_fill_uses | number? | nil | Reserved for future use; used by fillable items (e.g., wateringcan) to specify partial-fill behavior. Not used internally by this component. |
Main Functions
Use()
- Description: Invokes the optional
onusefncallback (if set) when the water source is consumed or interacted with. - Parameters: None.
Events & Listeners
- Listens to internal property updates via the
availablefunction (passed toClassas a property setter), which automatically triggersonavailable(self, available)whenself.availableis assigned. - Does not push or listen to any game events via
inst:ListenForEventorinst:PushEvent.