Improve TA3 doorcontroller2
This commit is contained in:
parent
e2bd472408
commit
acb54d7e8d
@ -1146,9 +1146,13 @@ techage.manual_DE.aText = {
|
||||
"\n"..
|
||||
"Wird ein 'on' / 'off' Kommando an den Tür Controller II gesendet\\, entfernt bzw. setzt er die Blöcke ebenfalls.\n"..
|
||||
"\n"..
|
||||
"Über ein 'exchange' Kommando können einzelne Böcke gesetzt\\, entfernt\\, bzw. durch andere Blöcke ersetzt werden. Die Slot-Nummer des Inventars (1 .. 16) muss als payload übergeben werden\\, also:\n"..
|
||||
"Mit '$send_cmnd(node_number\\, \"exchange\"\\, 2)' können einzelne Böcke gesetzt\\, entfernt\\, bzw. durch andere Blöcke aus dem Inventar ersetzt werden. \n"..
|
||||
"\n"..
|
||||
" $send_cmnd(node_number\\, \"exchange\"\\, 2)\n"..
|
||||
"Mit '$send_cmnd(node_number\\, \"set\"\\, 2)' kann ein Block aus dem Inventory explizit gesetzt werden\\, sofern der Inventory Slot nicht leer ist.\n"..
|
||||
"\n"..
|
||||
"Mit '$send_cmnd(node_number\\, \"dig\"\\, 2)' kann ein Block wieder entfernt werden\\, sofern der Inventory Slot leer ist. \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"..
|
||||
"\n"..
|
||||
|
@ -1144,9 +1144,13 @@ techage.manual_EN.aText = {
|
||||
"\n",
|
||||
"The Door Controller II can remove and set all types of blocks. To teach in the Door Controller II\\, the \"Record\" button must be pressed. Then all blocks that should be part of the door / gate must be clicked. Then the \"Done\" button must be pressed. Up to 16 blocks can be selected. The removed blocks are saved in the controller's inventory. The function of the controller can be tested manually using the \"Remove\" or \"Set\" buttons. If an 'on' /'off' command is sent to the Door Controller II\\, it removes or sets the blocks as well.\n"..
|
||||
"\n"..
|
||||
"Individual blocks can be set\\, removed or replaced by other blocks via an 'exchange' command. The slot number of the inventory (1 .. 16) must be transferred as payload\\, i.e.:\n"..
|
||||
"With '$send_cmnd(node_number\\, \"exchange\"\\, 2)' individual blocks can be set\\, removed or replaced by other blocks from the inventory. \n"..
|
||||
"\n"..
|
||||
" $send_cmnd(node_number\\, \"exchange\"\\, 2)\n"..
|
||||
"With '$send_cmnd(node_number\\, \"set\"\\, 2)' a block from the inventory can be set explicitly\\, as long as the inventory slot is not empty.\n"..
|
||||
"\n"..
|
||||
"A block can be removed again with '$send_cmnd(node_number\\, \"dig\"\\, 2)' if the inventory slot is empty. \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"..
|
||||
"\n"..
|
||||
|
@ -65,3 +65,6 @@ techage.register_mobs_mods("mobs_skeletons")
|
||||
techage.register_mobs_mods("mobs_dwarves")
|
||||
techage.register_mobs_mods("mobf_trader")
|
||||
techage.register_mobs_mods("ts_vehicles_cars")
|
||||
|
||||
-- Used as e.g. crane cable
|
||||
techage.logic.register_doorcontroller_nodes({"techage:power_lineS"})
|
@ -661,11 +661,13 @@ Der Tür Controller II kann alle Arten von Blöcken entfernen und wieder setzen.
|
||||
|
||||
Wird ein `on` / `off` Kommando an den Tür Controller II gesendet, entfernt bzw. setzt er die Blöcke ebenfalls.
|
||||
|
||||
Über ein `exchange` Kommando können einzelne Böcke gesetzt, entfernt, bzw. durch andere Blöcke ersetzt werden. Die Slot-Nummer des Inventars (1 .. 16) muss als payload übergeben werden, also:
|
||||
Mit `$send_cmnd(node_number, "exchange", 2)` können einzelne Böcke gesetzt, entfernt, bzw. durch andere Blöcke aus dem Inventar ersetzt werden.
|
||||
|
||||
```
|
||||
$send_cmnd(node_number, "exchange", 2)
|
||||
```
|
||||
Mit `$send_cmnd(node_number, "set", 2)` kann ein Block aus dem Inventory explizit gesetzt werden, sofern der Inventory Slot nicht leer ist.
|
||||
|
||||
Mit `$send_cmnd(node_number, "dig", 2)` kann ein Block wieder entfernt werden, sofern der Inventory Slot leer ist.
|
||||
|
||||
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.
|
||||
|
||||
|
@ -654,11 +654,13 @@ The door controller is used to control the TA3 door/gate blocks. With the door c
|
||||
|
||||
The Door Controller II can remove and set all types of blocks. To teach in the Door Controller II, the "Record" button must be pressed. Then all blocks that should be part of the door / gate must be clicked. Then the "Done" button must be pressed. Up to 16 blocks can be selected. The removed blocks are saved in the controller's inventory. The function of the controller can be tested manually using the "Remove" or "Set" buttons. If an `on` /`off` command is sent to the Door Controller II, it removes or sets the blocks as well.
|
||||
|
||||
Individual blocks can be set, removed or replaced by other blocks via an `exchange` command. The slot number of the inventory (1 .. 16) must be transferred as payload, i.e.:
|
||||
With `$send_cmnd(node_number, "exchange", 2)` individual blocks can be set, removed or replaced by other blocks from the inventory.
|
||||
|
||||
```
|
||||
$send_cmnd(node_number, "exchange", 2)
|
||||
```
|
||||
With `$send_cmnd(node_number, "set", 2)` a block from the inventory can be set explicitly, as long as the inventory slot is not empty.
|
||||
|
||||
A block can be removed again with `$send_cmnd(node_number, "dig", 2)` if the inventory slot is empty.
|
||||
|
||||
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.
|
||||
|
||||
|
@ -394,7 +394,9 @@ Please note, that this is not a technical distinction, only a logical.
|
||||
| "reset" | nil | Reset the item counter of the TA4 Item Detector block |
|
||||
| "pull" | item string | Start the TA4 pusher to pull/push items.<br /> Example: `default:dirt 8` |
|
||||
| "config" | item string | Configure the TA4 pusher.<br />Example: `wool:blue` |
|
||||
| "exchange" | inventory slot number | place/remove/exchange an block by means of the TA3 Door Controller II (techage:ta3_doorcontroller2) |
|
||||
| "exchange" | inventory slot number | TA3 Door Controller II (techage:ta3_doorcontroller2)<br />Exchange a block<br />*idx* is the inventory slot number (1..n) of/for the block to be exchanged |
|
||||
| "set" | inventory slot number | TA3 Door Controller II (techage:ta3_doorcontroller2)<br />Set/add a block<br />*idx* is the inventory slot number (1..n) with the block to be set |
|
||||
| "dig" | inventory slot number | TA3 Door Controller II (techage:ta3_doorcontroller2)<br />Dig/remove a block<br />*idx* is the empty inventory slot number (1..n) for the block |
|
||||
| "a2b" | nil | TA4 Move Controller command to move the block(s) from position A to B |
|
||||
| "b2a" | nil | TA4 Move Controller command to move the block(s) from position B to A |
|
||||
| "move" | nil | TA4 Move Controller command to move the block(s) to the opposite position |
|
||||
|
@ -167,7 +167,7 @@ local function exchange_node(pos, item, param2)
|
||||
return item, param2
|
||||
end
|
||||
|
||||
local function exchange_nodes(pos, nvm, slot)
|
||||
local function exchange_nodes(pos, nvm, slot, force)
|
||||
local meta = M(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
@ -179,11 +179,16 @@ local function exchange_nodes(pos, nvm, slot)
|
||||
|
||||
for idx = (slot or 1), (slot or 16) do
|
||||
local pos = nvm.pos_list[idx]
|
||||
local item = item_list[idx]
|
||||
if pos then
|
||||
item_list[idx], nvm.param2_list[idx] = exchange_node(pos, item_list[idx], nvm.param2_list[idx])
|
||||
if (force == nil)
|
||||
or (force == "dig" and item:get_count() == 0)
|
||||
or (force == "set" and item:get_count() > 0) then
|
||||
item_list[idx], nvm.param2_list[idx] = exchange_node(pos, item, nvm.param2_list[idx])
|
||||
res = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
inv:set_list("main", item_list)
|
||||
return res
|
||||
@ -342,6 +347,12 @@ techage.register_node({"techage:ta3_doorcontroller2"}, {
|
||||
elseif topic == "exchange" then
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return exchange_nodes(pos, nvm, tonumber(payload))
|
||||
elseif topic == "set" then
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return exchange_nodes(pos, nvm, tonumber(payload), "set")
|
||||
elseif topic == "dig" then
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return exchange_nodes(pos, nvm, tonumber(payload), "dig")
|
||||
end
|
||||
return false
|
||||
end,
|
||||
@ -350,9 +361,15 @@ techage.register_node({"techage:ta3_doorcontroller2"}, {
|
||||
return hide_nodes(pos) and 0 or 3
|
||||
elseif topic == 1 and payload[1] == 0 then
|
||||
return show_nodes(pos) and 0 or 3
|
||||
elseif topic == 9 then -- Exchange Block
|
||||
elseif topic == 9 and payload[1] == 0 then -- Exchange Block
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return exchange_nodes(pos, nvm, payload[1] or 1) and 0 or 3
|
||||
return exchange_nodes(pos, nvm, payload[2] or 1) and 0 or 3
|
||||
elseif topic == 9 and payload[1] == 1 then -- Set Block
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return exchange_nodes(pos, nvm, payload[2] or 1, "set") and 0 or 3
|
||||
elseif topic == 9 and payload[1] == 2 then -- Dig Block
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return exchange_nodes(pos, nvm, payload[2] or 1, "dig") and 0 or 3
|
||||
end
|
||||
return 2
|
||||
end,
|
||||
|
Loading…
Reference in New Issue
Block a user