Minor improvements

master
Joachim Stolberg 2022-06-07 19:14:43 +02:00
parent 7bc1221249
commit e2bd472408
7 changed files with 35 additions and 13 deletions

View File

@ -182,13 +182,19 @@ end
local function config_item(pos, payload)
if type(payload) == "string" then
local name, count = unpack(payload:split(" "))
if name and (minetest.registered_nodes[name] or minetest.registered_items[name]
or minetest.registered_craftitems[name]) then
count = tonumber(count) or 1
if payload == "" then
local inv = M(pos):get_inventory()
inv:set_stack("main", 1, {name = name, count = 1})
return count
inv:set_stack("main", 1, nil)
return 0
else
local name, count = unpack(payload:split(" "))
if name and (minetest.registered_nodes[name] or minetest.registered_items[name]
or minetest.registered_craftitems[name]) then
count = tonumber(count) or 1
local inv = M(pos):get_inventory()
inv:set_stack("main", 1, {name = name, count = 1})
return count
end
end
end
return 0

View File

@ -1914,7 +1914,7 @@ techage.manual_DE.aText = {
"\n"..
"Der TA4 Schieber besitzt zwei zusätzliche Kommandos für den Lua Controller:\n"..
"\n"..
" - 'config' dient zur Konfiguration des Schiebers\\, analog zum manuellen Konfiguration über das Menü.\nBeispiel: '$send_cmnd(1234\\, \"config\"\\, \"default:dirt\")'\n"..
" - 'config' dient zur Konfiguration des Schiebers\\, analog zum manuellen Konfiguration über das Menü.\nBeispiel: '$send_cmnd(1234\\, \"config\"\\, \"default:dirt\")'\nMit '$send_cmnd(1234\\, \"config\"\\, \"\")' wird die Konfiguration gelöscht\n"..
" - 'pull' dient zum Absetzen eines Auftrags an den Schieber:\nBeispiel: '$send_cmnd(1234\\, \"pull\"\\, \"default:dirt 8\")'\nAls Nummer sind Werte von 1 bis 12 zulässig. Danach geht der Schieber wieder in den 'stopped' Mode und sendet ein \"off\" Kommando zurück an den Sender des \"pull\" Kommandos.\n"..
"\n"..
"\n"..

View File

@ -1910,7 +1910,7 @@ techage.manual_EN.aText = {
"\n"..
"The TA4 pusher has two additional commands for the Lua controller:\n"..
"\n"..
" - 'config' is used to configure the pusher\\, analogous to manual configuration via the menu.\nExample: '$send_cmnd(1234\\, \"config\"\\, \"default: dirt\")'\n"..
" - 'config' is used to configure the pusher\\, analogous to manual configuration via the menu.\nExample: '$send_cmnd(1234\\, \"config\"\\, \"default: dirt\")'\nWith '$send_cmnd(1234\\, \"config\"\\, \"\")' the configuration is deleted\n"..
" - 'pull' is used to send an order to the pusher:\nExample: '$send_cmnd(1234\\, \"pull\"\\, \"default: dirt 8\")'\nValues from 1 to 12 are permitted as numbers. Then the pusher goes back to 'stopped' mode and sends an\" off \"command back to the transmitter of the\" pull \"command.\n"..
"\n"..
"\n"..

View File

@ -83,12 +83,21 @@ local function formspec(meta)
"button_exit[2,2;3,1;exit;"..S("Save").."]"
end
local function after_place_node(pos, placer)
local function after_place_node3(pos, placer)
local meta = M(pos)
local inv = meta:get_inventory()
inv:set_size('cfg', 4)
logic.after_place_node(pos, placer, "techage:ta3_detector_off", NDEF(pos).description)
logic.infotext(meta, NDEF(pos).description)
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
local function after_place_node4(pos, placer)
local meta = M(pos)
local inv = meta:get_inventory()
inv:set_size('cfg', 4)
logic.after_place_node(pos, placer, "techage:ta4_detector_off", S("TA4 Detector"))
logic.infotext(meta, S("TA4 Detector"))
meta:set_string("formspec", formspec(meta))
end
@ -126,7 +135,7 @@ minetest.register_node("techage:ta3_detector_off", {
"techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_detector.png",
},
after_place_node = after_place_node,
after_place_node = after_place_node3,
on_receive_fields = on_receive_fields,
techage_set_numbers = techage_set_numbers,
after_dig_node = after_dig_node,
@ -179,7 +188,7 @@ minetest.register_node("techage:ta4_detector_off", {
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_detector.png",
},
after_place_node = after_place_node,
after_place_node = after_place_node4,
on_receive_fields = on_receive_fields,
techage_set_numbers = techage_set_numbers,
after_dig_node = after_dig_node,

View File

@ -844,6 +844,7 @@ Der TA4 Schieber besitzt zwei zusätzliche Kommandos für den Lua Controller:
- `config` dient zur Konfiguration des Schiebers, analog zum manuellen Konfiguration über das Menü.
Beispiel: `$send_cmnd(1234, "config", "default:dirt")`
Mit `$send_cmnd(1234, "config", "")` wird die Konfiguration gelöscht
- `pull` dient zum Absetzen eines Auftrags an den Schieber:
Beispiel: `$send_cmnd(1234, "pull", "default:dirt 8")`
Als Nummer sind Werte von 1 bis 12 zulässig. Danach geht der Schieber wieder in den `stopped` Mode und sendet ein "off" Kommando zurück an den Sender des "pull" Kommandos.

View File

@ -836,6 +836,7 @@ The TA4 pusher has two additional commands for the Lua controller:
- `config` is used to configure the pusher, analogous to manual configuration via the menu.
Example: `$send_cmnd(1234, "config", "default: dirt")`
With `$send_cmnd(1234, "config", "")` the configuration is deleted
- `pull` is used to send an order to the pusher:
Example: `$send_cmnd(1234, "pull", "default: dirt 8")`
Values from 1 to 12 are permitted as numbers. Then the pusher goes back to `stopped` mode and sends an" off "command back to the transmitter of the" pull "command.

View File

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