diff --git a/README.md b/README.md index ce00875..603c348 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,13 @@ ta4_jetpack requires the modpack 3d_armor. 3d_armor is itself a modpack and can' ### History +#### 2021-09-03 + +Updated Mods: +- techage +- minecart + + #### 2021-08-19 Changed Mods: diff --git a/minecart/README.md b/minecart/README.md index 0a9f5c2..cb4fd96 100644 --- a/minecart/README.md +++ b/minecart/README.md @@ -77,7 +77,8 @@ Introduction '' is the cart number, or get a list of carts with /mycart 11. Drop items into the Minecart and punch the cart to start it, or "sneak+click" the Minecart to get cart and items back - +12. Dig the cart with 'sneak+click' (as usual). The items will be drop down. +13. To retrieve lost carts, use the chat command: /stopcart Hopper ------ @@ -150,3 +151,4 @@ History 2020-11-12 V1.10 Make carts more robust against server lag 2021-04-10 V2.00 Complete revision to make carts robust against server load/lag, Speed limit signs and cart terminal added +2021-09-02 V2.01 Chat command /stopcart added \ No newline at end of file diff --git a/minecart/buffer.lua b/minecart/buffer.lua index 3c2100c..eb83091 100644 --- a/minecart/buffer.lua +++ b/minecart/buffer.lua @@ -35,12 +35,16 @@ local function remote_station_name(pos) if route and route.dest_pos then return M(route.dest_pos):get_string("name") end - return "none" end local function on_punch(pos, node, puncher) local name = M(pos):get_string("name") - M(pos):set_string("infotext", name..": "..S("connected to").." "..remote_station_name(pos)) + local dest = remote_station_name(pos) + if dest then + M(pos):set_string("infotext", name .. ": " .. S("connected to") .. " " .. dest) + else + M(pos):set_string("infotext", name .. ": " .. S("Not connected!")) + end M(pos):set_string("formspec", formspec(pos)) minetest.get_node_timer(pos):start(CYCLE_TIME) @@ -127,7 +131,12 @@ minetest.register_node("minecart:buffer", { M(pos):set_string("name", fields.name) M(pos):set_int("time", tonumber(fields.time) or 0) M(pos):set_string("formspec", formspec(pos)) - M(pos):set_string("infotext", fields.name.." "..S("connected to").." "..remote_station_name(pos)) + local dest = remote_station_name(pos) + if dest then + M(pos):set_string("infotext", fields.name .. ": " .. S("connected to") .. " " .. dest) + else + M(pos):set_string("infotext", fields.name .. ": " .. S("Not connected!")) + end minetest.get_node_timer(pos):start(CYCLE_TIME) end end, diff --git a/minecart/doc.lua b/minecart/doc.lua index 3f43b37..2d294fc 100644 --- a/minecart/doc.lua +++ b/minecart/doc.lua @@ -35,6 +35,7 @@ local summary_doc = table.concat({ S("10. Check the cart state via the chat command: /mycart \n '' is the cart number"), S("11. Drop items into the Minecart and punch the cart to start it."), S("12. Dig the cart with 'sneak+click' (as usual). The items will be drop down."), + S("13. To retrieve lost carts, use the chat command: /stopcart "), }, "\n") local cart_doc = S("Primary used to transport items. You can drop items into the Minecart and punch the cart to get started. Sneak+click the cart to get cart and items back") diff --git a/minecart/init.lua b/minecart/init.lua index b1e66b1..3785e99 100644 --- a/minecart/init.lua +++ b/minecart/init.lua @@ -13,7 +13,7 @@ minecart = {} -- Version for compatibility checks, see readme.md/history -minecart.version = 2.00 +minecart.version = 2.01 minecart.hopper_enabled = minetest.settings:get_bool("minecart_hopper_enabled") ~= false minecart.teleport_enabled = minetest.settings:get_bool("minecart_teleport_enabled") == true diff --git a/minecart/locale/minecart.de.tr b/minecart/locale/minecart.de.tr index 4a52888..fdba00c 100644 --- a/minecart/locale/minecart.de.tr +++ b/minecart/locale/minecart.de.tr @@ -2,6 +2,7 @@ Station name=Stationsname Waiting time/sec=Wartezeit/s connected to=verbunden mit +Not connected!=Nicht verbunden! Summary=Zusammenfassung 1. Place your rails and build a route with two endpoints. Junctions are allowed as long as each route has its own start and endpoint.=1. Baue eine Schienenstrecke mit zwei Enden. Kreuzungen sind zulässig, solange jede Route ihre eigenen Start- und Endpunkte hat. 2. Place a Railway Buffer at both endpoints (buffers are always needed, they store the route and timing information).=2. Platziere einen Prellbock an beide Schienenenden (Prellböcke sind zwingend notwendig, sie speichern die Routen- und Zeit-Informationen). @@ -12,9 +13,10 @@ Summary=Zusammenfassung 7. Optional: Configure the Minecart waiting time in both buffers. The Minecart will then start automatically after the configured time.=7. Optional: Konfiguriere die Wagenwartezeit in beiden Prellböcken. Der Wagen startet dann nach dieser Zeit automatisch. 8. Optional: Protect your rail network with the Protection Landmarks (one Landmark at least every 16 nodes/meters).=8. Optional: Schütze deine Schienen mit Hilfe der Meilensteine (ein Meilenstein mindestens alle 16 Blöcke). 9. Place a Minecart in front of the buffer and check whether it starts after the configured time.=9. Platziere einen Wagen direkt vor einem Prellbock und prüfe, ob er nach der konfigurierten Zeit startet. -10. Check the cart state via the chat command: /mycart @n '' is the cart number=Prüfe den Status des Wagen mit dem Chat Kommando: /mycart @n ist die Wagennummer +10. Check the cart state via the chat command: /mycart @n '' is the cart number=10. Prüfe den Status des Wagen mit dem Chat Kommando: /mycart @n ist die Wagennummer 11. Drop items into the Minecart and punch the cart to start it.=11: Lege Gegenstände in ein Wagen (Taste Q) und starte dann den Wagen durch Anklicken. -12. Dig the cart with 'sneak+click' (as usual). The items will be drop down.=10. Klicke mit gedrückter Shift-Taste auf den Wagen, um diesen zu entfernen. Die Gegenstände fallen dann zu Boden. +12. Dig the cart with 'sneak+click' (as usual). The items will be drop down.=12. Klicke mit gedrückter Shift-Taste auf den Wagen, um diesen zu entfernen. Die Gegenstände fallen dann zu Boden. +13. To retrieve lost carts, use the chat command: /stopcart =13. Um verirrte Waren zurückzuholen, verwende den Chat-Befehl: /stopcart Primary used to transport items. You can drop items into the Minecart and punch the cart to get started. Sneak+click the cart to get cart and items back=Primär für den Transport von Gegenständen genutzt. Du kannst Gegenstände in ein Cart legen (Taste Q) und dann den Wagen durch Anklicken starten. Klicke mit gedrückter Shift-Taste auf den Wagen, um Cart und Gegenstände zurückzuerhalten Used as buffer on both rail ends. Needed to be able to record the cart routes=Preckblöcke müssen an beiden Schienenenden platziert sein, so dass Aufzeichnungen der Strecke gemacht werden können. Protect your rails with the Landmarks (one Landmark at least every 16 blocks near the rail)=Schütze deine Schienen mit Hilfe der Meilensteine (ein Meilenstein mindestens alle 16 Blöcke der Strecke entlang) @@ -32,6 +34,10 @@ Cart Pusher=Wagen Anschieber Minecart (Sneak+Click to pick up)=Minecart (Shift+Klick zum Entfernen des Carts) Output cart state and position, or a list of carts, if no cart number is given.=Gibt Status und Position des Wagens, oder eine Liste aller Wagen aus, wenn keine Wagennummer angegeben ist. List of carts=Liste aller Wagen +Stop amd return a missing/running cart.=Stoppe und hole einen vermissten Wagen zurück. +Cart=Wagen +stopped=gestoppt +is not existing!=existiert nicht! Enter cart number=Gebe Cart Nummer ein Save=Speichern [minecart] Area is protected!=[minecart] Bereich ist geschützt! @@ -52,8 +58,3 @@ Speed "4"=Tempo "4" No speed limit=Keine Geschwindigkeitsbegrenzung Cart List=Cart Liste Cart Terminal=Cart Terminal - - -##### not used anymore ##### - -Used to push a cart if the cart does not stop directly at a buffer. Block has to be placed below the rail.=Wird verwendet, um einen Wagen anzuschieben, wenn der Wagen nicht direkt an einem Puffer anhält. Der Block muss unter der Schiene platziert werden. diff --git a/minecart/locale/template.txt b/minecart/locale/template.txt index 7c64c6b..45ebd43 100644 --- a/minecart/locale/template.txt +++ b/minecart/locale/template.txt @@ -2,6 +2,7 @@ Station name= Waiting time/sec= connected to= +Not connected!= Summary= 1. Place your rails and build a route with two endpoints. Junctions are allowed as long as each route has its own start and endpoint.= 2. Place a Railway Buffer at both endpoints (buffers are always needed, they store the route and timing information).= @@ -15,6 +16,7 @@ Summary= 10. Check the cart state via the chat command: /mycart @n '' is the cart number= 11. Drop items into the Minecart and punch the cart to start it.= 12. Dig the cart with 'sneak+click' (as usual). The items will be drop down.= +13. To retrieve lost carts, use the chat command: /stopcart = Primary used to transport items. You can drop items into the Minecart and punch the cart to get started. Sneak+click the cart to get cart and items back= Used as buffer on both rail ends. Needed to be able to record the cart routes= Protect your rails with the Landmarks (one Landmark at least every 16 blocks near the rail)= @@ -32,6 +34,10 @@ Cart Pusher= Minecart (Sneak+Click to pick up)= Output cart state and position, or a list of carts, if no cart number is given.= List of carts= +Stop amd return a missing/running cart.= +Cart= +stopped= +is not existing!= Enter cart number= Save= [minecart] Area is protected!= diff --git a/minecart/monitoring.lua b/minecart/monitoring.lua index 2377d8e..bde3fcd 100644 --- a/minecart/monitoring.lua +++ b/minecart/monitoring.lua @@ -243,6 +243,33 @@ minetest.register_chatcommand("mycart", { end }) +minetest.register_chatcommand("stopcart", { + params = "", + description = S("Stop amd return a missing/running cart."), + func = function(owner, param) + local userID = tonumber(param) + local player_pos = minetest.get_player_by_name(owner):get_pos() + if userID then + local data = minecart.get_cart_monitoring_data(owner, userID) + if data then + if data.objID and data.objID ~= 0 then + local entity = minetest.luaentities[data.objID] + if entity then -- cart entity running + minecart.entity_to_node(player_pos, entity) + end + else + local pos = data.last_pos or data.pos + local cargo, owner, userID = minecart.remove_nodecart(pos) + minecart.add_nodecart(player_pos, data.node_name, 0, cargo, owner, userID) + end + return true, S("Cart") .. " " .. userID .. " " .. S("stopped") + else + return false, S("Cart") .. " " .. userID .. " " .. S("is not existing!") + end + end + end +}) + function minecart.cmnd_cart_state(name, userID) local state, loc = get_cart_state_and_loc(name, userID, {x=0, y=0, z=0}) return state diff --git a/signs_bot/README.md b/signs_bot/README.md index fec834c..7f04f87 100644 --- a/signs_bot/README.md +++ b/signs_bot/README.md @@ -82,6 +82,7 @@ For all Inventory commands applies: If the inventory stack specified by i dig_right - remove block on the right dig_below - dig block under the robot dig_above - dig block above the robot + rotate_item - rotate a block in front of the robot place_sign - set sign place_sign_behind - put a sign behind the bot dig_sign - remove the sign @@ -96,7 +97,14 @@ For all Inventory commands applies: If the inventory stack specified by i pattern - save the blocks behind the shield (up to 5x3x3) as template copy - make a copy of "pattern". Size is e.g. 3x3 (see ingame help) punch_cart - Punch a rail cart to start it + add_compost - Put 2 leaves into the compost barrel + take_compost - Take a compost item from the barrel print - Output chat message for debug purposes + take_water - Take water with empty bucket + fill_cauldron - Fill the xdecor cauldron for a soup + take_soup - Take boiling soup into empty bowl from cauldron + flame_on - Make fire + flame_off - Put out the fire #### Flow control commands @@ -141,13 +149,14 @@ Or alternatively with the function at the end: return -- end of 'foo'. Jump back ### License -Copyright (C) 2019-2021 Joachim Stolberg +Copyright (C) 2019-2021 Joachim Stolberg +Copyright (C) 2021 Michal 'Micu' Cieslakiewicz (soup commands) Code: Licensed under the GNU GPL version 3 or later. See LICENSE.txt ### Dependencies default, farming, basic_materials, tubelib2 -optional: farming redo, node_io, doc, techage, minecart +optional: farming redo, node_io, doc, techage, minecart, xdecor, compost ### History @@ -173,4 +182,5 @@ optional: farming redo, node_io, doc, techage, minecart - 2021-03-14 v1.06 * Switch translation from intllib to minetest.translator - 2021-04-24 v1.07 * Adapted to minecart v2.0 - 2021-05-04 v1.08 * Add print command, improve error msg +- 2021-08-22 v1.09 * Add soup commands and signs, add aspen sign diff --git a/signs_bot/cmd_soup.lua b/signs_bot/cmd_soup.lua new file mode 100644 index 0000000..48054c3 --- /dev/null +++ b/signs_bot/cmd_soup.lua @@ -0,0 +1,323 @@ +--[[ + + Signs Bot + ========= + + Copyright (C) 2019-2021 Joachim Stolberg + Copyright (C) 2021 Michal 'Micu' Cieslakiewicz + + GPL v3 + See LICENSE.txt for more information + + Bot soup cooking commands + + Allows bot to use pot (xdecor:cauldron) to cook a vegetable soup + +]]-- + +if not minetest.global_exists("bucket") or not minetest.global_exists("fire") + or not minetest.global_exists("xdecor") then return end + +local M = minetest.get_meta + +-- Load support for I18n. +local S = signs_bot.S + +local lib = signs_bot.lib + +local bucket_empty, bucket_water = ItemStack("bucket:bucket_empty 1"), ItemStack("bucket:bucket_water 1") +local bowl_empty_farming, bowl_empty_xdecor = ItemStack("farming:bowl 1"), ItemStack("xdecor:bowl 1") +local bowl_soup = ItemStack("xdecor:bowl_soup 1") + +local function find_item_slot(base_pos, item) + local inv = M(base_pos):get_inventory() + local s = nil + for i = 1, 8 do + local t = inv:get_stack("main", i) + if t and t:get_name() == item:get_name() then + s = i + break + end + end + return s +end + +signs_bot.register_botcommand("take_water", { + mod = "soup", + params = "", + num_param = 1, + description = S("Take water into empty bucket when standing on a shore\n(use specified slot number or 0 for auto selection)"), + check = function(slot) + slot = tonumber(slot) + return slot and slot >= 0 and slot <= 8 + end, + cmnd = function(base_pos, mem, slot) + slot = tonumber(slot) + local pos = lib.dest_pos(mem.robot_pos, mem.robot_param2, { 0 }) + pos.y = pos.y - 1 + if not lib.not_protected(base_pos, pos) then + return signs_bot.ERROR, S("Error: Position protected") + end + local node = minetest.get_node_or_nil(pos) + if not node or node.name ~= "default:water_source" then + return signs_bot.ERROR, S("Error: No still water around") + end + local itemslot = slot + if slot == 0 then + itemslot = find_item_slot(base_pos, bucket_empty) + if not itemslot then + return signs_bot.ERROR, S("Error: No empty bucket in inventory") + end + end + local item = signs_bot.bot_inv_take_item(base_pos, itemslot, 1) + if not item or item:is_empty() or item:get_name() ~= bucket_empty:get_name() then + return signs_bot.ERROR, S("Error: No empty bucket in inventory slot " .. itemslot) + end + item = signs_bot.bot_inv_put_item(base_pos, slot, bucket_water) + if item:is_empty() then + minetest.remove_node(pos) + else + signs_bot.bot_inv_put_item(base_pos, itemslot, bucket_empty) + return signs_bot.ERROR, S("Error: No inventory space for full bucket") + end + return signs_bot.DONE + end, +}) + +signs_bot.register_botcommand("fill_cauldron", { + mod = "soup", + params = "", + num_param = 1, + description = S("Pour water from bucket to empty cauldron in front of a robot\n(use specified slot number or 0 for auto selection)"), + check = function(slot) + slot = tonumber(slot) + return slot and slot >= 0 and slot <= 8 + end, + cmnd = function(base_pos, mem, slot) + slot = tonumber(slot) + local pos = lib.dest_pos(mem.robot_pos, mem.robot_param2, { 0 }) + if not lib.not_protected(base_pos, pos) then + return signs_bot.ERROR, S("Error: Position protected") + end + local node = minetest.get_node_or_nil(pos) + if not node or node.name ~= "xdecor:cauldron_empty" then + return signs_bot.ERROR, S("Error: No empty cauldron in front of a robot") + end + local itemslot = slot + if slot == 0 then + itemslot = find_item_slot(base_pos, bucket_water) + if not itemslot then + return signs_bot.ERROR, S("Error: No full bucket in inventory") + end + end + local item = signs_bot.bot_inv_take_item(base_pos, itemslot, 1) + if not item or item:is_empty() or item:get_name() ~= bucket_water:get_name() then + return signs_bot.ERROR, S("Error: No full bucket in inventory slot " .. itemslot) + end + item = signs_bot.bot_inv_put_item(base_pos, slot, bucket_empty) + if item:is_empty() then + minetest.set_node(pos, { name = "xdecor:cauldron_idle", param2 = node.param2 }) + else + signs_bot.bot_inv_put_item(base_pos, itemslot, bucket_water) + return signs_bot.ERROR, S("Error: No inventory space for empty bucket") + end + return signs_bot.DONE + end, +}) + +signs_bot.register_botcommand("flame_on", { + mod = "soup", + params = "", + num_param = 0, + description = S("Set fire under cauldron (requires flammable material)\n(command is ignored when fire is already burning)"), + cmnd = function(base_pos, mem) + local pos = lib.dest_pos(mem.robot_pos, mem.robot_param2, { 0 }) + local fire_pos = { x = pos.x, y = pos.y - 1, z = pos.z } + local fuel_pos = { x = pos.x, y = pos.y - 2, z = pos.z } + if not (lib.not_protected(base_pos, pos) and lib.not_protected(base_pos, fire_pos) + and lib.not_protected(base_pos, fuel_pos)) then + return signs_bot.ERROR, S("Error: Position protected") + end + local node = minetest.get_node_or_nil(pos) + if not node or not node.name:find("xdecor:cauldron") then + return signs_bot.ERROR, S("Error: No cauldron in front of a robot") + end + local fire_node = minetest.get_node_or_nil(fire_pos) + if fire_node and fire_node.name:match("fire:[%w_]*flame") then + return signs_bot.DONE + elseif not fire_node or fire_node.name ~= "air" then + return signs_bot.ERROR, S("Error: No space for fire under cauldron") + end + local fuel_node = minetest.get_node_or_nil(fuel_pos) + if fuel_node and minetest.registered_nodes[fuel_node.name].on_ignite then + minetest.registered_nodes[fuel_node.name].on_ignite(fuel_pos) + elseif fuel_node and minetest.get_item_group(fuel_node.name, "flammable") >= 1 then + minetest.set_node(fire_pos, { name = "fire:basic_flame" }) + else + return signs_bot.ERROR, S("Error: No flammable material under cauldron") + end + return signs_bot.DONE + end, +}) + +signs_bot.register_botcommand("flame_off", { + mod = "soup", + params = "", + num_param = 0, + description = S("Put out (extinguish) fire under cauldron\n(command is ignored when there is no fire)"), + cmnd = function(base_pos, mem) + local pos = lib.dest_pos(mem.robot_pos, mem.robot_param2, { 0 }) + local fire_pos = { x = pos.x, y = pos.y - 1, z = pos.z } + if not (lib.not_protected(base_pos, pos) and lib.not_protected(base_pos, fire_pos)) then + return signs_bot.ERROR, S("Error: Position protected") + end + local node = minetest.get_node_or_nil(pos) + if not node or not node.name:find("xdecor:cauldron") then + return signs_bot.ERROR, S("Error: No cauldron in front of a robot") + end + local node = minetest.get_node_or_nil(fire_pos) + if node and node.name:match("fire:[%w_]*flame") then + minetest.remove_node(fire_pos) + end + return signs_bot.DONE + end, +}) + +signs_bot.register_botcommand("take_soup", { + mod = "soup", + params = "", + num_param = 1, + description = S("Take boiling soup into empty bowl from cauldron\nin front of a robot\n(use specified slot number or 0 for auto selection)"), + check = function(slot) + slot = tonumber(slot) + return slot and slot >= 0 and slot <= 8 + end, + cmnd = function(base_pos, mem, slot) + slot = tonumber(slot) + local pos = lib.dest_pos(mem.robot_pos, mem.robot_param2, { 0 }) + if not lib.not_protected(base_pos, pos) then + return signs_bot.ERROR, S("Error: Position protected") + end + local node = minetest.get_node_or_nil(pos) + if not node or node.name ~= "xdecor:cauldron_soup" then + return signs_bot.ERROR, S("Error: No cauldron with a soup in front of a robot") + end + local itemslot = slot + if slot == 0 then + itemslot = find_item_slot(base_pos, bowl_empty_xdecor) or find_item_slot(base_pos, bowl_empty_farming) + if not itemslot then + return signs_bot.ERROR, S("Error: No empty bowl in inventory") + end + end + local item = signs_bot.bot_inv_take_item(base_pos, itemslot, 1) + if not item or item:is_empty() or (item:get_name() ~= bowl_empty_farming:get_name() + and item:get_name() ~= bowl_empty_xdecor:get_name()) then + return signs_bot.ERROR, S("Error: No empty bowl in inventory slot " .. itemslot) + end + local item_full = signs_bot.bot_inv_put_item(base_pos, slot, bowl_soup) + if item_full:is_empty() then + minetest.set_node(pos, { name = "xdecor:cauldron_empty", param2 = node.param2 }) + else + signs_bot.bot_inv_put_item(base_pos, itemslot, item) + return signs_bot.ERROR, S("Error: No inventory space for full bowl") + end + return signs_bot.DONE + end, +}) + +local CMD_WATER = [[ +dig_sign 1 +move +take_water 1 +backward +place_sign 1 +turn_around +]] + +local CMD_SOUP = [[ +dig_sign 1 +move 2 +fill_cauldron 1 +flame_on +pause 11 +move_up +drop_items 1 2 +drop_items 1 3 +move_down +pause 6 +take_soup 4 +flame_off +backward +backward +place_sign 1 +turn_around +]] + +signs_bot.register_sign({ + name = "water", + description = S('Sign "take water"'), + commands = CMD_WATER, + image = "signs_bot_sign_water.png", +}) + + +signs_bot.register_sign({ + name = "soup", + description = S('Sign "cook soup"'), + commands = CMD_SOUP, + image = "signs_bot_sign_soup.png", +}) + +minetest.register_craft({ + output = "signs_bot:water", + recipe = { + {"group:wood", "bucket:bucket_empty", "group:wood"}, + {"dye:black", "default:stick", "dye:yellow"}, + {"dye:blue", "", ""} + } +}) + +minetest.register_craft({ + output = "signs_bot:soup", + recipe = { + {"group:wood", "xdecor:bowl", "group:wood"}, + {"dye:black", "default:stick", "dye:yellow"}, + {"dye:orange", "", ""} + } +}) + +if minetest.get_modpath("doc") then + doc.add_entry("signs_bot", "water", { + name = S("Sign 'take water'"), + data = { + item = "signs_bot:water", + text = table.concat({ + S("Used to take water into bucket."), + S("Place the sign on a shore, in front of the still water pool."), + S("Items in slots:"), + S(" 1 - empty bucket"), + S("The result is one bucket with water in selected inventory slot."), + S("When finished, the bot turns around."), + }, "\n") + }, + }) + doc.add_entry("signs_bot", "soup", { + name = S("Sign 'cook soup'"), + data = { + item = "signs_bot:soup", + text = table.concat({ + S("Used to cook a vegetable soup in cauldron."), + S("Cauldon should be empty and located above flammable material."), + S("Place the sign in front of the cauldron with one field space,"), + S("to prevent wooden sign from catching fire."), + S("Items in slots:"), + S(" 1 - water bucket"), + S(" 2 - vegetable #1 (i.e. tomato)"), + S(" 3 - vegetable #2 (i.e. carrot)"), + S(" 4 - empty bowl (from farming or xdecor mods)"), + S("The result is one bowl with vegetable soup in selected inventory slot."), + S("When finished, the bot turns around."), + }, "\n") + }, + }) +end diff --git a/signs_bot/cmd_trees.lua b/signs_bot/cmd_trees.lua new file mode 100644 index 0000000..3e6208b --- /dev/null +++ b/signs_bot/cmd_trees.lua @@ -0,0 +1,98 @@ +--[[ + + Signs Bot + ========= + + Copyright (C) 2019-2021 Joachim Stolberg + + GPL v3 + See LICENSE.txt for more information + + Bot tree cutting signs +]]-- + +-- Load support for I18n. +local S = signs_bot.S + +local CMNDS = [[-- Harvest pine/aspen trunks v1.0 + +-- Take dirt and saplings from chest +dig_sign 1 +move 1 +turn_right +take_item 99 0 +take_item 99 0 + +-- Goto trunk +turn_left +dig_front 0 0 +move 1 + +-- Climb up +repeat 10 + dig_above 0 + move_up + place_below 1 +end + +-- Climb down +repeat 10 + dig_below 1 + move_down +end + +-- Pickup saplings +repeat 4 + pickup_items 2 + turn_left +end + +-- Return dirt and saplings to chest +backward +plant_sapling 2 +turn_right +add_item 99 1 +add_item 99 2 + +-- Finish +turn_left +backward +place_sign 1 +turn_around]] + +local HELP = table.concat({ + S("Used to harvest an aspen or pine tree trunk"), + S("- Place the sign in front of the tree."), + S("- Place a chest to the right of the sign."), + S("- Put a dirt stack (10 items min.) into the chest."), + S("- Preconfigure slot 1 of the bot inventory with dirt"), + S("- Preconfigure slot 2 of the bot inventory with saplings"), +}, "\n") + + +signs_bot.register_signXL({ + name = "aspen", + description = S('Sign "aspen"'), + help_text = HELP, + commands = CMNDS, + image = "signs_bot_sign_aspen.png", +}) + +minetest.register_craft({ + output = "signs_bot:aspen 2", + recipe = { + {"group:wood", "default:stick", "group:wood"}, + {"dye:black", "default:stick", "dye:yellow"}, + {"dye:grey", "default:aspen_sapling", ""} + } +}) + +if minetest.get_modpath("doc") then + doc.add_entry("signs_bot", "aspen", { + name = S("Sign 'aspen'"), + data = { + item = "signs_bot:aspen", + text = HELP .. "\n", + }, + }) +end diff --git a/signs_bot/duplicator.lua b/signs_bot/duplicator.lua index fb6b942..34a5a37 100644 --- a/signs_bot/duplicator.lua +++ b/signs_bot/duplicator.lua @@ -63,38 +63,44 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player return stack:get_count() end +local function get_template_data(stack) + local name = stack:get_name() + local data = stack:get_meta():to_table().fields + + if name == "default:sign_user" or name == "signs_bot:sign_cmnd" then + return data.description, data.cmnd + end + if name == "default:book_written" then + return data.title, data.text + end +end + +local function get_dest_item(stack) + local name = stack:get_name() + if name == "signs_bot:sign_blank" or name == "signs_bot:sign_user" then + return ItemStack("signs_bot:sign_user") + end + if name == "signs_bot:sign_cmnd" then + return ItemStack("signs_bot:sign_cmnd") + end +end + local function move_to_output(pos) local inv = M(pos):get_inventory() local inp_stack = inv:get_stack("inp", 1) local temp_stack = inv:get_stack("temp", 1) local outp_stack = inv:get_stack("outp", 1) + local dest_item = get_dest_item(inp_stack) + local descr, cmnd = get_template_data(temp_stack) - if (inp_stack:get_name() == "signs_bot:sign_blank" - or inp_stack:get_name() == "signs_bot:sign_user") - and temp_stack:get_name() == "signs_bot:sign_cmnd" - and outp_stack:get_name() == "" then - local stack = ItemStack("signs_bot:sign_user") - stack:set_count(inp_stack:get_count()) - local meta = stack:get_meta() - local temp_meta = temp_stack:get_meta() - meta:set_string("cmnd", temp_meta:get_string("cmnd")) - meta:set_string("description", temp_meta:get_string("description")) + if dest_item and descr then + dest_item:set_count(inp_stack:get_count()) + local meta = dest_item:get_meta() + meta:set_string("description", descr) + meta:set_string("cmnd", cmnd) inp_stack:clear() inv:set_stack("inp", 1, inp_stack) - inv:set_stack("outp", 1, stack) - elseif (inp_stack:get_name() == "signs_bot:sign_blank" - or inp_stack:get_name() == "signs_bot:sign_user") - and temp_stack:get_name() == "default:book_written" - and outp_stack:get_name() == "" then - local stack = ItemStack("signs_bot:sign_user") - stack:set_count(inp_stack:get_count()) - local meta = stack:get_meta() - local temp_data = temp_stack:get_meta():to_table().fields - meta:set_string("cmnd", temp_data.text) - meta:set_string("description", temp_data.title) - inp_stack:clear() - inv:set_stack("inp", 1, inp_stack) - inv:set_stack("outp", 1, stack) + inv:set_stack("outp", 1, dest_item) end end diff --git a/signs_bot/init.lua b/signs_bot/init.lua index 98a8ea8..30e9c7c 100644 --- a/signs_bot/init.lua +++ b/signs_bot/init.lua @@ -15,7 +15,7 @@ signs_bot = {} -- Version for compatibility checks, see readme.md/history -signs_bot.version = 1.08 +signs_bot.version = 1.09 -- Test for MT 5.4 new string mode signs_bot.CLIP = minetest.features.use_texture_alpha_string_modes and "clip" or true @@ -52,6 +52,8 @@ dofile(MP.."/cmd_sign.lua") dofile(MP.."/cmd_pattern.lua") dofile(MP.."/cmd_farming.lua") dofile(MP.."/cmd_flowers.lua") +dofile(MP.."/cmd_soup.lua") +dofile(MP.."/cmd_trees.lua") dofile(MP.."/signal.lua") dofile(MP.."/extender.lua") diff --git a/signs_bot/locale/signs_bot.de.tr b/signs_bot/locale/signs_bot.de.tr index 1504914..36d62ef 100644 --- a/signs_bot/locale/signs_bot.de.tr +++ b/signs_bot/locale/signs_bot.de.tr @@ -5,7 +5,6 @@ ### basis.lua ### running=läuft -charging=aufladen stopped=gestoppt Off=Aus On=An @@ -15,7 +14,6 @@ Config=Konfig. Preassign slots items=Vorbelegungen Back=Zurück Robot Box=Roboterbox -no power=kein Strom Signs Bot Box=Roboter Box The Box is the housing of the bot.=Die Box ist das Gehäuse des Roboters. Place the box and start the bot by means of the 'On' button.=Platziere die Box und starte den Roboter über den "An" Button. @@ -43,6 +41,11 @@ Bot Sensor: Not connected=Bot Sensor: Nicht verbunden The Bot Sensor detects any bot and sends a signal, if a bot is nearby.=Der Roboter Sensor entdeckt jeden Roboter und sendet ein Signal, sofern ein Roboter in der Nähe ist. The sensor direction does not care.=Die Ausrichtung des Sensor spielt keine Rolle. +### bot_sensor.lua ### +### cart_sensor.lua ### + +the sensor range is one node/meter.=Der Sensorbereich ist einen Block/Meter groß. + ### cart_sensor.lua ### Cart Sensor: Connected with=Wagen Sensor: Verbunden mit @@ -51,11 +54,6 @@ Cart Sensor: Not connected=Wagen Sensor: Nicht verbunden The Cart Sensor detects and sends a signal, if a cart (Minecart) is nearby.=Der Wagen Sensor sendet ein Signal, sofern ein Wagen in der Nähe ist. The sensor has an active side (red) that must point to the rail/cart.=Der Sensor hat eine aktive Seite (rot), welche zu den Schienen zeigen muss. -### cart_sensor.lua ### -### bot_sensor.lua ### - -the sensor range is one node/meter.=Der Sensorbereich ist einen Block/Meter groß. - ### changer.lua ### Signs:=Zeichen: @@ -87,12 +85,6 @@ Sign 'farming'=Zeichen 'Farming' Used to harvest and seed a 3x3 field.=Benötigt um ein 3x3 Feld zu ernten und wieder zu sähen. The seed to be placed has to be in the first inventory slot of the bot.=Das Saatgut, dass gesät werden soll, muss sich an der 1. Position im Inventar befinden. -### cmd_farming.lua ### -### cmd_flowers.lua ### - -Place the sign in front of the field.=Platziere das Zeichen vor das Feld. -When finished, the bot turns.=Der Roboter dreht um, wenn er fertig ist. - ### cmd_flowers.lua ### Cutting flowers, leaves and tree blocks@nin front of the robot@non a 3x3 field.=Schneide Blumen, Blätter und Baumblöcke@nin einem 3x3 großem Feld@nvor dem Roboter. @@ -100,6 +92,12 @@ Sign "flowers"=Zeichen "Blumen" Sign 'flowers'=Zeichen 'Blumen' Used to cut flowers on a 3x3 field.=Benötigt um ein 3x3 Blumenfeld zu ernten. +### cmd_flowers.lua ### +### cmd_farming.lua ### + +Place the sign in front of the field.=Platziere das Zeichen vor das Feld. +When finished, the bot turns.=Der Roboter dreht um, wenn er fertig ist. + ### cmd_item.lua ### Take items from a chest like node@nand put it into the item inventory.@n is the inventory slot (1..8) or 0 for any one=Nehme Gegenstände aus der@nKiste oder dem Kisten-ähnlichen Block@nund tue diese in das eigene Inventar@nan der Position . Slot = (1..8)@noder 0 für irgend eine Position @@ -139,7 +137,6 @@ Use the pattern sign to mark the pattern.=Benutze das Vorlage-Zeichen und die Vo ### cmd_place.lua ### -Error: Position protected=Fehler: Position geschützt Place a block in front of the robot@n is the inventory slot (1..8)@n is one of: -1 0 +1=Setze einen Block vor den Roboter.@n ist die Position im@neigenen Inventar (1--8).@nFür ist zulässig: -1 0 +1 Place a block on the left side@n is the inventory slot (1..8)@n is one of: -1 0 +1=Setze einen Block links vorne.@n ist die Position im@neigenen Inventar (1--8).@nFür ist zulässig: -1 0 +1 Place a block on the right side@n is the inventory slot (1..8)@n is one of: -1 0 +1=Setze einen Block rechts vorne.@n ist die Position im@neigenen Inventar (1--8).@nFür ist zulässig: -1 0 +1 @@ -179,6 +176,64 @@ The 'command' sign can be programmed by the player.=Das 'Kommando' Zeichen kann Place the sign in front of you and use the node menu to program your sequence of bot commands.=Platziere das Zeichen vor dir und nutze das Zeichen-Menü, um die Kommando-Sequenz zu programmieren. The menu has an edit field for your commands and a help page with all available commands.=Das Menü hat ein Eingabefeld für deine Kommandos und eine Hilfeseite zu allen Kommandos. +### cmd_soup.lua ### + +Take water into empty bucket when standing on a shore@n(use specified slot number or 0 for auto selection)=Schöpfe Wasser mit einen leeren Eimer.@nDer Bot muss dazu am Wasser stehen. (verwende die Slot-Nummer@ndes Eimers oder 0 für eine automatische Auswahl) +Error: No still water around=Fehler: Kein stilles Wasser in der Nähe +Error: No empty bucket in inventory=Fehler: Kein leerer Eimer im Inventar +Error: No empty bucket in inventory slot =Fehler: Kein leerer Eimer in der Inventar Position +Error: No inventory space for full bucket=Fehler: Kein freier Inventarplatz für den vollen Eimer +Pour water from bucket to empty cauldron in front of a robot@n(use specified slot number or 0 for auto selection)=Gieße das Wasser aus dem Eimer in einen leeren Kessel (xdecor) vor dem Roboter@n(verwende die Slot-Nummer des Eimers oder 0 für eine automatische Auswahl) +Error: No empty cauldron in front of a robot=Fehler: Kein leerer Kessel vor dem Roboter +Error: No full bucket in inventory=Fehler: Kein voller Eimer im Inventar +Error: No full bucket in inventory slot =Fehler: Kein voller Eimer an der Inventarposition +Error: No inventory space for empty bucket=Fehler: Kein Platz im Inventar für den leeren Eimer +Set fire under cauldron (requires flammable material)@n(command is ignored when fire is already burning)=Mache Feuer unter dem Kessel (benötigt brennbares Material)@n(Befehl wird ignoriert, wenn Feuer bereits brennt) +Error: No cauldron in front of a robot=Fehler: Kein Kessel vor dem Roboter +Error: No space for fire under cauldron=Fehler: Kein Platz für das Feuer unter dem Kessel +Error: No flammable material under cauldron=Fehler: Kein brennbares Material unter dem Kessel +Put out (extinguish) fire under cauldron@n(command is ignored when there is no fire)=Das Feuer löschen unter dem Kessel@n(Befehl wird ignoriert, wenn kein Feuer vorhanden ist) +Take boiling soup into empty bowl from cauldron@nin front of a robot@n(use specified slot number or 0 for auto selection)=Die kochende Suppe aus im Kessel in eine leere Schüssel tun.@n(verwende die Slot-Nummer der Schüssel oder 0 für eine automatische Auswahl) +Error: No cauldron with a soup in front of a robot=Fehler: Kein Kessel mit Suppe vor dem Roboter +Error: No empty bowl in inventory=Fehler: Keine leere Schüssel im Inventar +Error: No empty bowl in inventory slot =Fehler: Keine leere Schüssel in der angegebenen Inventarposition +Error: No inventory space for full bowl=Fehler: Kein Platz im Inventar für die Schüssel +Sign "take water"=Zeichen "Schöpfe Wasser" +Sign "cook soup"=Zeichen "Koche Suppe" +Sign 'take water'=Zeichen 'Schöpfe Wasser' +Used to take water into bucket.=Wird verwendet, um Wasser in den Eimer zu schöpfen. +Place the sign on a shore, in front of the still water pool.=Platziere das Schild am Ufer des Wassers +Items in slots:=Gegenstände im Inventar: + 1 - empty bucket= 1 - leerer Eimer +The result is one bucket with water in selected inventory slot.=Das Ergebnis ist ein Eimer mit Wasser an der ausgewählten Inventarposition. +When finished, the bot turns around.=Wenn er fertig ist, dreht sich der Bot um. +Sign 'cook soup'=Zeichen 'Koche Suppe' +Used to cook a vegetable soup in cauldron.=Wird verwendet, um eine vegetarische Suppe im Kessel zu kochen. +Cauldon should be empty and located above flammable material.=Der Kessel sollte leer sein und sich über brennbarem Material befinden. +Place the sign in front of the cauldron with one field space,=Platziere das Schild vor dem Kessel mit einem Feld Abstand, +to prevent wooden sign from catching fire.=um zu verhindern, dass das Holzschild Feuer fängt. + 1 - water bucket= 2 - Wassereimer + 2 - vegetable #1 (i.e. tomato)= 2 - Gemüse #1 (bspw. Tomate) + 3 - vegetable #2 (i.e. carrot)= 3 - Gemüse #2 (bspw. Zwiebel) + 4 - empty bowl (from farming or xdecor mods)= 4 - Leere Schüssel (Von der Mod farming oder xdecor) +The result is one bowl with vegetable soup in selected inventory slot.=Das Ergebnis ist eine Schüssel mit Gemüsesuppe an der ausgewählten Inventarposition. + +### cmd_soup.lua ### +### cmd_place.lua ### + +Error: Position protected=Fehler: Position geschützt + +### cmd_trees.lua ### + +Used to harvest an aspen or pine tree trunk=Wird verwendet, um einen Espen- oder Kiefernstamm zu ernten +- Place the sign in front of the tree.=- Setze das Zeichen vor den Baum. +- Place a chest to the right of the sign.=- Setze eine Kiste rechts neben das Zeichen. +- Put a dirt stack (10 items min.) into the chest.=- Lege einen Stapel (>10) Erde (dirt) in die Kiste. +- Preconfigure slot 1 of the bot inventory with dirt=Pos. 1 des Bot-Inventars mit Erde (dirt) vorkonfigurieren +- Preconfigure slot 2 of the bot inventory with saplings=Pos. 2 des Bot-Inventars mit einem Setzling vorkonfigurieren +Sign "aspen"=Zeichen "Espe" +Sign 'aspen'=Zeichen 'Espe' + ### commands.lua ### commands:=Kommandos: @@ -345,6 +400,11 @@ inputs=Eingängen Signal AND=Signal UND Signal is sent, if all input signals are received.=Signal wird gesendet, wenn all Eingangssignale empfangen wurden. +### logic_and.lua ### +### timer.lua ### + +Connected with=Verbunden mit + ### node_sensor.lua ### Node Sensor: Connected with =Block Sensor: Verbunden mit @@ -363,6 +423,8 @@ The sensor has an active side (red) that must point to the observed area.=Der Se ### signs.lua ### +Instructions:=Anweisungen: +Code=Code Sign "turn right"=Zeichen "rechts drehen" Sign "turn left"=Zeichen "links drehen" Sign "take item"=Zeichen "Nehme Gegenstand" @@ -382,11 +444,17 @@ The Bot takes items out of a minecart in front of it, pushes the cart and then t ### techage.lua ### +no power=kein Strom Ignite the techage charcoal lighter=Zünde den Holzkohle-Anzünder an Turns the bot off if the@nbattery power is below the@ngiven value in percent (1..99)=Schalte den Bot aus,@nwenn die Batterieladung kleiner@nist als der angegebene Wert@nin Prozent (1.99) fully charged=voll geladen Sends a techage command@nto a given node. @nReceiver is addressed by@nthe techage node number.@nFor commands with two or more @nwords, use the '*' character @ninstead of spaces, e.g.: @nsend_cmnd 3465 pull*default:dirt*2=Sende ein techage Kommando@nan einen Block mit der@nangegebenen Blocknummer.@nFür Kommandos mit zwei oder mehr @nWörtern verwende das Zeichen '*' @nanstelle des Leerzeichens, wie bspw.:@nsend_cmnd 3465 pull*default:dirt*2 +### techage.lua ### +### basis.lua ### + +charging=aufladen + ### timer.lua ### Bot Timer=Roboter Timer @@ -400,14 +468,6 @@ Can be programmed with a time in seconds, e.g. to start the bot cyclically.=Kann Start=Start -### timer.lua ### -### logic_and.lua ### - -Connected with=Verbunden mit - ### tool.lua ### Sensor Connection Tool=Sensor Verbindungswerkzeug - - -##### not used anymore ##### diff --git a/signs_bot/locale/template.txt b/signs_bot/locale/template.txt index f12d7e3..75f90ec 100644 --- a/signs_bot/locale/template.txt +++ b/signs_bot/locale/template.txt @@ -5,7 +5,6 @@ ### basis.lua ### running= -charging= stopped= Off= On= @@ -15,7 +14,6 @@ Config= Preassign slots items= Back= Robot Box= -no power= Signs Bot Box= The Box is the housing of the bot.= Place the box and start the bot by means of the 'On' button.= @@ -43,6 +41,11 @@ Bot Sensor: Not connected= The Bot Sensor detects any bot and sends a signal, if a bot is nearby.= The sensor direction does not care.= +### bot_sensor.lua ### +### cart_sensor.lua ### + +the sensor range is one node/meter.= + ### cart_sensor.lua ### Cart Sensor: Connected with= @@ -51,11 +54,6 @@ Cart Sensor: Not connected= The Cart Sensor detects and sends a signal, if a cart (Minecart) is nearby.= The sensor has an active side (red) that must point to the rail/cart.= -### cart_sensor.lua ### -### bot_sensor.lua ### - -the sensor range is one node/meter.= - ### changer.lua ### Signs:= @@ -87,12 +85,6 @@ Sign 'farming'= Used to harvest and seed a 3x3 field.= The seed to be placed has to be in the first inventory slot of the bot.= -### cmd_farming.lua ### -### cmd_flowers.lua ### - -Place the sign in front of the field.= -When finished, the bot turns.= - ### cmd_flowers.lua ### Cutting flowers, leaves and tree blocks@nin front of the robot@non a 3x3 field.= @@ -100,6 +92,12 @@ Sign "flowers"= Sign 'flowers'= Used to cut flowers on a 3x3 field.= +### cmd_flowers.lua ### +### cmd_farming.lua ### + +Place the sign in front of the field.= +When finished, the bot turns.= + ### cmd_item.lua ### Take items from a chest like node@nand put it into the item inventory.@n is the inventory slot (1..8) or 0 for any one= @@ -139,7 +137,6 @@ Use the pattern sign to mark the pattern.= ### cmd_place.lua ### -Error: Position protected= Place a block in front of the robot@n is the inventory slot (1..8)@n is one of: -1 0 +1= Place a block on the left side@n is the inventory slot (1..8)@n is one of: -1 0 +1= Place a block on the right side@n is the inventory slot (1..8)@n is one of: -1 0 +1= @@ -179,6 +176,64 @@ The 'command' sign can be programmed by the player.= Place the sign in front of you and use the node menu to program your sequence of bot commands.= The menu has an edit field for your commands and a help page with all available commands.= +### cmd_soup.lua ### + +Take water into empty bucket when standing on a shore@n(use specified slot number or 0 for auto selection)= +Error: No still water around= +Error: No empty bucket in inventory= +Error: No empty bucket in inventory slot = +Error: No inventory space for full bucket= +Pour water from bucket to empty cauldron in front of a robot@n(use specified slot number or 0 for auto selection)= +Error: No empty cauldron in front of a robot= +Error: No full bucket in inventory= +Error: No full bucket in inventory slot = +Error: No inventory space for empty bucket= +Set fire under cauldron (requires flammable material)@n(command is ignored when fire is already burning)= +Error: No cauldron in front of a robot= +Error: No space for fire under cauldron= +Error: No flammable material under cauldron= +Put out (extinguish) fire under cauldron@n(command is ignored when there is no fire)= +Take boiling soup into empty bowl from cauldron@nin front of a robot@n(use specified slot number or 0 for auto selection)= +Error: No cauldron with a soup in front of a robot= +Error: No empty bowl in inventory= +Error: No empty bowl in inventory slot = +Error: No inventory space for full bowl= +Sign "take water"= +Sign "cook soup"= +Sign 'take water'= +Used to take water into bucket.= +Place the sign on a shore, in front of the still water pool.= +Items in slots:= + 1 - empty bucket= +The result is one bucket with water in selected inventory slot.= +When finished, the bot turns around.= +Sign 'cook soup'= +Used to cook a vegetable soup in cauldron.= +Cauldon should be empty and located above flammable material.= +Place the sign in front of the cauldron with one field space,= +to prevent wooden sign from catching fire.= + 1 - water bucket= + 2 - vegetable #1 (i.e. tomato)= + 3 - vegetable #2 (i.e. carrot)= + 4 - empty bowl (from farming or xdecor mods)= +The result is one bowl with vegetable soup in selected inventory slot.= + +### cmd_soup.lua ### +### cmd_place.lua ### + +Error: Position protected= + +### cmd_trees.lua ### + +Used to harvest an aspen or pine tree trunk= +- Place the sign in front of the tree.= +- Place a chest to the right of the sign.= +- Put a dirt stack (10 items min.) into the chest.= +- Preconfigure slot 1 of the bot inventory with dirt= +- Preconfigure slot 2 of the bot inventory with saplings= +Sign "aspen"= +Sign 'aspen'= + ### commands.lua ### commands:= @@ -345,6 +400,11 @@ inputs= Signal AND= Signal is sent, if all input signals are received.= +### logic_and.lua ### +### timer.lua ### + +Connected with= + ### node_sensor.lua ### Node Sensor: Connected with = @@ -363,6 +423,8 @@ The sensor has an active side (red) that must point to the observed area.= ### signs.lua ### +Instructions:= +Code= Sign "turn right"= Sign "turn left"= Sign "take item"= @@ -382,11 +444,17 @@ The Bot takes items out of a minecart in front of it, pushes the cart and then t ### techage.lua ### +no power= Ignite the techage charcoal lighter= Turns the bot off if the@nbattery power is below the@ngiven value in percent (1..99)= fully charged= Sends a techage command@nto a given node. @nReceiver is addressed by@nthe techage node number.@nFor commands with two or more @nwords, use the '*' character @ninstead of spaces, e.g.: @nsend_cmnd 3465 pull*default:dirt*2= +### techage.lua ### +### basis.lua ### + +charging= + ### timer.lua ### Bot Timer= @@ -400,11 +468,6 @@ Can be programmed with a time in seconds, e.g. to start the bot cyclically.= Start= -### timer.lua ### -### logic_and.lua ### - -Connected with= - ### tool.lua ### Sensor Connection Tool= diff --git a/signs_bot/mod.conf b/signs_bot/mod.conf index fb50f78..7e84aab 100644 --- a/signs_bot/mod.conf +++ b/signs_bot/mod.conf @@ -1,4 +1,4 @@ name=signs_bot depends = default,farming,basic_materials,tubelib2 -optional_depends = node_io,techage,doc,minecart -description = A robot controlled by signs \ No newline at end of file +optional_depends = node_io,techage,doc,minecart,bucket,fire,xdecor +description = A robot controlled by signs diff --git a/signs_bot/signs.lua b/signs_bot/signs.lua index def287c..aa20777 100644 --- a/signs_bot/signs.lua +++ b/signs_bot/signs.lua @@ -24,6 +24,18 @@ local function formspec(cmnd) "label[0.2,0;"..cmnd.."]" end +local function formspecXL(help_text, bot_cmnds) + help_text = help_text or "no help" + bot_cmnds = minetest.formspec_escape(bot_cmnds) + return "size[9,8]".. + default.gui_bg.. + default.gui_bg_img.. + default.gui_slots.. + "label[0,0;" .. S("Instructions:") .. "]" .. + "label[0.2,0.6;" .. help_text .. "]" .. + "textarea[0.3,4.0;9,4.9;code;" .. S("Code") .. ":;" .. bot_cmnds .. "]" +end + local function register_sign(def) minetest.register_node("signs_bot:"..def.name, { description = def.description, @@ -61,7 +73,45 @@ local function register_sign(def) }) end +local function register_signXL(def) + minetest.register_node("signs_bot:"..def.name, { + description = def.description, + inventory_image = def.image, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + { -1/16, -8/16, -1/16, 1/16, 4/16, 1/16}, + { -6/16, -5/16, -2/16, 6/16, 3/16, -1/16}, + }, + }, + paramtype2 = "facedir", + tiles = { + "default_wood.png", + "default_wood.png", + "default_wood.png", + "default_wood.png", + "default_wood.png", + "default_wood.png^"..def.image, + }, + after_place_node = function(pos, placer) + local meta = minetest.get_meta(pos) + meta:set_string("signs_bot_cmnd", def.commands) + meta:set_string("formspec", formspecXL(def.help_text, def.commands)) + meta:set_string("infotext", def.description) + end, + on_rotate = screwdriver.disallow, + paramtype = "light", + use_texture_alpha = signs_bot.CLIP, + sunlight_propagates = true, + is_ground_content = false, + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, sign_bot_sign = 1}, + sounds = default.node_sound_wood_defaults(), + }) +end + signs_bot.register_sign = register_sign +signs_bot.register_signXL = register_signXL diff --git a/signs_bot/techage.lua b/signs_bot/techage.lua index e4e7def..006a29c 100644 --- a/signs_bot/techage.lua +++ b/signs_bot/techage.lua @@ -167,9 +167,9 @@ send_cmnd 3465 pull*default:dirt*2]]), command = command:gsub("*", " ") address = tostring(tonumber(address)) local meta = minetest.get_meta(base_pos) - local number = meta:get_int("number") or 0 + local number = tostring(meta:get_int("number") or 0) local topic, payload = unpack(string.split(command, " ", false, 1)) - techage.send_multi(number, address, topic, payload) + techage.send_single(number, address, topic, payload) return signs_bot.DONE end, }) diff --git a/signs_bot/textures/shrink.py b/signs_bot/textures/shrink.py deleted file mode 100644 index 96863b9..0000000 --- a/signs_bot/textures/shrink.py +++ /dev/null @@ -1,16 +0,0 @@ -import os, fnmatch - - -print ">>> Convert" -for filename in os.listdir("./"): - if fnmatch.fnmatch(filename, "*.png"): - print(filename) - os.system("pngquant --skip-if-larger --quality=8-32 --output ./%s.new ./%s" % (filename, filename)) - -print "\n>>> Copy" -for filename in os.listdir("./"): - if fnmatch.fnmatch(filename, "*.new"): - print(filename) - os.remove("./" + filename[:-4]) - os.rename("./" + filename, "./" + filename[:-4]) - diff --git a/signs_bot/textures/shrink.sh b/signs_bot/textures/shrink.sh new file mode 100755 index 0000000..36036c5 --- /dev/null +++ b/signs_bot/textures/shrink.sh @@ -0,0 +1,2 @@ +#!/bin/bash +pngquant --skip-if-larger --quality=80 --strip *.png --ext .png --force \ No newline at end of file diff --git a/signs_bot/textures/signs_bot_and1.png b/signs_bot/textures/signs_bot_and1.png index e6a95be..aa47209 100644 Binary files a/signs_bot/textures/signs_bot_and1.png and b/signs_bot/textures/signs_bot_and1.png differ diff --git a/signs_bot/textures/signs_bot_and2.png b/signs_bot/textures/signs_bot_and2.png index 0b929b0..be75b4f 100644 Binary files a/signs_bot/textures/signs_bot_and2.png and b/signs_bot/textures/signs_bot_and2.png differ diff --git a/signs_bot/textures/signs_bot_and3.png b/signs_bot/textures/signs_bot_and3.png index 5b96414..27040ce 100644 Binary files a/signs_bot/textures/signs_bot_and3.png and b/signs_bot/textures/signs_bot_and3.png differ diff --git a/signs_bot/textures/signs_bot_and_inv.png b/signs_bot/textures/signs_bot_and_inv.png index 0f0d9a9..24dc1d2 100644 Binary files a/signs_bot/textures/signs_bot_and_inv.png and b/signs_bot/textures/signs_bot_and_inv.png differ diff --git a/signs_bot/textures/signs_bot_base_front.png b/signs_bot/textures/signs_bot_base_front.png index 13a5d6f..a38dc2a 100644 Binary files a/signs_bot/textures/signs_bot_base_front.png and b/signs_bot/textures/signs_bot_base_front.png differ diff --git a/signs_bot/textures/signs_bot_base_left.png b/signs_bot/textures/signs_bot_base_left.png index 91e0d77..08b78f7 100644 Binary files a/signs_bot/textures/signs_bot_base_left.png and b/signs_bot/textures/signs_bot_base_left.png differ diff --git a/signs_bot/textures/signs_bot_base_right.png b/signs_bot/textures/signs_bot_base_right.png index da2df1e..d6c3a3c 100644 Binary files a/signs_bot/textures/signs_bot_base_right.png and b/signs_bot/textures/signs_bot_base_right.png differ diff --git a/signs_bot/textures/signs_bot_base_top.png b/signs_bot/textures/signs_bot_base_top.png index ea734d1..6fe5385 100644 Binary files a/signs_bot/textures/signs_bot_base_top.png and b/signs_bot/textures/signs_bot_base_top.png differ diff --git a/signs_bot/textures/signs_bot_bot_flap.png b/signs_bot/textures/signs_bot_bot_flap.png index 2833658..56060b7 100644 Binary files a/signs_bot/textures/signs_bot_bot_flap.png and b/signs_bot/textures/signs_bot_bot_flap.png differ diff --git a/signs_bot/textures/signs_bot_bot_flap_top.png b/signs_bot/textures/signs_bot_bot_flap_top.png index dd5e82a..9ee556a 100644 Binary files a/signs_bot/textures/signs_bot_bot_flap_top.png and b/signs_bot/textures/signs_bot_bot_flap_top.png differ diff --git a/signs_bot/textures/signs_bot_changer1.png b/signs_bot/textures/signs_bot_changer1.png index 27da88b..4fa6811 100644 Binary files a/signs_bot/textures/signs_bot_changer1.png and b/signs_bot/textures/signs_bot_changer1.png differ diff --git a/signs_bot/textures/signs_bot_changer2.png b/signs_bot/textures/signs_bot_changer2.png index 6c36337..4b811c0 100644 Binary files a/signs_bot/textures/signs_bot_changer2.png and b/signs_bot/textures/signs_bot_changer2.png differ diff --git a/signs_bot/textures/signs_bot_changer3.png b/signs_bot/textures/signs_bot_changer3.png index 7ea99fb..1b8e4f2 100644 Binary files a/signs_bot/textures/signs_bot_changer3.png and b/signs_bot/textures/signs_bot_changer3.png differ diff --git a/signs_bot/textures/signs_bot_changer4.png b/signs_bot/textures/signs_bot_changer4.png index f21cd02..06754f8 100644 Binary files a/signs_bot/textures/signs_bot_changer4.png and b/signs_bot/textures/signs_bot_changer4.png differ diff --git a/signs_bot/textures/signs_bot_chest_front.png b/signs_bot/textures/signs_bot_chest_front.png index 512cd8f..30a6f52 100644 Binary files a/signs_bot/textures/signs_bot_chest_front.png and b/signs_bot/textures/signs_bot_chest_front.png differ diff --git a/signs_bot/textures/signs_bot_ctrl_unit_inv.png b/signs_bot/textures/signs_bot_ctrl_unit_inv.png index 6eb026f..a1e59cb 100644 Binary files a/signs_bot/textures/signs_bot_ctrl_unit_inv.png and b/signs_bot/textures/signs_bot_ctrl_unit_inv.png differ diff --git a/signs_bot/textures/signs_bot_delayer.png b/signs_bot/textures/signs_bot_delayer.png index 0e689fa..3a43d91 100644 Binary files a/signs_bot/textures/signs_bot_delayer.png and b/signs_bot/textures/signs_bot_delayer.png differ diff --git a/signs_bot/textures/signs_bot_delayer_inv.png b/signs_bot/textures/signs_bot_delayer_inv.png index cb4241e..2985dc1 100644 Binary files a/signs_bot/textures/signs_bot_delayer_inv.png and b/signs_bot/textures/signs_bot_delayer_inv.png differ diff --git a/signs_bot/textures/signs_bot_delayer_loaded.png b/signs_bot/textures/signs_bot_delayer_loaded.png index cfd47f2..ffa0456 100644 Binary files a/signs_bot/textures/signs_bot_delayer_loaded.png and b/signs_bot/textures/signs_bot_delayer_loaded.png differ diff --git a/signs_bot/textures/signs_bot_delayer_on.png b/signs_bot/textures/signs_bot_delayer_on.png index 756982e..1dabb6a 100644 Binary files a/signs_bot/textures/signs_bot_delayer_on.png and b/signs_bot/textures/signs_bot_delayer_on.png differ diff --git a/signs_bot/textures/signs_bot_doc_image.png b/signs_bot/textures/signs_bot_doc_image.png index a5f4a39..7554980 100644 Binary files a/signs_bot/textures/signs_bot_doc_image.png and b/signs_bot/textures/signs_bot_doc_image.png differ diff --git a/signs_bot/textures/signs_bot_duplicator.png b/signs_bot/textures/signs_bot_duplicator.png index b32c285..7a6bf10 100644 Binary files a/signs_bot/textures/signs_bot_duplicator.png and b/signs_bot/textures/signs_bot_duplicator.png differ diff --git a/signs_bot/textures/signs_bot_extender.png b/signs_bot/textures/signs_bot_extender.png index 3b586fa..87add4b 100644 Binary files a/signs_bot/textures/signs_bot_extender.png and b/signs_bot/textures/signs_bot_extender.png differ diff --git a/signs_bot/textures/signs_bot_extender_inv.png b/signs_bot/textures/signs_bot_extender_inv.png index 8342103..1789880 100644 Binary files a/signs_bot/textures/signs_bot_extender_inv.png and b/signs_bot/textures/signs_bot_extender_inv.png differ diff --git a/signs_bot/textures/signs_bot_extender_on.png b/signs_bot/textures/signs_bot_extender_on.png index 4a6b7bb..cf28172 100644 Binary files a/signs_bot/textures/signs_bot_extender_on.png and b/signs_bot/textures/signs_bot_extender_on.png differ diff --git a/signs_bot/textures/signs_bot_extender_side.png b/signs_bot/textures/signs_bot_extender_side.png index 1209248..d58a354 100644 Binary files a/signs_bot/textures/signs_bot_extender_side.png and b/signs_bot/textures/signs_bot_extender_side.png differ diff --git a/signs_bot/textures/signs_bot_form_level_bg.png b/signs_bot/textures/signs_bot_form_level_bg.png index 5746583..f5c1dcc 100644 Binary files a/signs_bot/textures/signs_bot_form_level_bg.png and b/signs_bot/textures/signs_bot_form_level_bg.png differ diff --git a/signs_bot/textures/signs_bot_form_level_fg.png b/signs_bot/textures/signs_bot_form_level_fg.png index 0e1e0d7..378b448 100644 Binary files a/signs_bot/textures/signs_bot_form_level_fg.png and b/signs_bot/textures/signs_bot_form_level_fg.png differ diff --git a/signs_bot/textures/signs_bot_form_mask.png b/signs_bot/textures/signs_bot_form_mask.png index 5091649..93226e9 100644 Binary files a/signs_bot/textures/signs_bot_form_mask.png and b/signs_bot/textures/signs_bot_form_mask.png differ diff --git a/signs_bot/textures/signs_bot_missing_node.png b/signs_bot/textures/signs_bot_missing_node.png index 674f367..edb442a 100644 Binary files a/signs_bot/textures/signs_bot_missing_node.png and b/signs_bot/textures/signs_bot_missing_node.png differ diff --git a/signs_bot/textures/signs_bot_robot.png b/signs_bot/textures/signs_bot_robot.png index a969d3a..1549ba6 100644 Binary files a/signs_bot/textures/signs_bot_robot.png and b/signs_bot/textures/signs_bot_robot.png differ diff --git a/signs_bot/textures/signs_bot_robot_back.png b/signs_bot/textures/signs_bot_robot_back.png index 97459b3..78916f2 100644 Binary files a/signs_bot/textures/signs_bot_robot_back.png and b/signs_bot/textures/signs_bot_robot_back.png differ diff --git a/signs_bot/textures/signs_bot_robot_bottom.png b/signs_bot/textures/signs_bot_robot_bottom.png index c489533..4c169cb 100644 Binary files a/signs_bot/textures/signs_bot_robot_bottom.png and b/signs_bot/textures/signs_bot_robot_bottom.png differ diff --git a/signs_bot/textures/signs_bot_robot_front.png b/signs_bot/textures/signs_bot_robot_front.png index 330e62c..e53fbf4 100644 Binary files a/signs_bot/textures/signs_bot_robot_front.png and b/signs_bot/textures/signs_bot_robot_front.png differ diff --git a/signs_bot/textures/signs_bot_robot_left.png b/signs_bot/textures/signs_bot_robot_left.png index 46ccd2e..5185501 100644 Binary files a/signs_bot/textures/signs_bot_robot_left.png and b/signs_bot/textures/signs_bot_robot_left.png differ diff --git a/signs_bot/textures/signs_bot_robot_right.png b/signs_bot/textures/signs_bot_robot_right.png index 4ac7f31..b870b6f 100644 Binary files a/signs_bot/textures/signs_bot_robot_right.png and b/signs_bot/textures/signs_bot_robot_right.png differ diff --git a/signs_bot/textures/signs_bot_robot_top.png b/signs_bot/textures/signs_bot_robot_top.png index ed47bf0..6546285 100644 Binary files a/signs_bot/textures/signs_bot_robot_top.png and b/signs_bot/textures/signs_bot_robot_top.png differ diff --git a/signs_bot/textures/signs_bot_sensor1.png b/signs_bot/textures/signs_bot_sensor1.png index 4eaa5f3..628319f 100644 Binary files a/signs_bot/textures/signs_bot_sensor1.png and b/signs_bot/textures/signs_bot_sensor1.png differ diff --git a/signs_bot/textures/signs_bot_sensor2.png b/signs_bot/textures/signs_bot_sensor2.png index b527c7b..71ec394 100644 Binary files a/signs_bot/textures/signs_bot_sensor2.png and b/signs_bot/textures/signs_bot_sensor2.png differ diff --git a/signs_bot/textures/signs_bot_sensor3.png b/signs_bot/textures/signs_bot_sensor3.png index 210d3ef..1f5242c 100644 Binary files a/signs_bot/textures/signs_bot_sensor3.png and b/signs_bot/textures/signs_bot_sensor3.png differ diff --git a/signs_bot/textures/signs_bot_sensor_bot.png b/signs_bot/textures/signs_bot_sensor_bot.png index e2f1f29..f2819c5 100644 Binary files a/signs_bot/textures/signs_bot_sensor_bot.png and b/signs_bot/textures/signs_bot_sensor_bot.png differ diff --git a/signs_bot/textures/signs_bot_sensor_bot_inv.png b/signs_bot/textures/signs_bot_sensor_bot_inv.png index df4b6c9..bb6601f 100644 Binary files a/signs_bot/textures/signs_bot_sensor_bot_inv.png and b/signs_bot/textures/signs_bot_sensor_bot_inv.png differ diff --git a/signs_bot/textures/signs_bot_sensor_bot_on.png b/signs_bot/textures/signs_bot_sensor_bot_on.png index de94a89..316a13a 100644 Binary files a/signs_bot/textures/signs_bot_sensor_bot_on.png and b/signs_bot/textures/signs_bot_sensor_bot_on.png differ diff --git a/signs_bot/textures/signs_bot_sensor_cart.png b/signs_bot/textures/signs_bot_sensor_cart.png index 809ac0b..3d49680 100644 Binary files a/signs_bot/textures/signs_bot_sensor_cart.png and b/signs_bot/textures/signs_bot_sensor_cart.png differ diff --git a/signs_bot/textures/signs_bot_sensor_cart_inv.png b/signs_bot/textures/signs_bot_sensor_cart_inv.png index f649478..50250fa 100644 Binary files a/signs_bot/textures/signs_bot_sensor_cart_inv.png and b/signs_bot/textures/signs_bot_sensor_cart_inv.png differ diff --git a/signs_bot/textures/signs_bot_sensor_cart_on.png b/signs_bot/textures/signs_bot_sensor_cart_on.png index fabc6e1..74d7124 100644 Binary files a/signs_bot/textures/signs_bot_sensor_cart_on.png and b/signs_bot/textures/signs_bot_sensor_cart_on.png differ diff --git a/signs_bot/textures/signs_bot_sensor_crop.png b/signs_bot/textures/signs_bot_sensor_crop.png index 7f5e87d..a67e106 100644 Binary files a/signs_bot/textures/signs_bot_sensor_crop.png and b/signs_bot/textures/signs_bot_sensor_crop.png differ diff --git a/signs_bot/textures/signs_bot_sensor_crop_inv.png b/signs_bot/textures/signs_bot_sensor_crop_inv.png index 3d55aa5..ab45a12 100644 Binary files a/signs_bot/textures/signs_bot_sensor_crop_inv.png and b/signs_bot/textures/signs_bot_sensor_crop_inv.png differ diff --git a/signs_bot/textures/signs_bot_sensor_crop_on.png b/signs_bot/textures/signs_bot_sensor_crop_on.png index 9a0d50c..1890bfe 100644 Binary files a/signs_bot/textures/signs_bot_sensor_crop_on.png and b/signs_bot/textures/signs_bot_sensor_crop_on.png differ diff --git a/signs_bot/textures/signs_bot_sensor_node.png b/signs_bot/textures/signs_bot_sensor_node.png index 7c8f096..11d0d77 100644 Binary files a/signs_bot/textures/signs_bot_sensor_node.png and b/signs_bot/textures/signs_bot_sensor_node.png differ diff --git a/signs_bot/textures/signs_bot_sensor_node_inv.png b/signs_bot/textures/signs_bot_sensor_node_inv.png index 51018c7..52c05ec 100644 Binary files a/signs_bot/textures/signs_bot_sensor_node_inv.png and b/signs_bot/textures/signs_bot_sensor_node_inv.png differ diff --git a/signs_bot/textures/signs_bot_sensor_node_on.png b/signs_bot/textures/signs_bot_sensor_node_on.png index 04173ea..1650429 100644 Binary files a/signs_bot/textures/signs_bot_sensor_node_on.png and b/signs_bot/textures/signs_bot_sensor_node_on.png differ diff --git a/signs_bot/textures/signs_bot_sign_add.png b/signs_bot/textures/signs_bot_sign_add.png index ded1efa..26b3efb 100644 Binary files a/signs_bot/textures/signs_bot_sign_add.png and b/signs_bot/textures/signs_bot_sign_add.png differ diff --git a/signs_bot/textures/signs_bot_sign_add_cart.png b/signs_bot/textures/signs_bot_sign_add_cart.png index cb29241..8b36d4a 100644 Binary files a/signs_bot/textures/signs_bot_sign_add_cart.png and b/signs_bot/textures/signs_bot_sign_add_cart.png differ diff --git a/signs_bot/textures/signs_bot_sign_aspen.png b/signs_bot/textures/signs_bot_sign_aspen.png new file mode 100644 index 0000000..63b4ece Binary files /dev/null and b/signs_bot/textures/signs_bot_sign_aspen.png differ diff --git a/signs_bot/textures/signs_bot_sign_blank.png b/signs_bot/textures/signs_bot_sign_blank.png index 799f507..8b5cf29 100644 Binary files a/signs_bot/textures/signs_bot_sign_blank.png and b/signs_bot/textures/signs_bot_sign_blank.png differ diff --git a/signs_bot/textures/signs_bot_sign_cmnd.png b/signs_bot/textures/signs_bot_sign_cmnd.png index 35d3e71..cb9886f 100644 Binary files a/signs_bot/textures/signs_bot_sign_cmnd.png and b/signs_bot/textures/signs_bot_sign_cmnd.png differ diff --git a/signs_bot/textures/signs_bot_sign_copy3x3x3.png b/signs_bot/textures/signs_bot_sign_copy3x3x3.png index d5d064d..26db90c 100644 Binary files a/signs_bot/textures/signs_bot_sign_copy3x3x3.png and b/signs_bot/textures/signs_bot_sign_copy3x3x3.png differ diff --git a/signs_bot/textures/signs_bot_sign_farming.png b/signs_bot/textures/signs_bot_sign_farming.png index 28a2e5b..8e8e61b 100644 Binary files a/signs_bot/textures/signs_bot_sign_farming.png and b/signs_bot/textures/signs_bot_sign_farming.png differ diff --git a/signs_bot/textures/signs_bot_sign_flowers.png b/signs_bot/textures/signs_bot_sign_flowers.png index 992c0ba..d53fb5e 100644 Binary files a/signs_bot/textures/signs_bot_sign_flowers.png and b/signs_bot/textures/signs_bot_sign_flowers.png differ diff --git a/signs_bot/textures/signs_bot_sign_left.png b/signs_bot/textures/signs_bot_sign_left.png index a1c9309..6bb3637 100644 Binary files a/signs_bot/textures/signs_bot_sign_left.png and b/signs_bot/textures/signs_bot_sign_left.png differ diff --git a/signs_bot/textures/signs_bot_sign_pattern.png b/signs_bot/textures/signs_bot_sign_pattern.png index 33e18d1..7514aec 100644 Binary files a/signs_bot/textures/signs_bot_sign_pattern.png and b/signs_bot/textures/signs_bot_sign_pattern.png differ diff --git a/signs_bot/textures/signs_bot_sign_right.png b/signs_bot/textures/signs_bot_sign_right.png index ba42000..b999751 100644 Binary files a/signs_bot/textures/signs_bot_sign_right.png and b/signs_bot/textures/signs_bot_sign_right.png differ diff --git a/signs_bot/textures/signs_bot_sign_soup.png b/signs_bot/textures/signs_bot_sign_soup.png new file mode 100644 index 0000000..b60f960 Binary files /dev/null and b/signs_bot/textures/signs_bot_sign_soup.png differ diff --git a/signs_bot/textures/signs_bot_sign_stop.png b/signs_bot/textures/signs_bot_sign_stop.png index ce60d7c..7d8684e 100644 Binary files a/signs_bot/textures/signs_bot_sign_stop.png and b/signs_bot/textures/signs_bot_sign_stop.png differ diff --git a/signs_bot/textures/signs_bot_sign_take.png b/signs_bot/textures/signs_bot_sign_take.png index 25515cc..b500100 100644 Binary files a/signs_bot/textures/signs_bot_sign_take.png and b/signs_bot/textures/signs_bot_sign_take.png differ diff --git a/signs_bot/textures/signs_bot_sign_take_cart.png b/signs_bot/textures/signs_bot_sign_take_cart.png index 2ebf93d..5f339c8 100644 Binary files a/signs_bot/textures/signs_bot_sign_take_cart.png and b/signs_bot/textures/signs_bot_sign_take_cart.png differ diff --git a/signs_bot/textures/signs_bot_sign_user.png b/signs_bot/textures/signs_bot_sign_user.png index 4fa8c91..b044b64 100644 Binary files a/signs_bot/textures/signs_bot_sign_user.png and b/signs_bot/textures/signs_bot_sign_user.png differ diff --git a/signs_bot/textures/signs_bot_sign_water.png b/signs_bot/textures/signs_bot_sign_water.png new file mode 100644 index 0000000..272ef34 Binary files /dev/null and b/signs_bot/textures/signs_bot_sign_water.png differ diff --git a/signs_bot/textures/signs_bot_timer.png b/signs_bot/textures/signs_bot_timer.png index d02f6dd..c22f113 100644 Binary files a/signs_bot/textures/signs_bot_timer.png and b/signs_bot/textures/signs_bot_timer.png differ diff --git a/signs_bot/textures/signs_bot_timer_inv.png b/signs_bot/textures/signs_bot_timer_inv.png index f659cfa..3a4df54 100644 Binary files a/signs_bot/textures/signs_bot_timer_inv.png and b/signs_bot/textures/signs_bot_timer_inv.png differ diff --git a/signs_bot/textures/signs_bot_timer_on.png b/signs_bot/textures/signs_bot_timer_on.png index 646f1df..cb72aa5 100644 Binary files a/signs_bot/textures/signs_bot_timer_on.png and b/signs_bot/textures/signs_bot_timer_on.png differ diff --git a/signs_bot/textures/signs_bot_tool.png b/signs_bot/textures/signs_bot_tool.png index ce08e3c..77de7b1 100644 Binary files a/signs_bot/textures/signs_bot_tool.png and b/signs_bot/textures/signs_bot_tool.png differ diff --git a/signs_bot/textures/signs_bot_torch_animated.png b/signs_bot/textures/signs_bot_torch_animated.png index 3b5055b..89f14fb 100644 Binary files a/signs_bot/textures/signs_bot_torch_animated.png and b/signs_bot/textures/signs_bot_torch_animated.png differ diff --git a/signs_bot/textures/signs_bot_torch_bottom.png b/signs_bot/textures/signs_bot_torch_bottom.png index 84b7270..a1ef853 100644 Binary files a/signs_bot/textures/signs_bot_torch_bottom.png and b/signs_bot/textures/signs_bot_torch_bottom.png differ diff --git a/signs_bot/textures/signs_bot_torch_top.png b/signs_bot/textures/signs_bot_torch_top.png index 15fd637..fc24278 100644 Binary files a/signs_bot/textures/signs_bot_torch_top.png and b/signs_bot/textures/signs_bot_torch_top.png differ diff --git a/techage/basis/laser_lib.lua b/techage/basis/laser_lib.lua index 802b3c3..9df03cb 100644 --- a/techage/basis/laser_lib.lua +++ b/techage/basis/laser_lib.lua @@ -102,7 +102,7 @@ for _, size in ipairs(SIZES) do physical = false, collide_with_objects = false, pointable = false, - static_save = false, + static_save = true, visual_size = {x = size, y = 0.05, z = 0.05}, glow = 14, shaded = true, diff --git a/techage/energy_storage/heatexchanger2.lua b/techage/energy_storage/heatexchanger2.lua index 1cb7c9f..967e26a 100644 --- a/techage/energy_storage/heatexchanger2.lua +++ b/techage/energy_storage/heatexchanger2.lua @@ -130,6 +130,9 @@ end local function check_TES_integrity(pos, nvm) nvm.ticks = (nvm.ticks or 0) + 1 + if (nvm.ticks % 5) == 0 then -- every 10 saec + glowing(pos, nvm, (nvm.capa or 0) / (nvm.capa_max or 1) > 0.8) + end if (nvm.ticks % 30) == 0 then -- every minute return heatexchanger1_cmnd(pos, "volume") end diff --git a/techage/logic/logic_block.lua b/techage/logic/logic_block.lua index d81d463..4f91d0c 100644 --- a/techage/logic/logic_block.lua +++ b/techage/logic/logic_block.lua @@ -87,8 +87,19 @@ local function check_num(pos, num, player_name) end end +local function debug(mem, text) + mem.debug = mem.debug or {} + if #mem.debug > 20 then + table.remove(mem.debug, 1) + end + local s = string.format("%.3f", techage.SystemTime) .. " s: " .. text + table.insert(mem.debug, s) +end + local function send(pos, num, val) local nvm = techage.get_nvm(pos) + local mem = techage.get_mem(pos) + debug(mem, "(outp) " .. num .. " = " .. val) if num == "me" then nvm.outp_tbl = nvm.outp_tbl or {} @@ -242,7 +253,7 @@ local function formspec(pos, meta) local inputs, outputs = data(nvm) local bt = nvm.blocking_time or 1 return "size[10,8.2]" .. - "tabheader[0,0;tab;"..S("Rules") .. "," .. S("Help")..";1;;true]" .. + "tabheader[0,0;tab;"..S("Rules") .. "," .. S("Help") .. "," .. S("Debug") .. ";1;;true]" .. "container[0.4,0.1]" .. rules(meta) .. "container_end[]" .. @@ -263,10 +274,20 @@ end local function formspec_help() return "size[10,8.2]" .. - "tabheader[0,0;tab;"..S("Rules") .. "," .. S("Help")..";2;;true]" .. + "tabheader[0,0;tab;"..S("Rules") .. "," .. S("Help") .. "," .. S("Debug") .. ";2;;true]" .. "textarea[0.3,0.3;9.9,8.5;;;"..minetest.formspec_escape(HELP).."]" end +local function formspec_debug(mem) + mem.debug = mem.debug or {} + local s = table.concat(mem.debug, "\n") + return "size[10,8.2]" .. + "tabheader[0,0;tab;"..S("Rules") .. "," .. S("Help") .. "," .. S("Debug") .. ";3;;true]" .. + "textarea[0.3,0.3;9.9,8.5;;;"..minetest.formspec_escape(s).."]" .. + "button[1.5,7.5;3,1;update2;" .. S("Update") .. "]" .. + "button[5.6,7.5;3,1;clear;" .. S("Clear") .. "]" +end + minetest.register_node("techage:ta3_logic2", { description = S("TA3 Logic Block"), tiles = { @@ -302,10 +323,20 @@ minetest.register_node("techage:ta3_logic2", { nvm.blocking_time = tonumber(fields.bt) or 0.1 nvm.inp_tbl = {me = "off"} nvm.outp_tbl = {} + elseif fields.update2 then + local mem = techage.get_mem(pos) + meta:set_string("formspec", formspec_debug(mem)) + elseif fields.clear then + local mem = techage.get_mem(pos) + mem.debug = {} + meta:set_string("formspec", formspec_debug(mem)) end if fields.tab == "2" then meta:set_string("formspec", formspec_help()) + elseif fields.tab == "3" then + local mem = techage.get_mem(pos) + meta:set_string("formspec", formspec_debug(mem)) else local nvm = techage.get_nvm(pos) local mem = techage.get_mem(pos) @@ -361,10 +392,13 @@ techage.register_node({"techage:ta3_logic2"}, { if src ~= nvm.own_num then if topic == "on" then + debug(mem, "(inp) " .. src .. " = on") nvm.inp_tbl[src] = "on" elseif topic == "off" then + debug(mem, "(inp) " .. src .. " = off") nvm.inp_tbl[src] = "off" else + debug(mem, "(inp) invalid command") return "unsupported" end diff --git a/techage/logic/programmer.lua b/techage/logic/programmer.lua index 5384989..efe2b09 100644 --- a/techage/logic/programmer.lua +++ b/techage/logic/programmer.lua @@ -25,7 +25,7 @@ local function join_to_string(tbl) end local function reset_programmer(itemstack, user, pointed_thing) - user:set_attribute("techage_prog_numbers", nil) + user:get_meta():set_string("techage_prog_numbers", nil) minetest.chat_send_player(user:get_player_name(), S("[TechAge Programmer] programmer reset")) return itemstack end @@ -35,9 +35,9 @@ local function read_number(itemstack, user, pointed_thing) if pos then local number = techage.get_node_number(pos) if number then - local numbers = minetest.deserialize(user:get_attribute("techage_prog_numbers")) or {} + local numbers = minetest.deserialize(user:get_meta():get_string("techage_prog_numbers")) or {} techage.add_to_set(numbers, number) - user:set_attribute("techage_prog_numbers", minetest.serialize(numbers)) + user:get_meta():set_string("techage_prog_numbers", minetest.serialize(numbers)) minetest.chat_send_player(user:get_player_name(), S("[TechAge Programmer] number").." "..number.." read") else minetest.chat_send_player(user:get_player_name(), S("[TechAge Programmer] Unknown node on").." "..minetest.pos_to_string(pos)) @@ -52,8 +52,8 @@ local function program_numbers(itemstack, placer, pointed_thing) local pos = pointed_thing.under if pos then local meta = M(pos) - local numbers = minetest.deserialize(placer:get_attribute("techage_prog_numbers")) or {} - placer:set_attribute("techage_prog_numbers", nil) + local numbers = minetest.deserialize(placer:get_meta():get_string("techage_prog_numbers")) or {} + placer:get_meta():set_string("techage_prog_numbers", nil) local player_name = placer:get_player_name() if meta and meta:get_string("owner") ~= player_name then minetest.chat_send_player(player_name, S("[TechAge Programmer] foreign or unknown node!")) diff --git a/techage/ta1_watermill/sluice.lua b/techage/ta1_watermill/sluice.lua index 1ea0245..c5048e6 100644 --- a/techage/ta1_watermill/sluice.lua +++ b/techage/ta1_watermill/sluice.lua @@ -49,6 +49,10 @@ local function has_water(pos, facedir) end local function on_rightclick(pos, node, clicker, itemstack, pointed_thing) + if minetest.is_protected(pos, clicker:get_player_name()) then + return + end + local pos2 = vector.add(pos, {x = 0, y = -1, z = 0}) local node2 = minetest.get_node(pos2) local pos3, res = has_water(pos2, node2.param2)