Add storesize command

This commit is contained in:
Joachim Stolberg 2023-09-27 19:27:19 +02:00
parent 5b94e40243
commit a347405150
5 changed files with 10 additions and 0 deletions

View File

@ -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)}

View File

@ -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",

View File

@ -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",

View File

@ -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]

View File

@ -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]