improve ta4 sensor box

master
Joachim Stolberg 2020-08-30 19:16:32 +02:00
parent 5fbfe95011
commit dcb06e210e
12 changed files with 79 additions and 22 deletions

View File

@ -1340,7 +1340,16 @@ techage.manual_DE.aText = {
"\n"..
"\n"..
"\n",
"Die TA4 Sensor Kiste dient zum Aufbau von Automatischen Lagern oder Verkaufsautomaten. Sie hat erweitere Kommandos zur Fernsteuerung.\n"..
"Die TA4 Sensor Kiste dient zum Aufbau von Automatischen Lagern oder Verkaufsautomaten in Verbindung mit dem Lua Controller.\n"..
"Wird etwas in die Kiste gelegt\\, oder entnommen\\, oder eine der Tasten \"F1\"/\"F2\" gedrückt\\, so wird ein Event-Signal an den Lua Controller gesendet.\n"..
"Die Sensor Kiste unterstützt folgende Kommandos:\n"..
"\n"..
" - Über 'state = $read_data(<num>\\, \"state\")' kann der Status der Kiste abgefragt werden. Mögliche Antworten sind: \"empty\"\\, \"loaded\"\\, \"full\"\n"..
" - Über 'name\\, action = $read_data(<num>\\, \"action\")' kann die letzte Spieleraktion abgefragt werden. 'name' ist der Spielername\\, Als 'action' wird zurückgeliefert: \"put\"\\, \"take\"\\, \"f1\"\\, \"f2\".\n"..
" - Über 'stacks = $read_data(<num>\\, \"stacks\")' kann der Inhalt der Kiste ausgelesen werden. Siehe dazu: https://github.com/joe7575/techage/blob/master/manuals/ta4_lua_controller_EN.md#sensor-chest\n"..
" - Über '$send_cmnd(<num>\\, \"text\"\\, \"press both buttons andnput something into the chest\")' kann der Text im Menü der Sensor Kiste gesetzt werden.\n"..
"\n"..
"Über die Checkbox \"Erlaube öffentlichen Zugriff\" kann eingestellt werden\\, ob die Kiste von jedem genutzt werden darf\\, oder nur vom Spielern die hier Zugriffsrechte haben.\n"..
"\n"..
"\n"..
"\n",

View File

@ -1331,7 +1331,16 @@ techage.manual_EN.aText = {
"\n"..
"\n"..
"\n",
"The TA4 sensor box is used to set up automatic warehouses or vending machines. It has additional commands for remote control.\n"..
"The TA4 sensor box is used to set up automatic warehouses or vending machines in conjunction with the Lua controller.\n"..
"If something is put into the box or removed\\, or one of the \"F1\" / \"F2\" keys is pressed\\, an event signal is sent to the Lua controller.\n"..
"The sensor box supports the following commands:\n"..
"\n"..
" - The status of the box can be queried via 'state = $read_data(<num>\\, \"state\")'. Possible answers are: \"empty\"\\, \"loaded\"\\, \"full\"\n"..
" - The last player action can be queried via 'name\\, action = $read_data(<num>\\, \"action\")'. 'name' is the player name. One of the following is returned as 'action': \"put\"\\, \"take\"\\, \"f1\"\\, \"f2\".\n"..
" - The contents of the box can be read out via 'stacks = $read_data(<num>\\, \"stacks\")'. See: https://github.com/joe7575/techage/blob/master/manuals/ta4_lua_controller_EN.md#sensor-chest\n"..
" - Via '$send_cmnd(<num>\\, \"text\"\\, \"press both buttons andnput something into the chest\")' the text can be set in the menu of the sensor box.\n"..
"\n"..
"The checkbox \"Allow public chest access\" can be used to set whether the box can be used by everyone or only by players who have access/protection rights here.\n"..
"\n"..
"\n"..
"\n",
@ -1417,8 +1426,8 @@ 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"..
" - '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"..
" - 'config' is used to configure the pusher\\, analogous to manual configuration via the menu.\nExample: '$send_cmnd(1234\\, \"config\"\\, \"default: dirt\")'\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"..
"\n",
@ -1449,7 +1458,7 @@ techage.manual_EN.aText = {
"\n"..
"The chest has an additional command for the Lua controller:\n"..
"\n"..
" - 'count' is used to request how many items are in the chest.\nExample 1: '$ read_data(CHEST\\, \"count\")' -> Sum of items across all 8 stores\nExample 2: '$ read_data(CHEST\\, \"count\"\\, 2)' -> number of items in store 2 (second from left)\n"..
" - 'count' is used to request how many items are in the chest.\nExample 1: '$read_data(CHEST\\, \"count\")' -> Sum of items across all 8 stores\nExample 2: '$read_data(CHEST\\, \"count\"\\, 2)' -> number of items in store 2 (second from left)\n"..
"\n"..
"\n"..
"\n",

View File

@ -17,6 +17,7 @@ local S = techage.S
minetest.register_craftitem("techage:hydrogen", {
description = S("TA4 Hydrogen"),
inventory_image = "techage_hydrogen_inv.png",
groups = {ta_liquid = 1},
})
minetest.register_craftitem("techage:cylinder_small_hydrogen", {

View File

@ -17,6 +17,7 @@ local S = techage.S
minetest.register_craftitem("techage:lye", {
description = S("Lye"),
inventory_image = "techage_liquid2_inv.png^[colorize:#7fd44c:120^techage_liquid1_inv.png",
groups = {ta_liquid = 1},
})
minetest.register_craftitem("techage:barrel_lye", {

View File

@ -58,7 +58,7 @@ minetest.register_node("techage:oil_source", {
liquid_range = 10,
liquid_renewable = false,
post_effect_color = {a = 200, r = 1, g = 1, b = 1},
groups = {liquid = 5},
groups = {liquid = 5, ta_liquid = 1},
})
minetest.register_node("techage:oil_flowing", {

View File

@ -18,26 +18,31 @@ local S = techage.S
minetest.register_craftitem("techage:bitumen", {
description = S("TA3 Bitumen"),
inventory_image = "techage_liquid2_inv.png^[colorize:#000000",
groups = {ta_liquid = 1},
})
minetest.register_craftitem("techage:fueloil", {
description = S("TA3 Fuel Oil"),
inventory_image = "techage_liquid2_inv.png^[colorize:#7E5D0A:180^techage_liquid1_inv.png",
groups = {ta_liquid = 1},
})
minetest.register_craftitem("techage:naphtha", {
description = S("TA3 Naphtha"),
inventory_image = "techage_liquid2_inv.png^[colorize:#AAA820:180^techage_liquid1_inv.png",
groups = {ta_liquid = 1},
})
minetest.register_craftitem("techage:gasoline", {
description = S("TA3 Gasoline"),
inventory_image = "techage_liquid2_inv.png^[colorize:#EEFC52:180^techage_liquid1_inv.png",
groups = {ta_liquid = 1},
})
minetest.register_craftitem("techage:gas", {
description = S("TA3 Propane"),
inventory_image = "techage_gas_inv.png",
groups = {ta_liquid = 1},
})
minetest.register_craftitem("techage:ta3_cylinder_small_gas", {

View File

@ -26,9 +26,10 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
-- check if it is powder
local ndef = minetest.registered_craftitems[stack:get_name()] or {}
if ndef.groups and ndef.groups.powder == 1 then
-- check if it is powder or techage liquid item (migration function)
local ndef = minetest.registered_craftitems[stack:get_name()] or
minetest.registered_items[stack:get_name()] or {}
if ndef.groups and (ndef.groups.powder == 1 or ndef.groups.ta_liquid == 1) then
local nvm = techage.get_nvm(pos)
nvm.item_name = nil
local inv = minetest.get_meta(pos):get_inventory()

View File

@ -1,10 +1,11 @@
# textdomain: techage
ku is needed!)= ku wird benötigt!)
ku is needed!)=
#### TA3 Terminal ####@n@nSend commands to your machines@nand output text messages from your@nmachines to the Terminal.@n@nCommand syntax:@n cmd <num> <cmnd>@n@nexample: cmd 181 on@n<num> is the number of the node to which the command is sent@n'on' is the command to turn machines/nodes on@nFurther commands can be retrieved by clicking on@nmachines/nodes with the Techage Info Tool.@n@nLocal commands:@n- clear @= clear screen@n- help @= this message@n- pub @= switch to public use@n- priv @= switch to private use@nTo program a user button with a command:@n set <button-num> <button-text> <command>@ne.g. 'set 1 ON cmd 123 on'@n=
Accu Box=Akkublock
Active:=Aktiv:
All nodes:=Alle Blöcke:
Allow public chest access=Erlaube öffentlichen Zugriff
Allow to dig/place Techage power lines nearby power poles=Erlaubt TODO
Aluminum=Aluminium
Area already loaded or max. number of Forceload Blocks reached!=Bereich bereits geladen oder maximale Anzahl von Forceload Blöcken erreicht!
@ -453,3 +454,4 @@ water temperature=Wassertemperatur
wrong catalyst=falscher Katalysator
wrong storage diameter=Falscher Wärmespeicher-Durchmesser
##### not used anymore #####
ku is needed!)= ku wird benötigt!)

View File

@ -3,6 +3,7 @@
Accu Box=
Active:=
All nodes:=
Allow public chest access=
Allow to dig/place Techage power lines nearby power poles=
Aluminum=
Area already loaded or max. number of Forceload Blocks reached!=

View File

@ -63,7 +63,7 @@ local function get_stacks(pos)
end
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
if M(pos):get_string("public") ~= "true" and minetest.is_protected(pos, player:get_player_name()) then
return 0
end
store_action(pos, player, "put")
@ -72,7 +72,7 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
end
local function allow_metadata_inventory_take(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
if M(pos):get_string("public") ~= "true" and minetest.is_protected(pos, player:get_player_name()) then
return 0
end
store_action(pos, player, "take")
@ -93,12 +93,13 @@ local function after_dig_node(pos, oldnode, oldmetadata, digger)
end
local function formspec1()
return "size[6,4]"..
return "size[5.5,4]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"field[0.5,1;5,1;number;TA4 Lua Controller number:;]" ..
"button_exit[1.5,2.5;2,1;exit;Save]"
"checkbox[0.5,1.8;public;"..S("Allow public chest access")..";false]"..
"button_exit[1.7,2.8;2,1;exit;Save]"
end
local function formspec2(pos)
@ -147,7 +148,15 @@ minetest.register_node("techage:ta4_sensor_chest", {
on_receive_fields = function(pos, formname, fields, player)
local meta = M(pos)
local nvm = techage.get_nvm(pos)
if fields.number and fields.number ~= "" then
if meta:get_string("public") ~= "true" and minetest.is_protected(pos, player:get_player_name()) then
return 0
end
if fields.public then
meta:set_string("public", fields.public)
end
if fields.quit == "true" and fields.number and fields.number ~= "" then
local owner = meta:get_string("owner")
if techage.check_numbers(fields.number, owner) then
meta:set_string("number", fields.number)

View File

@ -386,7 +386,17 @@ Der Server dient zur zentralen Speicherung von Daten von mehreren Lua Controller
### TA4 Sensor Kiste/Chest
Die TA4 Sensor Kiste dient zum Aufbau von Automatischen Lagern oder Verkaufsautomaten. Sie hat erweitere Kommandos zur Fernsteuerung.
Die TA4 Sensor Kiste dient zum Aufbau von Automatischen Lagern oder Verkaufsautomaten in Verbindung mit dem Lua Controller.
Wird etwas in die Kiste gelegt, oder entnommen, oder eine der Tasten "F1"/"F2" gedrückt, so wird ein Event-Signal an den Lua Controller gesendet.
Die Sensor Kiste unterstützt folgende Kommandos:
- Über `state = $read_data(<num>, "state")` kann der Status der Kiste abgefragt werden. Mögliche Antworten sind: "empty", "loaded", "full"
- Über `name, action = $read_data(<num>, "action")` kann die letzte Spieleraktion abgefragt werden. `name` ist der Spielername, Als `action` wird zurückgeliefert: "put", "take", "f1", "f2".
- Über `stacks = $read_data(<num>, "stacks")` kann der Inhalt der Kiste ausgelesen werden. Siehe dazu: https://github.com/joe7575/techage/blob/master/manuals/ta4_lua_controller_EN.md#sensor-chest
- Über `$send_cmnd(<num>, "text", "press both buttons and\nput something into the chest")` kann der Text im Menü der Sensor Kiste gesetzt werden.
Über die Checkbox "Erlaube öffentlichen Zugriff" kann eingestellt werden, ob die Kiste von jedem genutzt werden darf, oder nur von Spielern die hier Zugriffsrechte haben.
[ta4_sensor_chest|image]
@ -602,4 +612,4 @@ Beim Weitergeben wird in der Zielmaschine pro Item nur eine Position im Inventar
Die Verarbeitungsleistung beträgt bis zu 8 Items alle 3 Sekunden.
[ta4_injector|image]
[ta4_injector|image]

View File

@ -388,7 +388,16 @@ The server is used for the central storage of data from several Lua controllers.
### TA4 Sensor Box / Chest
The TA4 sensor box is used to set up automatic warehouses or vending machines. It has additional commands for remote control.
The TA4 sensor box is used to set up automatic warehouses or vending machines in conjunction with the Lua controller.
If something is put into the box or removed, or one of the "F1" / "F2" keys is pressed, an event signal is sent to the Lua controller.
The sensor box supports the following commands:
- The status of the box can be queried via `state = $read_data(<num>, "state")`. Possible answers are: "empty", "loaded", "full"
- The last player action can be queried via `name, action = $read_data(<num>, "action")`. `name` is the player name. One of the following is returned as `action`: "put", "take", "f1", "f2".
- The contents of the box can be read out via `stacks = $read_data(<num>, "stacks")`. See: https://github.com/joe7575/techage/blob/master/manuals/ta4_lua_controller_EN.md#sensor-chest
- Via `$send_cmnd(<num>, "text", "press both buttons and\nput something into the chest")` the text can be set in the menu of the sensor box.
The checkbox "Allow public chest access" can be used to set whether the box can be used by everyone or only by players who have access/protection rights here.
[ta4_sensor_chest|image]
@ -513,9 +522,9 @@ The processing power is 12 items every 2 s, if TA4 tubes are used on both sides.
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")`
Example: `$send_cmnd(1234, "config", "default: dirt")`
- `pull` is used to send an order to the pusher:
Example: `$ send_cmnd(1234, "pull", "default: dirt 8")`
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.
[ta4_pusher|image]
@ -552,8 +561,8 @@ The chest can only be used by players who can build at this location, i.e. who h
The chest has an additional command for the Lua controller:
- `count` is used to request how many items are in the chest.
Example 1: `$ read_data(CHEST, "count")` -> Sum of items across all 8 stores
Example 2: `$ read_data(CHEST, "count", 2)` -> number of items in store 2 (second from left)
Example 1: `$read_data(CHEST, "count")` -> Sum of items across all 8 stores
Example 2: `$read_data(CHEST, "count", 2)` -> number of items in store 2 (second from left)
[ta4_8x2000_chest|image]