Make improvements for the mod beduino

This commit is contained in:
Joachim Stolberg 2022-04-26 18:52:15 +02:00
parent ce69568172
commit d9bc8119fa
4 changed files with 19 additions and 10 deletions

@ -198,6 +198,8 @@ minetest.register_node("smartline:button_active", {
sounds = default.node_sound_wood_defaults(),
})
tubelib.register_node("smartline:button", {"smartline:button_active"}, {tubelib_node = true})
minetest.register_craft({
output = "smartline:button",
recipe = {

@ -175,6 +175,8 @@ minetest.register_node("tubelib:button_active", {
drop = "tubelib:button",
})
tubelib.register_node("tubelib:button", {"tubelib:button_active"}, {tubelib_node = true})
minetest.register_craft({
output = "tubelib:button",
recipe = {

@ -640,6 +640,9 @@ local function get_node_number(pos)
num = meta:get_string("own_number")
if num and num ~= "" then return num end
num = meta:get_string("own_num")
if num and num ~= "" then return num end
num = parse_number(meta:get_string("infotext"))
if num and num ~= "" then return num end

@ -18,6 +18,7 @@ local S = tubelib_addons1.S
local function switch_on(pos)
if tubelib.data_not_corrupted(pos) then
local node = minetest.get_node(pos)
if node.name == "tubelib_addons1:detector" then
node.name = "tubelib_addons1:detector_active"
minetest.swap_node(pos, node)
minetest.get_node_timer(pos):start(1)
@ -27,6 +28,7 @@ local function switch_on(pos)
local placer_name = meta:get_string("placer_name")
tubelib.send_message(numbers, placer_name, nil, "on", own_num)
end
end
end
local function switch_off(pos)
@ -63,7 +65,7 @@ minetest.register_node("tubelib_addons1:detector", {
"field[0.5,1;7,1;numbers;"..S("Insert destination node number(s)")..";]" ..
"button_exit[2,2;3,1;exit;"..S("Save").."]")
meta:set_string("placer_name", placer:get_player_name())
meta:set_string("infotext", S("Tubelib Detector, unconfigured"))
meta:set_string("infotext", S("Tubelib Detector @1", own_num))
end,
on_receive_fields = function(pos, formname, fields, player)
@ -71,7 +73,7 @@ minetest.register_node("tubelib_addons1:detector", {
if tubelib.check_numbers(fields.numbers) then
meta:set_string("numbers", fields.numbers)
local own_num = meta:get_string("own_num")
meta:set_string("infotext", S("Tubelib Detector, connected"))
meta:set_string("infotext", S("Tubelib Detector @1: connected", own_num))
meta:set_string("formspec", "size[7.5,3]"..
"field[0.5,1;7,1;numbers;"..S("Insert destination node number(s)")..";"..fields.numbers.."]" ..
"button_exit[2,2;3,1;exit;"..S("Save").."]")