diff --git a/basis/liquid_lib.lua b/basis/liquid_lib.lua index 6801070..6bc3a54 100644 --- a/basis/liquid_lib.lua +++ b/basis/liquid_lib.lua @@ -55,7 +55,9 @@ techage.liquid.recv_message = { on_recv_message = function(pos, src, topic, payload) if topic == "load" then local nvm = techage.get_nvm(pos) - return techage.power.percent(LQD(pos).capa, (nvm.liquid and nvm.liquid.amount) or 0) + nvm.liquid = nvm.liquid or {} + nvm.liquid.amount = nvm.liquid.amount or 0 + return techage.power.percent(LQD(pos).capa, nvm.liquid.amount), nvm.liquid.amount elseif topic == "size" then return LQD(pos).capa else diff --git a/liquids/silo.lua b/liquids/silo.lua index 25be282..5e809d2 100644 --- a/liquids/silo.lua +++ b/liquids/silo.lua @@ -309,7 +309,7 @@ techage.register_node({"techage:ta3_silo", "techage:ta4_silo"}, { local nvm = techage.get_nvm(pos) nvm.item_count = nvm.item_count or get_item_count(pos) nvm.capa = nvm.capa or get_silo_capa(pos) - return techage.power.percent(nvm.capa, nvm.item_count) + return techage.power.percent(nvm.capa, nvm.item_count), nvm.item_count else return "unsupported" end diff --git a/manuals/ta4_lua_controller_EN.md b/manuals/ta4_lua_controller_EN.md index 2cca94e..aa97019 100644 --- a/manuals/ta4_lua_controller_EN.md +++ b/manuals/ta4_lua_controller_EN.md @@ -358,12 +358,12 @@ In addition to Lua standard function the Lua Controller provides the following f | "state" | one of: "empty", "loaded", "full" | State of a chest or Sensor Chest | | "fuel" | number | fuel value of a fuel consuming block | | "depth" | number | Read the current depth value of a quarry block (1..80) | -| "load" | number | Read the load value in percent (0..100) of a tank/storage block, a silo block, an accu block, or of the Signs Bot Box. | +| "load" | number | Read the load value in percent (0..100) of a tank/storage block, a silo block, an accu block, or of the Signs Bot Box. Silo and tank return two values: The percentage value and the absolute value in units.
Example: percent, absolute = $read_data("223", "load") | | "delivered" | number | Read the current delivered power value of a generator block. A power consuming block (accu) provides a negative value | | "action" | player-name, action-string | only for Sensor Chests | | "stacks" | Array with up to 4 Stores with the inventory content (see example) | only for Sensor Chests | | "count" | number | Read the item counter of the TA4 Item Detector block | -| "count" | number of items | Read the total amount of TA4 chest items. An optional number as `add_data` is used to address only on inventory slot (1..8, from left to right). | +| "count" | number of items | Read the total amount of TA4 chest items. An optional number as `add_data` is used to address only one inventory slot (1..8, from left to right). | | "itemstring" | item string of the given slot | Specific command for the TA4 8x2000 Chest to read the item type (technical name) of one chest slot, specified via `add_data` (1..8).
Example: s = $read_data("223", "itemstring", 1) | diff --git a/manuals/ta4_lua_controller_EN.pdf b/manuals/ta4_lua_controller_EN.pdf index 87dc030..39d8dce 100644 Binary files a/manuals/ta4_lua_controller_EN.pdf and b/manuals/ta4_lua_controller_EN.pdf differ