diff --git a/doc/manual_DE.lua b/doc/manual_DE.lua index 016c02f..181aa19 100644 --- a/doc/manual_DE.lua +++ b/doc/manual_DE.lua @@ -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(\\, \"state\")' kann der Status der Kiste abgefragt werden. Mögliche Antworten sind: \"empty\"\\, \"loaded\"\\, \"full\"\n".. + " - Über 'name\\, action = $read_data(\\, \"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(\\, \"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(\\, \"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", diff --git a/doc/manual_EN.lua b/doc/manual_EN.lua index 81533c6..3473f67 100644 --- a/doc/manual_EN.lua +++ b/doc/manual_EN.lua @@ -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(\\, \"state\")'. Possible answers are: \"empty\"\\, \"loaded\"\\, \"full\"\n".. + " - The last player action can be queried via 'name\\, action = $read_data(\\, \"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(\\, \"stacks\")'. See: https://github.com/joe7575/techage/blob/master/manuals/ta4_lua_controller_EN.md#sensor-chest\n".. + " - Via '$send_cmnd(\\, \"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", diff --git a/items/hydrogen.lua b/items/hydrogen.lua index c64c4a6..160d61a 100644 --- a/items/hydrogen.lua +++ b/items/hydrogen.lua @@ -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", { diff --git a/items/lye.lua b/items/lye.lua index 50f2922..ec401ca 100644 --- a/items/lye.lua +++ b/items/lye.lua @@ -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", { diff --git a/items/oil.lua b/items/oil.lua index a36ff1a..1db905f 100644 --- a/items/oil.lua +++ b/items/oil.lua @@ -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", { diff --git a/items/petroleum.lua b/items/petroleum.lua index 463bd78..2cb38a4 100644 --- a/items/petroleum.lua +++ b/items/petroleum.lua @@ -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", { diff --git a/liquids/silo.lua b/liquids/silo.lua index 7087050..fd0cd73 100644 --- a/liquids/silo.lua +++ b/liquids/silo.lua @@ -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() diff --git a/locale/techage.de.tr b/locale/techage.de.tr index fce382b..4079a00 100644 --- a/locale/techage.de.tr +++ b/locale/techage.de.tr @@ -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 @n@nexample: cmd 181 on@n 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 @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!) \ No newline at end of file diff --git a/locale/template.txt b/locale/template.txt index a6aeb79..cdcdce3 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -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!= diff --git a/lua_controller/sensorchest.lua b/lua_controller/sensorchest.lua index aa04ddc..2a0858b 100644 --- a/lua_controller/sensorchest.lua +++ b/lua_controller/sensorchest.lua @@ -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) diff --git a/manuals/manual_ta4_DE.md b/manuals/manual_ta4_DE.md index 4807bbc..178c703 100644 --- a/manuals/manual_ta4_DE.md +++ b/manuals/manual_ta4_DE.md @@ -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(, "state")` kann der Status der Kiste abgefragt werden. Mögliche Antworten sind: "empty", "loaded", "full" +- Über `name, action = $read_data(, "action")` kann die letzte Spieleraktion abgefragt werden. `name` ist der Spielername, Als `action` wird zurückgeliefert: "put", "take", "f1", "f2". +- Über `stacks = $read_data(, "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(, "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] \ No newline at end of file +[ta4_injector|image] diff --git a/manuals/manual_ta4_EN.md b/manuals/manual_ta4_EN.md index 04acecd..665ca46 100644 --- a/manuals/manual_ta4_EN.md +++ b/manuals/manual_ta4_EN.md @@ -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(, "state")`. Possible answers are: "empty", "loaded", "full" +- The last player action can be queried via `name, action = $read_data(, "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(, "stacks")`. See: https://github.com/joe7575/techage/blob/master/manuals/ta4_lua_controller_EN.md#sensor-chest +- Via `$send_cmnd(, "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]