ta4 tube bugfix, ta4 item detector added
This commit is contained in:
parent
82c5b06009
commit
78d0f3dccd
@ -18,6 +18,8 @@
|
||||
techage.KnownNodes = {
|
||||
["techage:tubeS"] = true,
|
||||
["techage:tubeA"] = true,
|
||||
["techage:ta4_tubeS"] = true,
|
||||
["techage:ta4_tubeA"] = true,
|
||||
}
|
||||
|
||||
|
||||
@ -26,9 +28,14 @@ local Tube = tubelib2.Tube:new({
|
||||
dirs_to_check = {1,2,3,4,5,6},
|
||||
max_tube_length = 200,
|
||||
show_infotext = false,
|
||||
primary_node_names = {"techage:tubeS", "techage:tubeA"},
|
||||
primary_node_names = {"techage:tubeS", "techage:tubeA", "techage:ta4_tubeS", "techage:ta4_tubeA"},
|
||||
after_place_tube = function(pos, param2, tube_type, num_tubes, tbl)
|
||||
minetest.swap_node(pos, {name = "techage:tube"..tube_type, param2 = param2})
|
||||
local name = minetest.get_node(pos).name
|
||||
if name == "techage:tubeS" or name == "techage:tubeA" then
|
||||
minetest.swap_node(pos, {name = "techage:tube"..tube_type, param2 = param2})
|
||||
else
|
||||
minetest.swap_node(pos, {name = "techage:ta4_tube"..tube_type, param2 = param2})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -12,27 +12,7 @@
|
||||
|
||||
]]--
|
||||
|
||||
|
||||
|
||||
-- used for registered nodes
|
||||
techage.KnownNodes = {
|
||||
["techage:ta4_tubeS"] = true,
|
||||
["techage:ta4_tubeA"] = true,
|
||||
}
|
||||
|
||||
|
||||
local Tube = tubelib2.Tube:new({
|
||||
-- North, East, South, West, Down, Up
|
||||
dirs_to_check = {1,2,3,4,5,6},
|
||||
max_tube_length = 300,
|
||||
show_infotext = false,
|
||||
primary_node_names = {"techage:ta4_tubeS", "techage:ta4_tubeA"},
|
||||
after_place_tube = function(pos, param2, tube_type, num_tubes, tbl)
|
||||
minetest.swap_node(pos, {name = "techage:ta4_tube"..tube_type, param2 = param2})
|
||||
end,
|
||||
})
|
||||
|
||||
techage.Tube = Tube
|
||||
local Tube = techage.Tube
|
||||
|
||||
minetest.register_node("techage:ta4_tubeS", {
|
||||
description = "TA4 Tube",
|
||||
|
@ -152,5 +152,6 @@ techage.Items = {
|
||||
ta4_distributor = "techage:ta4_distributor_pas",
|
||||
ta4_gravelsieve = "techage:ta4_gravelsieve_pas",
|
||||
ta4_grinder = "techage:ta4_grinder_pas",
|
||||
ta4_detector = "techage:ta4_detector_off",
|
||||
--ta4_ "",
|
||||
}
|
||||
|
@ -152,6 +152,7 @@ techage.manual_DE.aTitel = {
|
||||
"3,TA4 Taster/Schalter / Button/Switch",
|
||||
"3,TA4 Spieler Detektor / Player Detector",
|
||||
"3,TA4 Zustandssammler / State Collector",
|
||||
"3,TA4 Detektor / Detector",
|
||||
"2,Weitere TA4 Blöcke",
|
||||
"3,TA4 Tank / TA4 Tank",
|
||||
"3,TA4 Pumpe / TA4 Pump",
|
||||
@ -872,7 +873,7 @@ techage.manual_DE.aText = {
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Der Detektor ist eine spezieller Röhrenblock\\, der erkennt\\, wenn Items über die Röhre weitergegeben werden. Es muss dazu auf beiden Seiten mit der Röhre verbunden sein.\n"..
|
||||
"Der Detektor ist eine spezieller Röhrenblock\\, der erkennt\\, wenn Items über die Röhre weitergegeben werden. Es muss dazu auf beiden Seiten mit der Röhre verbunden sein. Werden Items mit einem Schieber in den Detektor geschoben\\, gibt er diese automatisch weiter.\n"..
|
||||
"Er sendet ein 'on'\\, wenn ein Item erkannt wird\\, gefolgt von einem 'off' eine Sekunde später.\n"..
|
||||
"Danach werden weitere Kommando für 8 Sekunden blockiert.\n"..
|
||||
"\n"..
|
||||
@ -1241,6 +1242,11 @@ techage.manual_DE.aText = {
|
||||
"\n"..
|
||||
"Der Zustandssammler fragt der Reihe nach alle konfigurierten Maschinen nach dem Status ab. Wenn eine der Maschinen einen vorkonfigurierte Status erreicht oder überschritten hat\\, wird ein \"on\" Kommando gesendet. Damit können bspw. vom einem Lua Controller aus sehr einfach viele Maschinen auf Störungen überwacht werden.\n"..
|
||||
"\n",
|
||||
"Die Funktionalität ist gleich wie beim TA3 Detektor / Detector. Zusätzlich zählt der Detector aber die weitergegebenen Items. \n"..
|
||||
"Diesen Zähler kann man über das Kommando 'count' abfragen und über 'reset' zurücksetzen.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"",
|
||||
"Siehe TA3 Tank.\n"..
|
||||
"\n"..
|
||||
@ -1264,7 +1270,7 @@ techage.manual_DE.aText = {
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"TA4 hat auch seine eigenen Röhren im TA4 Design. Die maximale Länge beträgt 300 m (Blöcke). Ansonsten entsprechen die TA4 Röhren den Standard Röhren.\n"..
|
||||
"TA4 hat auch seine eigenen Röhren im TA4 Design. Diese entsprechen den Standard Röhren\\, sehen nur besser aus. \\;-)\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
@ -1442,6 +1448,7 @@ techage.manual_DE.aItemName = {
|
||||
"ta4_button",
|
||||
"ta4_playerdetector",
|
||||
"ta4_collector",
|
||||
"ta4_detector",
|
||||
"",
|
||||
"ta4_tank",
|
||||
"ta4_pump",
|
||||
@ -1616,5 +1623,6 @@ techage.manual_DE.aPlanTable = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
}
|
||||
|
||||
|
@ -256,6 +256,7 @@ TA3 Vacuum Tube=TA3 Vakuumröhre
|
||||
TA4 Button/Switch=TA4 Schalter/Taster
|
||||
TA4 Carbon Fiber=TA4 Kohlefaser
|
||||
TA4 Derrick=TA4 Bohrturm
|
||||
TA4 Detector=TA4 Detektor
|
||||
TA4 Doser=TA4 Dosierer
|
||||
TA4 Electrolyzer=TA4 Elektrolyseur
|
||||
TA4 Fuel Cell=TA4 Brennstoffzelle
|
||||
|
@ -254,6 +254,7 @@ TA3 Vacuum Tube=
|
||||
TA4 Button/Switch=
|
||||
TA4 Carbon Fiber=
|
||||
TA4 Derrick=
|
||||
TA4 Detector=
|
||||
TA4 Doser=
|
||||
TA4 Electrolyzer=
|
||||
TA4 Fuel Cell=
|
||||
|
@ -8,13 +8,14 @@
|
||||
GPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
Item detector
|
||||
TA3/TA4 Item detector
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
local NDEF = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}) end
|
||||
|
||||
local logic = techage.logic
|
||||
local BLOCKING_TIME = 8 -- seconds
|
||||
@ -23,14 +24,24 @@ local function switch_on(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
local t = minetest.get_gametime()
|
||||
if t > (mem.time or 0) then
|
||||
logic.swap_node(pos, "techage:ta3_detector_on")
|
||||
local name = techage.get_node_lvm(pos).name
|
||||
if name == "techage:ta3_detector_off" then
|
||||
logic.swap_node(pos, "techage:ta3_detector_on")
|
||||
else
|
||||
logic.swap_node(pos, "techage:ta4_detector_on")
|
||||
end
|
||||
logic.send_on(pos, M(pos), 1)
|
||||
mem.time = t + BLOCKING_TIME
|
||||
end
|
||||
end
|
||||
|
||||
local function switch_off(pos)
|
||||
logic.swap_node(pos, "techage:ta3_detector_off")
|
||||
local name = techage.get_node_lvm(pos).name
|
||||
if name == "techage:ta3_detector_on" then
|
||||
logic.swap_node(pos, "techage:ta3_detector_off")
|
||||
else
|
||||
logic.swap_node(pos, "techage:ta4_detector_off")
|
||||
end
|
||||
logic.send_off(pos, M(pos))
|
||||
end
|
||||
|
||||
@ -41,6 +52,35 @@ local function formspec(meta)
|
||||
"button_exit[2,2;3,1;exit;"..S("Save").."]"
|
||||
end
|
||||
|
||||
local function after_place_node(pos, placer)
|
||||
local meta = M(pos)
|
||||
logic.after_place_node(pos, placer, "techage:ta3_detector_off", NDEF(pos).description)
|
||||
logic.infotext(meta, NDEF(pos).description)
|
||||
meta:set_string("formspec", formspec(meta))
|
||||
end
|
||||
|
||||
local function on_receive_fields(pos, formname, fields, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if techage.check_numbers(fields.numbers, player:get_player_name()) then
|
||||
meta:set_string("numbers", fields.numbers)
|
||||
logic.infotext(M(pos), NDEF(pos).description)
|
||||
meta:set_string("formspec", formspec(M(pos)))
|
||||
end
|
||||
end
|
||||
|
||||
local function techage_set_numbers(pos, numbers, player_name)
|
||||
local meta = M(pos)
|
||||
local res = logic.set_numbers(pos, numbers, player_name, NDEF(pos).description)
|
||||
meta:set_string("formspec", formspec(meta))
|
||||
return res
|
||||
end
|
||||
|
||||
local function after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos)
|
||||
techage.del_mem(pos)
|
||||
end
|
||||
|
||||
|
||||
minetest.register_node("techage:ta3_detector_off", {
|
||||
description = S("TA3 Detector"),
|
||||
tiles = {
|
||||
@ -53,33 +93,10 @@ minetest.register_node("techage:ta3_detector_off", {
|
||||
"techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_detector.png",
|
||||
},
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = M(pos)
|
||||
logic.after_place_node(pos, placer, "techage:ta3_detector_off", S("TA3 Detector"))
|
||||
logic.infotext(meta, S("TA3 Detector"))
|
||||
meta:set_string("formspec", formspec(meta))
|
||||
end,
|
||||
|
||||
on_receive_fields = function(pos, formname, fields, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if techage.check_numbers(fields.numbers, player:get_player_name()) then
|
||||
meta:set_string("numbers", fields.numbers)
|
||||
logic.infotext(M(pos), S("TA3 Detector"))
|
||||
meta:set_string("formspec", formspec(M(pos)))
|
||||
end
|
||||
end,
|
||||
|
||||
techage_set_numbers = function(pos, numbers, player_name)
|
||||
local meta = M(pos)
|
||||
local res = logic.set_numbers(pos, numbers, player_name, S("TA3 Detector"))
|
||||
meta:set_string("formspec", formspec(meta))
|
||||
return res
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos)
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
after_place_node = after_place_node,
|
||||
on_receive_fields = on_receive_fields,
|
||||
techage_set_numbers = techage_set_numbers,
|
||||
after_dig_node = after_dig_node,
|
||||
|
||||
on_rotate = screwdriver.disallow,
|
||||
paramtype = "light",
|
||||
@ -105,18 +122,8 @@ minetest.register_node("techage:ta3_detector_on", {
|
||||
|
||||
on_timer = switch_off,
|
||||
on_rotate = screwdriver.disallow,
|
||||
|
||||
techage_set_numbers = function(pos, numbers, player_name)
|
||||
local meta = M(pos)
|
||||
local res = logic.set_numbers(pos, numbers, player_name, S("TA3 Detector"))
|
||||
meta:set_string("formspec", formspec(meta))
|
||||
return res
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos)
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
techage_set_numbers = techage_set_numbers,
|
||||
after_dig_node = after_dig_node,
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {choppy=2, cracky=2, crumbly=2, not_in_creative_inventory=1},
|
||||
@ -125,6 +132,57 @@ minetest.register_node("techage:ta3_detector_on", {
|
||||
drop = "techage:ta3_detector_off",
|
||||
})
|
||||
|
||||
minetest.register_node("techage:ta4_detector_off", {
|
||||
description = S("TA4 Detector"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_filling_ta4.png^techage_frame_ta4_top.png^techage_appl_arrow.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4_top.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_outp.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_inp.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_detector.png^[transformFX",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_detector.png",
|
||||
},
|
||||
|
||||
after_place_node = after_place_node,
|
||||
on_receive_fields = on_receive_fields,
|
||||
techage_set_numbers = techage_set_numbers,
|
||||
after_dig_node = after_dig_node,
|
||||
|
||||
on_rotate = screwdriver.disallow,
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "facedir",
|
||||
groups = {choppy=2, cracky=2, crumbly=2},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("techage:ta4_detector_on", {
|
||||
description = S("TA4 Detector"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_filling_ta4.png^techage_frame_ta4_top.png^techage_appl_arrow.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4_top.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_outp.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_inp.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_detector_on.png^[transformFX",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_detector_on.png",
|
||||
},
|
||||
|
||||
on_timer = switch_off,
|
||||
on_rotate = screwdriver.disallow,
|
||||
techage_set_numbers = techage_set_numbers,
|
||||
after_dig_node = after_dig_node,
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {choppy=2, cracky=2, crumbly=2, not_in_creative_inventory=1},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
drop = "techage:ta4_detector_off",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta3_detector_off",
|
||||
recipe = {
|
||||
@ -134,6 +192,14 @@ minetest.register_craft({
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta4_detector_off",
|
||||
recipe = {
|
||||
{"", "techage:ta3_detector_off", ""},
|
||||
{"", "techage:ta4_wlanchip", ""},
|
||||
{"", "", ""},
|
||||
},
|
||||
})
|
||||
|
||||
techage.register_node({"techage:ta3_detector_off", "techage:ta3_detector_on"}, {
|
||||
on_push_item = function(pos, in_dir, stack)
|
||||
@ -146,3 +212,30 @@ techage.register_node({"techage:ta3_detector_off", "techage:ta3_detector_on"}, {
|
||||
is_pusher = true, -- is a pulling/pushing node
|
||||
})
|
||||
|
||||
techage.register_node({"techage:ta4_detector_off", "techage:ta4_detector_on"}, {
|
||||
on_push_item = function(pos, in_dir, stack)
|
||||
if techage.push_items(pos, in_dir, stack) then
|
||||
switch_on(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
nvm.counter = (nvm.counter or 0) + stack:get_count()
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end,
|
||||
is_pusher = true, -- is a pulling/pushing node
|
||||
|
||||
on_recv_message = function(pos, src, topic, payload)
|
||||
print(topic, payload)
|
||||
if topic == "count" then
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return nvm.counter or 0
|
||||
elseif topic == "reset" then
|
||||
local nvm = techage.get_nvm(pos)
|
||||
nvm.counter = 0
|
||||
return true
|
||||
else
|
||||
return "unsupported"
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -548,10 +548,11 @@ Detektoren scannen ihre Umgebung ab und senden ein `on`-Kommando, wenn das Gesuc
|
||||
|
||||
### TA3 Detektor / Detector
|
||||
|
||||
Der Detektor ist eine spezieller Röhrenblock, der erkennt, wenn Items über die Röhre weitergegeben werden. Es muss dazu auf beiden Seiten mit der Röhre verbunden sein.
|
||||
Der Detektor ist eine spezieller Röhrenblock, der erkennt, wenn Items über die Röhre weitergegeben werden. Es muss dazu auf beiden Seiten mit der Röhre verbunden sein. Werden Items mit einem Schieber in den Detektor geschoben, gibt er diese automatisch weiter.
|
||||
Er sendet ein `on`, wenn ein Item erkannt wird, gefolgt von einem `off` eine Sekunde später.
|
||||
Danach werden weitere Kommando für 8 Sekunden blockiert.
|
||||
|
||||
|
||||
[ta3_detector|image]
|
||||
|
||||
|
||||
|
@ -401,6 +401,13 @@ Beim TA4 Spieler Detektor hat sich nur das Aussehen geändert. Die Funktionalit
|
||||
|
||||
Der Zustandssammler fragt der Reihe nach alle konfigurierten Maschinen nach dem Status ab. Wenn eine der Maschinen einen vorkonfigurierte Status erreicht oder überschritten hat, wird ein "on" Kommando gesendet. Damit können bspw. vom einem Lua Controller aus sehr einfach viele Maschinen auf Störungen überwacht werden.
|
||||
|
||||
### TA4 Detektor / Detector
|
||||
|
||||
Die Funktionalität ist gleich wie beim TA3 Detektor / Detector. Zusätzlich zählt der Detector aber die weitergegebenen Items.
|
||||
Diesen Zähler kann man über das Kommando 'count' abfragen und über 'reset' zurücksetzen.
|
||||
|
||||
[ta4_detector|image]
|
||||
|
||||
|
||||
## Weitere TA4 Blöcke
|
||||
|
||||
@ -436,7 +443,7 @@ Mit der Wasserpumpe kann Wasser über Flüssigkeitsleitungen in Tanks gepumpt un
|
||||
|
||||
### TA4 Röhren / TA4 Tube
|
||||
|
||||
TA4 hat auch seine eigenen Röhren im TA4 Design. Die maximale Länge beträgt 300 m (Blöcke). Ansonsten entsprechen die TA4 Röhren den Standard Röhren.
|
||||
TA4 hat auch seine eigenen Röhren im TA4 Design. Diese entsprechen den Standard Röhren, sehen nur besser aus. ;-)
|
||||
|
||||
[ta4_tube|image]
|
||||
|
||||
|
@ -357,18 +357,20 @@ In addition to Lua standard function the Lua Controller provides the following f
|
||||
| "delivered" | number | Read the current delivered power value from 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 |
|
||||
| "count" | number | Read the item counter of the TA4 Item Detector block |
|
||||
|
||||
|
||||
|
||||
|
||||
* `$send_cmnd(num, cmnd, data)` - Send a command to another block. _num_ is the number of the remote block, like "1234". _cmnd_ is the command, _data_ is additional data (see table below):
|
||||
|
||||
| cmnd | data | comment |
|
||||
| -------------------------------- | ----------- | ----------------------------------------- |
|
||||
| "on", "off" | nil | turn a node on/off (machine, lamp,...) |
|
||||
| "red, "amber", "green", "off" | nil | set Signal Tower color |
|
||||
| "red", "green", "blue", "yellow" | "on", "off" | Enable/disable a Distributor filter slot. |
|
||||
| "text" | text string | Text to be used for the Sensor Chest menu |
|
||||
| cmnd | data | comment |
|
||||
| -------------------------------- | ----------- | ----------------------------------------------------- |
|
||||
| "on", "off" | nil | turn a node on/off (machine, lamp,...) |
|
||||
| "red, "amber", "green", "off" | nil | set Signal Tower color |
|
||||
| "red", "green", "blue", "yellow" | "on", "off" | Enable/disable a Distributor filter slot. |
|
||||
| "text" | text string | Text to be used for the Sensor Chest menu |
|
||||
| "reset" | nil | Reset the item counter of the TA4 Item Detector block |
|
||||
|
||||
|
||||
|
||||
|
Binary file not shown.
@ -151,6 +151,7 @@
|
||||
- [TA4 Taster/Schalter / Button/Switch](./manual_ta4_DE.md#ta4-tasterschalter--buttonswitch)
|
||||
- [TA4 Spieler Detektor / Player Detector](./manual_ta4_DE.md#ta4-spieler-detektor--player-detector)
|
||||
- [TA4 Zustandssammler / State Collector](./manual_ta4_DE.md#ta4-zustandssammler--state-collector)
|
||||
- [TA4 Detektor / Detector](./manual_ta4_DE.md#ta4-detektor--detector)
|
||||
- [Weitere TA4 Blöcke](./manual_ta4_DE.md#weitere-ta4-blöcke)
|
||||
- [TA4 Tank / TA4 Tank](./manual_ta4_DE.md#ta4-tank--ta4-tank)
|
||||
- [TA4 Pumpe / TA4 Pump](./manual_ta4_DE.md#ta4-pumpe--ta4-pump)
|
||||
|
Loading…
Reference in New Issue
Block a user