Add 'get name' command to the door controller
This commit is contained in:
parent
f7d12dd79a
commit
5056a4a4fb
@ -1152,6 +1152,8 @@ techage.manual_DE.aText = {
|
||||
"\n"..
|
||||
"Mit '$send_cmnd(node_number\\, \"dig\"\\, 2)' kann ein Block wieder entfernt werden\\, sofern der Inventory Slot leer ist. \n"..
|
||||
"\n"..
|
||||
"Mit '$send_cmnd(node_number\\, \"get\"\\, 2)' wird der Name des gesetzten Blocks zurückgeliefert. \n"..
|
||||
"\n"..
|
||||
"Die Slot-Nummer des Inventars (1 .. 16) muss in allen drei Fällen als payload übergeben werden.\n"..
|
||||
"\n"..
|
||||
"Damit lassen sich auch ausfahrbare Treppen und ähnliches simulieren.\n"..
|
||||
|
@ -1150,6 +1150,8 @@ techage.manual_EN.aText = {
|
||||
"\n"..
|
||||
"A block can be removed again with '$send_cmnd(node_number\\, \"dig\"\\, 2)' if the inventory slot is empty. \n"..
|
||||
"\n"..
|
||||
"The name of the set block is returned with '$send_cmnd(node_number\\, \"get\"\\, 2)'.\n"..
|
||||
"\n"..
|
||||
"The slot number of the inventory (1 .. 16) must be passed as payload in all three cases.\n"..
|
||||
"\n"..
|
||||
"This can also be used to simulate extendable stairs and the like. \n"..
|
||||
|
@ -667,6 +667,8 @@ Mit `$send_cmnd(node_number, "set", 2)` kann ein Block aus dem Inventory explizi
|
||||
|
||||
Mit `$send_cmnd(node_number, "dig", 2)` kann ein Block wieder entfernt werden, sofern der Inventory Slot leer ist.
|
||||
|
||||
Mit `$send_cmnd(node_number, "get", 2)` wird der Name des gesetzten Blocks zurückgeliefert.
|
||||
|
||||
Die Slot-Nummer des Inventars (1 .. 16) muss in allen drei Fällen als payload übergeben werden.
|
||||
|
||||
Damit lassen sich auch ausfahrbare Treppen und ähnliches simulieren.
|
||||
@ -875,4 +877,4 @@ Der Techage Schraubendreher dient als Ersatz für den normalen Schraubendreher.
|
||||
- Shift+Linksklick: Ausrichtung des angeklickten Blockes speichern
|
||||
- Shift+Rechtsklick: Die gespeicherte Ausrichtung auf den angeklickten Block anwenden
|
||||
|
||||
[ta3_screwdriver|image]
|
||||
[ta3_screwdriver|image]
|
||||
|
@ -660,6 +660,8 @@ With `$send_cmnd(node_number, "set", 2)` a block from the inventory can be set e
|
||||
|
||||
A block can be removed again with `$send_cmnd(node_number, "dig", 2)` if the inventory slot is empty.
|
||||
|
||||
The name of the set block is returned with `$send_cmnd(node_number, "get", 2)`.
|
||||
|
||||
The slot number of the inventory (1 .. 16) must be passed as payload in all three cases.
|
||||
|
||||
This can also be used to simulate extendable stairs and the like.
|
||||
|
@ -196,6 +196,14 @@ local function exchange_nodes(pos, nvm, slot, force)
|
||||
return res
|
||||
end
|
||||
|
||||
local function get_node_name(nvm, slot)
|
||||
local pos = nvm.pos_list[slot]
|
||||
if pos then
|
||||
return techage.get_node_lvm(pos).name
|
||||
end
|
||||
return "unknown"
|
||||
end
|
||||
|
||||
local function show_nodes(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if not nvm.is_on then
|
||||
@ -355,6 +363,9 @@ techage.register_node({"techage:ta3_doorcontroller2"}, {
|
||||
elseif topic == "dig" then
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return exchange_nodes(pos, nvm, tonumber(payload), "dig")
|
||||
elseif topic == "get" then
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return get_node_name(nvm, tonumber(payload))
|
||||
end
|
||||
return false
|
||||
end,
|
||||
@ -375,6 +386,13 @@ techage.register_node({"techage:ta3_doorcontroller2"}, {
|
||||
end
|
||||
return 2
|
||||
end,
|
||||
on_beduino_request_data = function(pos, src, topic, payload)
|
||||
if topic == 147 then -- Get Name
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return 0, get_node_name(nvm, payload[1] or 1)
|
||||
end
|
||||
return 2, ""
|
||||
end,
|
||||
on_node_load = function(pos)
|
||||
local meta = M(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
|
Loading…
Reference in New Issue
Block a user