mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-08 23:06:58 -04:00
Created Component/Power (markdown)
parent
286cfcab64
commit
6ce4ff5a1e
14
Component-Power.md
Normal file
14
Component-Power.md
Normal file
@ -0,0 +1,14 @@
|
||||
This components represents a [[Power Distributor block|Blocks#power-distributor]]. It can be used to figure out how much power there is available in their component network.
|
||||
|
||||
Component name: `power`.
|
||||
Callbacks:
|
||||
- `buffer(): number`
|
||||
The currently globally stored energy. This is the energy stored across all [[capacitors|Blocks#capacitor]] connected to this component network.
|
||||
- `bufferSize(): number`
|
||||
The maximum amount of energy that can be stored. This is the amount of energy that can be stored across all capacitors connected to this component network.
|
||||
|
||||
Example use:
|
||||
```lua
|
||||
local p = component.power -- get primary power distributor
|
||||
print("Global buffer fill rate: " .. math.floor(100 * p.buffer() / p.bufferSize()) .. "%")
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user