Mermcandidate
Overview
This component tracks the calories consumed by a merm entity to determine whether it has accumulated enough energy to trigger a transformation into a stronger variant. It acts as a state manager for merm metamorphosis progression.
Dependencies & Tags
None identified.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
calories | number | 0 | Current accumulated calorie count from consumed food. |
transformation_calories | number | 50 | Threshold of calories required for transformation to occur. |
Main Functions
AddCalories(food)
- Description: Adds the hunger value (calories) of the given edible item to the internal calorie counter. Only processes items with an
ediblecomponent. - Parameters:
food(Entity): The food entity to consume; must have anediblecomponent for calories to be added.
ResetCalories()
- Description: Resets the current calorie count to zero, typically used after a successful transformation or to reset progress.
- Parameters: None.
ShouldTransform()
- Description: Returns
trueif the current calorie count meets or exceeds the transformation threshold, indicating the merm is ready to transform. - Parameters: None.
OnSave()
- Description: Serializes the component's state for save/load purposes, returning a table containing current calorie and threshold values.
- Parameters: None.
- Returns:
{ calories: number, transformation_calories: number }
OnLoad(data)
- Description: Restores component state from saved data, updating
caloriesandtransformation_caloriesif present in the input table. - Parameters:
data(table): Saved state data containing optionalcaloriesandtransformation_calorieskeys.
Events & Listeners
None.