From a3474051509b42d407958374ded4334d0f4fc4f7 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Wed, 27 Sep 2023 19:27:19 +0200 Subject: [PATCH] Add storesize command --- basic_machines/ta4_chest.lua | 4 ++++ doc/manual_ta4_DE.lua | 1 + doc/manual_ta4_EN.lua | 1 + manuals/manual_ta4_DE.md | 2 ++ manuals/manual_ta4_EN.md | 2 ++ 5 files changed, 10 insertions(+) diff --git a/basic_machines/ta4_chest.lua b/basic_machines/ta4_chest.lua index 89f6e22..5e115cb 100644 --- a/basic_machines/ta4_chest.lua +++ b/basic_machines/ta4_chest.lua @@ -636,6 +636,8 @@ techage.register_node({"techage:ta4_chest"}, { elseif topic == "itemstring" then local nvm = techage.get_nvm(pos) return get_itemstring(nvm, tonumber(payload or 0) or 0) + elseif topic == "storesize" then + return get_stacksize(pos) elseif topic == "state" then local nvm = techage.get_nvm(pos) return inv_state(nvm) @@ -650,6 +652,8 @@ techage.register_node({"techage:ta4_chest"}, { elseif topic == 140 and payload[1] == 2 then -- Inventory Item Name local nvm = techage.get_nvm(pos) return 0, get_itemstring(nvm, tonumber(payload[2] or 0) or 0) + elseif topic == 140 and payload[1] == 3 then -- storesize + return 0, {get_stacksize(pos)} elseif topic == 131 then -- Chest State local nvm = techage.get_nvm(pos) return 0, {inv_state_num(nvm)} diff --git a/doc/manual_ta4_DE.lua b/doc/manual_ta4_DE.lua index f17eafe..dea6fdd 100644 --- a/doc/manual_ta4_DE.lua +++ b/doc/manual_ta4_DE.lua @@ -802,6 +802,7 @@ return { "Der Kiste besitzt ein zusätzliches Kommandos für den Lua Controller:\n".. "\n".. " - 'count' dient zur Anfrage\\, wie viele Items in der Kiste sind.\nBeispiel 1: '$send_cmnd(CHEST\\, \"count\")' --> Summe der Items über alle 8 Speicher\nBeispiel 2: '$send_cmnd(CHEST\\, \"count\"\\, 2)' --> Anzahl der Items in Speicher 2 (zweiter von links)\n".. + " - 'storesize' wird verwendet\\, um die Größe eines der acht Speicher auszulesen\nBeispiel: '$send_cmnd(CHEST\\, \"storesize\")' -> Funktion liefert bspw. 6000 zurück\n".. "\n".. "\n".. "\n", diff --git a/doc/manual_ta4_EN.lua b/doc/manual_ta4_EN.lua index 399cca8..8ba0520 100644 --- a/doc/manual_ta4_EN.lua +++ b/doc/manual_ta4_EN.lua @@ -800,6 +800,7 @@ return { "The chest has an additional command for the Lua controller:\n".. "\n".. " - 'count' is used to request how many items are in the chest.\nExample 1: '$send_cmnd(CHEST\\, \"count\")' -> Sum of items across all 8 stores\nExample 2: '$send_cmnd(CHEST\\, \"count\"\\, 2)' -> number of items in store 2 (second from left)\n".. + " - 'storesize' is used to read the size of one of the eight stores:\nExample: '$send_cmnd(CHEST\\, \"storesize\")' -> function returns e.g. 6000\n".. "\n".. "\n".. "\n", diff --git a/manuals/manual_ta4_DE.md b/manuals/manual_ta4_DE.md index 058e6ad..9f77e7c 100644 --- a/manuals/manual_ta4_DE.md +++ b/manuals/manual_ta4_DE.md @@ -947,6 +947,8 @@ Der Kiste besitzt ein zusätzliches Kommandos für den Lua Controller: - `count` dient zur Anfrage, wie viele Items in der Kiste sind. Beispiel 1: `$send_cmnd(CHEST, "count")` --> Summe der Items über alle 8 Speicher Beispiel 2: `$send_cmnd(CHEST, "count", 2)` --> Anzahl der Items in Speicher 2 (zweiter von links) +- `storesize` wird verwendet, um die Größe eines der acht Speicher auszulesen + Beispiel: `$send_cmnd(CHEST, "storesize")` -> Funktion liefert bspw. 6000 zurück [ta4_8x2000_chest|image] diff --git a/manuals/manual_ta4_EN.md b/manuals/manual_ta4_EN.md index 3764968..9a43796 100644 --- a/manuals/manual_ta4_EN.md +++ b/manuals/manual_ta4_EN.md @@ -935,6 +935,8 @@ The chest has an additional command for the Lua controller: - `count` is used to request how many items are in the chest. Example 1: `$send_cmnd(CHEST, "count")` -> Sum of items across all 8 stores Example 2: `$send_cmnd(CHEST, "count", 2)` -> number of items in store 2 (second from left) +- `storesize` is used to read the size of one of the eight stores: + Example: `$send_cmnd(CHEST, "storesize")` -> function returns e.g. 6000 [ta4_8x2000_chest|image]