Limen Framework 0.1 Help

ALimenBattery

Overview

ALimenBattery is an actor derived from ALimenDiscardableItem. It manages a battery's capacity, allowing it to be drained and checked for emptiness. The class overrides several lifecycle events and provides methods to interact with the battery's state.

Properties

Type

Name

Access

Description

ULimenBatteryAttribute*

Capacity

Private

Pointer to the battery capacity attribute.

Functions

Return Type

Signature

Description

void

OnConstruction(const FTransform& Transform)

Called when the actor is being constructed. Initializes the battery capacity.

void

BeginPlay()

Called when the game starts or when spawned. Does nothing in this implementation.

bool

ShouldLoadData() const

Determines if data should be loaded for this item. Returns true, overriding the base class behavior.

bool

ShouldSaveData() const

Determines if data should be saved for this item. Returns true, overriding the base class behavior.

bool

IsEmpty() const

Checks if the battery is empty. Returns true if the capacity is zero.

float

GetPercentage() const

Gets the current percentage of the battery's capacity. Returns 0 if the capacity pointer is null.

void

Drain(const float Value)

Drains the battery by a specified value, ensuring it does not go below zero.

ULimenBatteryAttribute*

GetBatteryCapacity() const

Gets the current battery capacity attribute.

Usage & Implementation Notes

  • Threading Constraints: None.

  • Replication Requirements: None.

  • Memory Lifetime Management: The Capacity property is managed by Unreal Engine's garbage collection system.

  • Initialization Dependencies: The Capacity attribute must be initialized in the constructor to ensure it is not null.

22 May 2026