Dumbbelllifter
Overview
The Dumbbelllifter component is responsible for enabling an entity to engage in the act of lifting a specific "mighty dumbbell" item. It tracks whether the entity is currently lifting a dumbbell, provides methods to initiate and conclude the lifting action, and mediates the interaction with the dumbbell's own mightydumbbell component to apply workout effects. This component adds and removes a tag to the entity to signify its current lifting status.
Dependencies & Tags
This component expects the dumbbell entity (passed into its methods) to possess a mightydumbbell component to properly function.
- Adds Tag:
liftingdumbbell(whenStartLiftingis called) - Removes Tag:
liftingdumbbell(whenStopLiftingis called orLiftfails)
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
dumbbell | Entity? | nil | A reference to the currently lifted mightydumbbell entity. Is nil if the entity is not currently lifting any dumbbell. |
Main Functions
CanLift(dumbbell)
- Description: Checks if the entity is able to lift the provided dumbbell. In its current implementation, it always returns
true. - Parameters:
dumbbell(Entity): The dumbbell entity to check.
IsLiftingAny()
- Description: Returns
trueif the entity is currently lifting any dumbbell (i.e.,self.dumbbellis notnil). - Parameters: None.
IsLifting(dumbbell)
- Description: Returns
trueif the entity is currently lifting the specific provided dumbbell. - Parameters:
dumbbell(Entity): The dumbbell entity to compare against the currently lifted one.
StartLifting(dumbbell)
- Description: Initiates the lifting process for the specified dumbbell. It sets
self.dumbbell, tells the dumbbell'smightydumbbellcomponent to start the workout, and adds the "liftingdumbbell" tag to the owning entity. - Parameters:
dumbbell(Entity): The dumbbell entity to start lifting. This entity is expected to have amightydumbbellcomponent.
StopLifting()
- Description: Terminates the lifting process. If a dumbbell is currently being lifted, it tells its
mightydumbbellcomponent to stop the workout and then clears theself.dumbbellreference. It also removes the "liftingdumbbell" tag from the owning entity. - Parameters: None.
Lift()
- Description: Attempts to perform a single "lift" action with the currently held dumbbell. It calls the
DoWorkoutmethod on the dumbbell'smightydumbbellcomponent. If the workout is successful, it returnstrue. If the workout fails (e.g., due to insufficient strength or fatigue), it clearsself.dumbbelland returnsfalse. - Parameters: None.