ULimenLock
Overview
ULimenLock is an UActorComponent used to manage the locking and unlocking state of interactive objects. It provides functionality to set and get the keyword required to unlock the object, check if it is currently locked, and change its locked state based on a controller and pawn interacting with it. The component also broadcasts events when the lock state changes.
Properties
Type | Name | Access | Description |
|---|---|---|---|
| Keyword | EditAnywhere, BlueprintReadOnly | The keyword required to unlock the object. |
| bStartLocked | EditAnywhere | Whether the lock should start in a locked state when the component is activated. |
| bIsLocked | Private | The current locked state of the object. |
Functions
Return Type | Signature | Description |
|---|---|---|
| SetStartLocked(const bool bNewLocked) | Sets whether the lock should start in a locked state when the component is activated. |
| SetKeyword(const FName& NewKeyword) | Sets the keyword required to unlock the object. |
| GetKeyword() const | Returns the keyword required to unlock the object. |
| IsLocked() const | Checks if the lock is currently locked. |
| SetLockedState(const bool bLocked) | Sets the current locked state of the object. |
| ChangeLockedState(AController* Controller, APawn* Pawn, FName Test, const bool bLock) | Changes the locked state based on a controller and pawn interacting with it using a single keyword. Returns true if the lock state changed. |
| ChangeLockedState(AController* Controller, APawn* Pawn, const TArray & Keywords, const bool bLock) | Changes the locked state based on a controller and pawn interacting with it using multiple keywords. Returns true if any of the keywords caused the lock state to change. |
| TryKeyword(const FName& Test) const | Checks if the provided keyword matches the required keyword. |
Usage & Implementation Notes
The component is designed to be used as a child component on interactive objects in the game.
It uses events (
OnUnlockedandOnLocked) to notify other components or blueprints when the lock state changes.The
ChangeLockedStatefunctions ensure that the lock state can only change if the provided keyword matches the required keyword, preventing unauthorized access.