Furnace: Add 'output' command

master
Joachim Stolberg 2020-11-27 13:46:48 +01:00
parent 270f97a5d8
commit 88ce0f7d32
4 changed files with 14 additions and 3 deletions

View File

@ -242,7 +242,12 @@ local tubing = {
end
end,
on_recv_message = function(pos, src, topic, payload)
return CRD(pos).State:on_receive_message(pos, topic, payload)
if topic == "output" then
local nvm = techage.get_nvm(pos)
return string.split(nvm.output or "unknown", " ")[1]
else
return CRD(pos).State:on_receive_message(pos, topic, payload)
end
end,
}

View File

@ -364,11 +364,12 @@ Please note, that this is not a technical distinction, only a logical.
| "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, silo, accu, or battery block, or from the Signs Bot Box. Silo and tank return two values: The percentage value and the absolute value in units.<br /> Example: percent, absolute = $send_cmnd("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 |
| "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 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).<br />Example: s = $send_cmnd("223", "itemstring", 1) |
| "output" | recipe output string, <br />e.g.: "default:glass" | Only for the Industrial Furnace. If no recipe is active, the command returns "unknown" |

Binary file not shown.

View File

@ -245,6 +245,11 @@ local function read_state(itemstack, user, pointed_thing)
fuel = dump(fuel)
minetest.chat_send_player(user:get_player_name(), ndef.description.." "..number..": fuel = "..fuel.." ")
end
local output = techage.send_single("0", number, "output", nil)
if output and output ~= "" and output ~= "unsupported" then
output = dump(output)
minetest.chat_send_player(user:get_player_name(), ndef.description.." "..number..": output = "..output.." ")
end
local load, abs = techage.send_single("0", number, "load", nil)
if load and load ~= "" and load ~= "unsupported" then
load, abs = dump(load), abs and dump(abs) or "--"