From 6ce4ff5a1e96053ca00efced8f10f20c99464885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Sat, 7 Dec 2013 05:48:07 -0800 Subject: [PATCH] Created Component/Power (markdown) --- Component-Power.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Component-Power.md diff --git a/Component-Power.md b/Component-Power.md new file mode 100644 index 0000000..f776217 --- /dev/null +++ b/Component-Power.md @@ -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()) .. "%") +``` \ No newline at end of file