Skip to main content

Powerload

Overview

The PowerLoad component tracks and exposes the electrical load (power consumption or generation) and idle state of an entity within the game's power grid system. It serves as a simple data container for power-related attributes, used by power-generating and power-consuming devices like generators, batteries, and wiring components.

Dependencies & Tags

None identified

Properties

PropertyTypeDefault ValueDescription
instEntityReference to the entity this component is attached to.
loadnumber1The magnitude of electrical load (positive for consumption, negative for generation).
isidlebooleanfalseIndicates whether the entity is in an idle state (e.g., inactive or off).

Main Functions

SetLoad(_load, idle)

  • Description: Updates the electrical load value and idle state.
  • Parameters:
    • _load (number): The new load value.
    • idle (boolean?): If true, sets the entity to idle state; otherwise remains unchanged unless explicitly set.

GetLoad()

  • Description: Returns the current electrical load value.
  • Parameters: None.

IsIdle()

  • Description: Returns whether the entity is currently in an idle state.
  • Parameters: None.

Events & Listeners

None identified