From 75e0a665ce2a45e1158a427d3f70f854f5f4d5a8 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Fri, 16 Jun 2017 18:12:21 -0400 Subject: [PATCH] Updated several mods for Minetest 0.4.16 castles modpack, areas, biome_lib, blox, boost_cart, plantlife modpack caverealms, coloredwood, concrete, currency, farming redo, home decor, ilights, mesecons, moreores, pipeworks, signs_lib, technic, unified inventory unified bricks, unified dyes, worldedit, and xban2 --- anvil/init.lua | 16 +- anvil/locale/es.po | 65 ++ areas/README.md | 2 +- biome_lib/init.lua | 4 +- blox/init.lua | 12 +- boost_cart/cart_entity.lua | 2 +- boost_cart/init.lua | 1 + boost_cart/mod.conf | 1 + boost_cart/rails.lua | 10 +- bushes_classic/cooking.lua | 9 +- bushes_classic/init.lua | 9 +- bushes_classic/locale/es.txt | 43 + bushes_classic/nodes.lua | 7 +- castle_farming/locale/es.po | 30 + castle_gates/locale/es.po | 261 ++++++ castle_lighting/locale/es.po | 54 ++ caverealms/falling_ice.lua | 2 +- caverealms/nodes.lua | 4 +- coloredwood/init.lua | 2 +- concrete/locale/es.txt | 8 + currency/barter.lua | 28 +- currency/craftitems.lua | 12 +- currency/depends.txt | 4 +- currency/income.lua | 8 +- currency/init.lua | 20 +- currency/intllib.lua | 45 + currency/locale/template.pot | 177 ++++ currency/loot.lua | 30 + currency/safe.lua | 38 +- currency/shop.lua | 44 +- dryplants/juncus.lua | 4 +- dryplants/reedmace.lua | 6 +- extranodes/locale/es.txt | 7 + farming/README.txt | 7 +- farming/beanpole.lua | 89 +- farming/compatibility.lua | 14 + farming/corn.lua | 14 +- farming/cucumber.lua | 2 +- farming/farming.conf_example | 27 + farming/hemp.lua | 213 +++++ farming/init.lua | 153 ++-- farming/locale/de.txt | 2 +- farming/locale/template.txt | 2 +- farming/lucky_block.lua | 1 + farming/mapgen.lua | 88 +- farming/pumpkin.lua | 2 +- farming/textures/farming_hemp_1.png | Bin 0 -> 115 bytes farming/textures/farming_hemp_2.png | Bin 0 -> 122 bytes farming/textures/farming_hemp_3.png | Bin 0 -> 129 bytes farming/textures/farming_hemp_4.png | Bin 0 -> 132 bytes farming/textures/farming_hemp_5.png | Bin 0 -> 142 bytes farming/textures/farming_hemp_6.png | Bin 0 -> 148 bytes farming/textures/farming_hemp_7.png | Bin 0 -> 169 bytes farming/textures/farming_hemp_8.png | Bin 0 -> 174 bytes farming/textures/farming_hemp_fibre.png | Bin 0 -> 144 bytes farming/textures/farming_hemp_leaf.png | Bin 0 -> 172 bytes farming/textures/farming_hemp_oil.png | Bin 0 -> 164 bytes farming/textures/farming_hemp_rope.png | Bin 0 -> 122 bytes farming/textures/farming_hemp_seed.png | Bin 0 -> 147 bytes ferns/fern.lua | 2 +- ferns/gianttreefern.lua | 2 +- ferns/treefern.lua | 4 +- flowers_plus/init.lua | 7 +- flowers_plus/locale/es.txt | 13 + homedecor/bathroom_furniture.lua | 24 +- homedecor/bedroom.lua | 35 +- homedecor/books.lua | 352 ++++---- homedecor/init.lua | 2 +- homedecor/lighting.lua | 39 +- homedecor/models/homedecor_book.obj | 524 +++++------ homedecor/models/homedecor_book_open.obj | 814 +++++++++--------- homedecor/models/plasma_lamp.obj | 202 +++++ .../textures/homedecor_bathroom_tiles_bg.png | Bin 202 -> 219 bytes .../textures/homedecor_bathroom_tiles_fg.png | Bin 259 -> 248 bytes .../homedecor_glowlight_cube_sides.png | Bin 137 -> 93 bytes ...homedecor_glowlight_cube_sides_ceiling.png | Bin 139 -> 93 bytes ...r_glowlight_cube_sides_ceiling_overlay.png | Bin 0 -> 209 bytes ...homedecor_glowlight_cube_sides_overlay.png | Bin 0 -> 208 bytes .../textures/homedecor_glowlight_cube_tb.png | Bin 142 -> 94 bytes .../homedecor_glowlight_cube_tb_overlay.png | Bin 0 -> 209 bytes .../homedecor_glowlight_thick_sides.png | Bin 173 -> 95 bytes ...omedecor_glowlight_thick_sides_overlay.png | Bin 0 -> 317 bytes .../homedecor_glowlight_thin_sides.png | Bin 137 -> 96 bytes ...homedecor_glowlight_thin_sides_overlay.png | Bin 0 -> 189 bytes .../textures/homedecor_glowlight_top.png | Bin 165 -> 93 bytes .../homedecor_glowlight_top_overlay.png | Bin 0 -> 417 bytes ilights/init.lua | 2 +- inbox/init.lua | 13 + lrfurn/armchairs.lua | 2 +- lrfurn/coffeetable.lua | 2 +- lrfurn/endtable.lua | 2 +- lrfurn/longsofas.lua | 2 +- lrfurn/sofas.lua | 2 +- mesecons/services.lua | 67 +- mesecons_gates/init.lua | 3 +- mesecons_luacontroller/init.lua | 18 +- .../textures/jeija_luac_background.png | Bin 2016 -> 718 bytes mesecons_mvps/init.lua | 1 + moreores/init.lua | 57 +- moreores/mg.lua | 30 +- pipeworks/default_settings.lua | 40 + pipeworks/flowing_logic.lua | 2 +- pipeworks/init.lua | 4 +- pipeworks/item_transport.lua | 4 +- pipeworks/luaentity.lua | 2 +- pipeworks/settingtypes.txt | 70 ++ pipeworks/signal_tubes.lua | 2 +- .../pipeworks_nodebreaker_front_on.png | Bin 544 -> 588 bytes .../pipeworks_nodebreaker_side1_on.png | Bin 589 -> 481 bytes .../pipeworks_nodebreaker_side2_on.png | Bin 589 -> 475 bytes pipeworks/vacuum_tubes.lua | 74 +- poisonivy/init.lua | 7 +- poisonivy/locale/es.txt | 7 + ropes/crafts.lua | 21 +- ropes/ladder.lua | 11 + ropes/ropeboxes.lua | 11 + signs_lib/depends.txt | 1 + signs_lib/init.lua | 10 +- signs_lib/locale/es.txt | 9 + technic/config.lua | 1 + technic/crafts.lua | 48 +- technic/depends.txt | 2 + technic/doc/api.md | 130 +++ technic/init.lua | 4 +- technic/machines/HV/forcefield.lua | 81 +- technic/machines/HV/nuclear_reactor.lua | 190 +++- technic/machines/other/frames.lua | 2 +- technic/machines/register/battery_box.lua | 81 +- technic/machines/register/cables.lua | 32 + technic/machines/switching_station.lua | 33 +- technic/radiation.lua | 26 +- technic/tools/vacuum.lua | 2 +- technic_chests/locale/es.txt | 39 + technic_worldgen/locale/es.txt | 36 + technic_worldgen/oregen.lua | 2 +- technic_worldgen/rubber.lua | 3 +- unified_inventory/README.md | 2 +- unifiedbricks/init.lua | 34 +- .../textures/unifiedbricks_mortar2.png | Bin 0 -> 247 bytes .../textures/unifiedbricks_mortar3.png | Bin 0 -> 247 bytes .../textures/unifiedbricks_mortar4.png | Bin 0 -> 247 bytes unifieddyes/init.lua | 10 +- worldedit_commands/init.lua | 15 +- worldedit_gui/functionality.lua | 105 ++- worldedit_gui/init.lua | 10 +- wrench/init.lua | 36 +- wrench/locale/es.txt | 5 + xban2/README.md | 106 +++ 148 files changed, 3555 insertions(+), 1555 deletions(-) create mode 100644 anvil/locale/es.po create mode 100644 boost_cart/mod.conf create mode 100644 bushes_classic/locale/es.txt create mode 100644 castle_farming/locale/es.po create mode 100644 castle_gates/locale/es.po create mode 100644 castle_lighting/locale/es.po create mode 100644 concrete/locale/es.txt create mode 100644 currency/intllib.lua create mode 100644 currency/locale/template.pot create mode 100644 currency/loot.lua create mode 100644 extranodes/locale/es.txt create mode 100644 farming/farming.conf_example create mode 100644 farming/hemp.lua create mode 100644 farming/textures/farming_hemp_1.png create mode 100644 farming/textures/farming_hemp_2.png create mode 100644 farming/textures/farming_hemp_3.png create mode 100644 farming/textures/farming_hemp_4.png create mode 100644 farming/textures/farming_hemp_5.png create mode 100644 farming/textures/farming_hemp_6.png create mode 100644 farming/textures/farming_hemp_7.png create mode 100644 farming/textures/farming_hemp_8.png create mode 100644 farming/textures/farming_hemp_fibre.png create mode 100644 farming/textures/farming_hemp_leaf.png create mode 100644 farming/textures/farming_hemp_oil.png create mode 100644 farming/textures/farming_hemp_rope.png create mode 100644 farming/textures/farming_hemp_seed.png create mode 100644 flowers_plus/locale/es.txt create mode 100644 homedecor/models/plasma_lamp.obj create mode 100644 homedecor/textures/homedecor_glowlight_cube_sides_ceiling_overlay.png create mode 100644 homedecor/textures/homedecor_glowlight_cube_sides_overlay.png create mode 100644 homedecor/textures/homedecor_glowlight_cube_tb_overlay.png create mode 100644 homedecor/textures/homedecor_glowlight_thick_sides_overlay.png create mode 100644 homedecor/textures/homedecor_glowlight_thin_sides_overlay.png create mode 100644 homedecor/textures/homedecor_glowlight_top_overlay.png create mode 100644 pipeworks/default_settings.lua create mode 100644 pipeworks/settingtypes.txt create mode 100644 poisonivy/locale/es.txt create mode 100644 signs_lib/locale/es.txt create mode 100644 technic/doc/api.md create mode 100644 technic_chests/locale/es.txt create mode 100644 technic_worldgen/locale/es.txt create mode 100644 unifiedbricks/textures/unifiedbricks_mortar2.png create mode 100644 unifiedbricks/textures/unifiedbricks_mortar3.png create mode 100644 unifiedbricks/textures/unifiedbricks_mortar4.png create mode 100644 wrench/locale/es.txt create mode 100644 xban2/README.md diff --git a/anvil/init.lua b/anvil/init.lua index f4098c8b..910c187d 100644 --- a/anvil/init.lua +++ b/anvil/init.lua @@ -69,7 +69,7 @@ minetest.register_entity("anvil:item",{ }) local remove_item = function(pos, node) - local objs = minetest.env:get_objects_inside_radius({x = pos.x, y = pos.y + item_displacement, z = pos.z}, .5) + local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y + item_displacement, z = pos.z}, .5) if objs then for _, obj in ipairs(objs) do if obj and obj:get_luaentity() and obj:get_luaentity().name == "anvil:item" then @@ -80,13 +80,13 @@ local remove_item = function(pos, node) end local update_item = function(pos, node) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) local inv = meta:get_inventory() if not inv:is_empty("input") then pos.y = pos.y + item_displacement tmp.nodename = node.name tmp.texture = inv:get_stack("input", 1):get_name() - local e = minetest.env:add_entity(pos,"anvil:item") + local e = minetest.add_entity(pos,"anvil:item") local yaw = math.pi*2 - node.param2 * math.pi/2 e:setyaw(yaw) end @@ -180,12 +180,13 @@ minetest.register_node("anvil:anvil", { on_rightclick = function(pos, node, clicker, itemstack) if itemstack:get_count() == 0 then - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) local inv = meta:get_inventory() if not inv:is_empty("input") then local return_stack = inv:get_stack("input", 1) inv:set_stack("input", 1, nil) - clicker:get_inventory():add_item("main", return_stack) + local wield_index = clicker:get_wield_index() + clicker:get_inventory():set_stack("main", wield_index, return_stack) remove_item(pos, node) return return_stack end @@ -193,7 +194,7 @@ minetest.register_node("anvil:anvil", { local this_def = minetest.registered_nodes[node.name] if this_def.allow_metadata_inventory_put(pos, "input", 1, itemstack:peek_item(), clicker) > 0 then local s = itemstack:take_item() - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) local inv = meta:get_inventory() inv:add_item("input", s) update_item(pos,node) @@ -214,7 +215,8 @@ minetest.register_node("anvil:anvil", { if not inv:is_empty("input") then local return_stack = inv:get_stack("input", 1) inv:set_stack("input", 1, nil) - puncher:get_inventory():add_item("main", return_stack) + local wield_index = puncher:get_wield_index() + puncher:get_inventory():set_stack("main", wield_index, return_stack) remove_item(pos, node) end end diff --git a/anvil/locale/es.po b/anvil/locale/es.po new file mode 100644 index 00000000..167dbb46 --- /dev/null +++ b/anvil/locale/es.po @@ -0,0 +1,65 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-03-07 22:17-0700\n" +"PO-Revision-Date: 2017-04-20 19:05 -0500\n" +"Last-Translator: Carlos Barraza \n" +"Language-Team: LANGUAGE \n" +"Language: Español\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: init.lua:19 +msgid "Steel blacksmithing hammer" +msgstr "Martillo de acero para la herrería" + +#: init.lua:20 +msgid "A tool for repairing other tools at a blacksmith's anvil." +msgstr "Es una herramienta para reparar otras herramientas en el yunque del herrero" + +#: init.lua:21 +msgid "" +"Use this hammer to strike blows upon an anvil bearing a damaged tool and you " +"can repair it. It can also be used for smashing stone, but it is not well " +"suited to this task." +msgstr "" +"Use este martillo para dar golpes sobre el yunque donde puso la herramienta dañada" +"Tambien puede ser usado para romper piedra pero no es muy adecuado para esa tarea." + +#: init.lua:98 +msgid "Anvil" +msgstr "Yunque" + +#: init.lua:99 +msgid "" +"A tool for repairing other tools in conjunction with a blacksmith's hammer." +msgstr "Es una herramienta para reparar de herramientas dañadas en conjunto con el martillo del herrero." + +#: init.lua:100 +msgid "" +"Right-click on this anvil with a damaged tool to place the damaged tool upon " +"it. You can then repair the damaged tool by striking it with a blacksmith's " +"hammer. Repeated blows may be necessary to fully repair a badly worn tool. " +"To retrieve the tool either punch or right-click the anvil with an empty " +"hand." +msgstr "" +"Haga clic derecho sobre este yunque con una herramienta dañada" +"Puede reparar la herramienta dañada golpeándola con el martillo del herrero" +"Para reparar completamente una herramienta puede dar varios golpes" +"Para sacar la herramienta, golpeela con la mano vacia o tambien con un clic derecho" + +#: init.lua:155 +msgid "This anvil is for damaged tools only." +msgstr "Este yunque es sólo para herramientas dañadas" + +#: init.lua:267 +msgid "Your @1 has been repaired successfully." +msgstr "Su @1 ha sido reparado correctamente." diff --git a/areas/README.md b/areas/README.md index bd6a54d9..f7c07c62 100644 --- a/areas/README.md +++ b/areas/README.md @@ -7,7 +7,7 @@ Configuration If you wish to specify configuration options, such as whether players are allowed to protect their own areas with the `protect` command (disabled by -default), you should check config.lua and set the appropriate settings in your +default), you should check settings.lua and set the appropriate settings in your server's configuration file (probably `minetest.conf`). diff --git a/biome_lib/init.lua b/biome_lib/init.lua index 5cb6202a..cb23eb7a 100644 --- a/biome_lib/init.lua +++ b/biome_lib/init.lua @@ -66,7 +66,7 @@ local humidity_persistence = 0.5 local humidity_scale = 250 local time_scale = 1 -local time_speed = tonumber(minetest.setting_get("time_speed")) +local time_speed = tonumber(minetest.settings:get("time_speed")) if time_speed and time_speed > 0 then time_scale = 72 / time_speed @@ -717,7 +717,7 @@ end -- Check for infinite stacks -if minetest.get_modpath("unified_inventory") or not minetest.setting_getbool("creative_mode") then +if minetest.get_modpath("unified_inventory") or not minetest.settings:get_bool("creative_mode") then biome_lib.expect_infinite_stacks = false else biome_lib.expect_infinite_stacks = true diff --git a/blox/init.lua b/blox/init.lua index cfcc71e5..c0228639 100644 --- a/blox/init.lua +++ b/blox/init.lua @@ -103,12 +103,12 @@ for _, nodeclass in ipairs(NodeClass) do minetest.register_node("blox:stone_"..nodeclass, { description = "Blox stone "..nodeclass, - drawtype = "mesh", tiles = { { name = "default_stone.png", color = 0xffffffff }, + }, + overlay_tiles = { "blox_stone_"..nodeclass..".png" }, - mesh = "blox_block_with_overlay.obj", palette = "unifieddyes_palette_extended.png", place_param2 = 240, paramtype = "light", @@ -123,12 +123,12 @@ for _, nodeclass in ipairs(NodeClass) do minetest.register_node("blox:cobble_"..nodeclass, { description = "Blox cobble "..nodeclass, - drawtype = "mesh", tiles = { { name = "default_cobble.png", color = 0xffffffff }, + }, + overlay_tiles = { "blox_cobble_"..nodeclass..".png" }, - mesh = "blox_block_with_overlay.obj", palette = "unifieddyes_palette_extended.png", place_param2 = 240, paramtype = "light", @@ -143,12 +143,12 @@ for _, nodeclass in ipairs(NodeClass) do minetest.register_node("blox:wood_"..nodeclass, { description = "Blox wood "..nodeclass, - drawtype = "mesh", tiles = { { name = "default_wood.png", color = 0xffffffff }, + }, + overlay_tiles = { "blox_wood_"..nodeclass..".png" }, - mesh = "blox_block_with_overlay.obj", palette = "unifieddyes_palette_extended.png", place_param2 = 240, paramtype = "light", diff --git a/boost_cart/cart_entity.lua b/boost_cart/cart_entity.lua index 16337589..4147c09c 100644 --- a/boost_cart/cart_entity.lua +++ b/boost_cart/cart_entity.lua @@ -231,7 +231,7 @@ function cart_entity:on_step(dtime) local acc = nil local acc_meta = minetest.get_meta(pos):get_string("cart_acceleration") - if acc_meta == "halt" then + if acc_meta == "halt" and not self.punched then -- Stop rail vel = {x=0, y=0, z=0} acc = false diff --git a/boost_cart/init.lua b/boost_cart/init.lua index 7dd5c444..bfae5d97 100644 --- a/boost_cart/init.lua +++ b/boost_cart/init.lua @@ -9,6 +9,7 @@ boost_cart.punch_speed_max = 7 if not boost_cart.modpath then + -- For Minetest 0.4.12 and older that don't look at the "mod.conf" file error("\nWrong mod directory name! Please change it to 'boost_cart'.\n" .. "See also: http://dev.minetest.net/Installing_Mods") end diff --git a/boost_cart/mod.conf b/boost_cart/mod.conf new file mode 100644 index 00000000..7da19df8 --- /dev/null +++ b/boost_cart/mod.conf @@ -0,0 +1 @@ +name = boost_cart \ No newline at end of file diff --git a/boost_cart/rails.lua b/boost_cart/rails.lua index c2a58cdc..a03961b7 100644 --- a/boost_cart/rails.lua +++ b/boost_cart/rails.lua @@ -1,4 +1,12 @@ -boost_cart:register_rail(":default:rail", { +-- Common rail registrations + +local regular_rail_itemname = "default:rail" +if minetest.registered_nodes["carts:rail"] then + -- MTG Compatibility + regular_rail_itemname = "carts:rail" +end + +boost_cart:register_rail(":"..regular_rail_itemname, { description = "Rail", tiles = { "carts_rail_straight.png", "carts_rail_curved.png", diff --git a/bushes_classic/cooking.lua b/bushes_classic/cooking.lua index 25af7e85..0e0810ae 100644 --- a/bushes_classic/cooking.lua +++ b/bushes_classic/cooking.lua @@ -1,4 +1,9 @@ -local S = biome_lib.intllib +local S +if minetest.get_modpath("intllib") then + S = intllib.Getter() +else + S = function(s) return s end +end -- Basket @@ -71,7 +76,7 @@ for i, berry in ipairs(bushes_classic.bushes) do else minetest.register_craftitem(":bushes:"..berry, { - description = desc, + description = S(desc), inventory_image = "bushes_"..berry..".png", groups = {berry = 1, [berry] = 1}, on_use = minetest.item_eat(1), diff --git a/bushes_classic/init.lua b/bushes_classic/init.lua index 021f569a..17a86a64 100644 --- a/bushes_classic/init.lua +++ b/bushes_classic/init.lua @@ -3,7 +3,12 @@ -- -- License: WTFPL -local S = biome_lib.intllib +local S +if minetest.get_modpath("intllib") then + S = intllib.Getter() +else + S = function(s) return s end +end bushes_classic = {} @@ -17,7 +22,7 @@ bushes_classic.bushes = { } bushes_classic.bushes_descriptions = { - "Strawberry", + "Strawberry", "Blackberry", "Blueberry", "Raspberry", diff --git a/bushes_classic/locale/es.txt b/bushes_classic/locale/es.txt new file mode 100644 index 00000000..fc743222 --- /dev/null +++ b/bushes_classic/locale/es.txt @@ -0,0 +1,43 @@ +# Traducido por Carlos Barraza + +Strawberry = Frutilla +Blackberry = Mora +Blueberry = Arándano +Raspberry = Frambuesa +Gooseberry = Grosella +Mixed Berry = Mezcla de Baya +Basket with Strawberry Pies = Cesta con Pasteles de Frutilla +Basket with Blackberry Pies = Cesta con Pasteles de Mora +Basket with Blueberry Pies = Cesta con Pasteles de Arándano +Basket with Raspberry Pies = Cesta con Pasteles de Frambuesa +Basket with Gooseberry Pies = Cesta con Pasteles de Grosella +Basket with Mixed Berry Pies = Cesta con Pasteles de Mezcla de Baya +currently fruitless = Actualmente infructuoso +Strawberry Bush = Arbusto de Frutilla +Blackberry Bush = Arbusto de Mora +Blueberry Bush = Arbusto de Arándano +Raspberry Bush = Arbusto de Frambuesa +Gooseberry Bush = Arbusto de Grosella +Mixed Berry Bush = Arbusto de Mezcla de Baya +Basket = Cesta +Sugar = Azúcar +Raw Strawberry pie = Pastel de Frutilla Crudo +Raw Blackberry pie = Pastel de Mora Crudo +Raw Blueberry pie = Pastel de Arándano Crudo +Raw Raspberry pie = Pastel de Frambuesa Crudo +Raw Gooseberry pie = Pastel de Grosella Crudo +Raw Mixed Berry pie = Pastel de Mezcla de Bayas Cruda +Cooked Strawberry pie = Pastel de Frutilla Cocido +Cooked Blackberry pie = Pastel de Mora Cocido +Cooked Blueberry pie = Pastel de Arándano Cocido +Cooked Raspberry pie = Pastel de Frambuesa Cocido +Cooked Gooseberry pie = Pastel de Grosella Cocido +Cooked Mixed Berry pie = Pastel de Mezcla de Bayas Cocido +Slice of Strawberry pie = Rebanada de Pastel de Frutilla +Slice of Blackberry pie = Rebanada de Pastel de Mora +Slice of Blueberry pie = Rebanada de Pastel de Arándano +Slice of Raspberry pie = Rebanada de Pastel de Frambuesa +Slice of Gooseberry pie = Rebanada de Pastel de Grosella +Slice of Mixed Berry pie = Rebanada de Pastel de Mezcla de Bayas + +[Bushes] Loaded. = [Arbustos] Cargado. diff --git a/bushes_classic/nodes.lua b/bushes_classic/nodes.lua index 352e2a90..e45c7e75 100644 --- a/bushes_classic/nodes.lua +++ b/bushes_classic/nodes.lua @@ -1,4 +1,9 @@ -local S = biome_lib.intllib +local S +if minetest.get_modpath("intllib") then + S = intllib.Getter() +else + S = function(s) return s end +end plantlife_bushes = {} diff --git a/castle_farming/locale/es.po b/castle_farming/locale/es.po new file mode 100644 index 00000000..72983b33 --- /dev/null +++ b/castle_farming/locale/es.po @@ -0,0 +1,30 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-02-27 00:59-0700\n" +"PO-Revision-Date: 2017-04-21 19:47-0500\n" +"Last-Translator: Carlos Barraza \n" +"Language-Team: LANGUAGE \n" +"Language: Español\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: hides.lua:9 +msgid "Hides" +msgstr "Escondite" + +#: straw.lua:13 +msgid "Bound Straw" +msgstr "Paja amarrada" + +#: straw.lua:22 +msgid "Training Dummy" +msgstr "Maniqui de Entrenamiento" diff --git a/castle_gates/locale/es.po b/castle_gates/locale/es.po new file mode 100644 index 00000000..c1021614 --- /dev/null +++ b/castle_gates/locale/es.po @@ -0,0 +1,261 @@ +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-03-01 23:41-0700\n" +"PO-Revision-Date: 2017-04-28 11:56-0400\n" +"Last-Translator: Carlos Barraza\n" +"Language-Team: LANGUAGE \n" +"Language: Español\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: doc.lua:11 +msgid "Heavy wooden bars designed to prevent entry even to siege equipment." +msgstr "" +"Barras de madera pesadas diseñadas para evitar la entrada incluso a equipo de " +"asedio" + +#: doc.lua:12 +msgid "" +"Place these bars in a structure together and they will slide as a unified " +"gate when clicked on." +msgstr "" +"Coloque estas barras en una estructura juntas y se deslizarán como si " +"estuvieran unidas cuando se le hace clic" + +#: doc.lua:14 +msgid "" +"The bottom edge of a portcullis gate, with knobs to lock securely into the " +"floor." +msgstr "" +"Es el borde inferior de una puerta rastrillo, con perillas para bloquearla con " +"seguridad en el piso" + +#: doc.lua:15 +msgid "" +"This block can be used to define the edge of a portcullius that meets up " +"with another gate, should you have an arrangement like that. Otherwise it's " +"just decorative." +msgstr "" +"Este bloque puede ser usado para definir el borde de una puerta rastrillo " +"que esta cerca de otra puerta, si tiene varias puertas independientes, " +"de lo contrario es simplemente decorativo" + +#: doc.lua:17 +msgid "A basic gate panel." +msgstr "Un panel básico de puerta" + +#: doc.lua:18 +msgid "" +"This gate segment will move in unison with adjoining gate segments when " +"right-clicked." +msgstr "" +"Este segmento de puerta se moverá junto con los demas segmentos de puerta " +"adyacente cuando se haga clic con el botón derecho del ratón" + +#: doc.lua:20 +msgid "A gate panel with a defined edge." +msgstr "Un panel de puerta con un borde." + +#: doc.lua:21 +msgid "" +"The darkened edge of this panel marks the edge of the gate it's a part of. " +"You can use these when building double doors to ensure the two parts swing " +"separately, for example. Note that edges aren't strictly necessary for gates " +"that stand alone." +msgstr "" +"El borde oscurecido de este panel marca el limite de la puerta." +"Usted puede utilizar estos bloques para construir puertas dobles para asegurar " +"que las dos puertas funcionen por separado, por ejemplo. Tenga en cuenta que " +"los bordes no son estrictamente necesarios para las puertas individuales" + +#: doc.lua:23 +msgid "A gate edge with a handle." +msgstr "Un panel de puerta con pestillo" + +#: doc.lua:24 +msgid "" +"The handle is basically decorative, a door this size can be swung by " +"clicking anywhere on it. But the darkened edge of this panel is useful for " +"defining the edge of a gate when it abuts a partner to the side." +msgstr "" +"El pestillo es básicamente decorativo, una puerta de este tamaño se puede " +"abrir haciendo clic en cualquier parte de ella. Pero el borde oscuro de este " +"panel es útil para definir el borde de la puerta cuando hay otra puerta al " +"lado." + +#: doc.lua:26 +msgid "A hinged gate segment that allows a gate to swing." +msgstr "Un segmento de puerta con bisagra permite que la puerta se abra." + +#: doc.lua:27 +msgid "" +"If you have more than one hinge in your gate, make sure the hinges line up " +"correctly otherwise the gate will not be able to swing. The hinge is the " +"protruding block along the edge of the gate panel." +msgstr "" +"Si tiene más de una bisagra en su puerta, asegúrese de que las bisagras se " +"alineen correctamente, de lo contrario la puerta no será capaz de abrirse. " +"la bisagra es el bloque sobresaliente a lo largo del borde del panel de la " +"puerta." + +#: doc.lua:29 +msgid "A block with a slot to allow an adjacent sliding gate through." +msgstr "" +"Un bloque con una ranura en el medio para que una puerta deslizante pueda " +"pasar a través de ella." + +#: doc.lua:30 +msgid "" +"This block is designed to extend into a neighboring node that a sliding gate " +"passes through, to provide a tight seal for the gate to move through without " +"allowing anything else to squeeze in." +msgstr "" +"Este bloque está diseñado para un nodo pueda deslizarse a travéz de este, para " +"proporcionar un cierre hermético que solo deja pasar la puerta sin permitir " +"entrar nada mas." + +#: doc.lua:32 +msgid "" +"A block that extends into an adjacent node to provide a tight seal for a " +"large gate." +msgstr "" +"Un bloque con una ranura en el lado para que una puerta deslizante pueda " +"pasar a través de ella." + +#: doc.lua:33 +msgid "" +"Two nodes cannot occupy the same space, but this block extends into a " +"neighboring node's space to allow for gates to form a tight seal. It can be " +"used with sliding gates or swinging gates." +msgstr "" +"Dos nodos no pueden utilizar el mismo espacio, pero este nodo se extiende al " +"espacio de un nodo vecino para permitir que las puertas formen un cierre " +"hermético. Puede utilizarse con puertas deslizantes y con las puertas que se " +"abren rotando." + +#: doc.lua:37 +msgid "Gates" +msgstr "Puertas" + +#: doc.lua:38 +msgid "" +"Gates are large multi-node constructions that swing on hinges or slide out " +"of the way when triggered." +msgstr "" +"Las puertas grandes son construcciones multi nodo que se abren usando bisagras " +"o se deslizan hacia arriba cuando se activan" + +#: doc.lua:43 +msgid "Gate construction" +msgstr "Construcción de Puertas" + +#: doc.lua:45 +msgid "" +"Gates are multi-node constructions, usually (though not always) consisting " +"of multiple node types that fit together into a unified whole. The " +"orientation of gate nodes is significant, so a screwdriver will be a helpful " +"tool when constructing gates.\n" +"\n" +"A gate's extent is determined by a \"flood fill\" operation. When you " +"trigger a gate block, all compatible neighboring blocks will be considered " +"part of the same structure and will move in unison. Only gate blocks that " +"are aligned with each other will be considered part of the same gate. If you " +"wish to build adjoining gates (for example, a large pair of double doors " +"that meet in the center) you'll need to make use of gate edge blocks to " +"prevent it all from being considered one big door. Note that if your gate " +"does not abut any other gates you don't actually need to define its edges " +"this way - you don't have to use edge blocks in this case.\n" +"\n" +"If a gate has no hinge nodes it will be considered a sliding gate. When " +"triggered, the gate code will search for a direction that the gate can slide " +"in and will move it in that direction at a rate of one block-length per " +"second. Once it reaches an obstruction it will stop, and when triggered " +"again it will try sliding in the opposite direction.\n" +"\n" +"If a gate has hinge nodes then triggering it will cause the gate to try " +"swinging around the hinge. If the gate has multiple hinges and they don't " +"line up properly the gate will be unable to move. Note that the gate can " +"only exist in 90-degree increments of orientation, but the gate still looks " +"for obstructions in the region it is swinging through and will not swing if " +"there's something in the way." +msgstr "" +"Las puertas son generalmente construcciones multi nodo (aunque no siempre), " +"que consisten de múltiples tipos de nodos que se acomodan en un todo " +"unificado. La orientación de los nodos de la puerta es importante, por lo que " +"un destornillador será útil para construir las puertas.\n" +"\n" +"La extención de una puerta se determina mediante una operación de \"Llenado de " +"Inundación\". Al activar un bloque de la puerta, todos los bloques vecinos " +"compatibles se considerán parte de la misma estructura y se moveran al unísono. " +"Sólo los bloques de compuerta que estén alineados entre sí se considerarán " +"parte de la misma puerta. Si desea construir puertas adyacentes (por ejemplo, " +"un gran par de puertas dobles que se abran en el centro) tendrá que hacer uso " +"de bloques de borde de puerta para evitar que todo sea considerado solo una " +"gran puerta. Tenga en cuenta que si su puerta no se apoya en ninguna otra " +"puerta, no necesita usar los bordes de puerta en este caso.\n" +"\n" +"Si una puerta no tiene nodos de bisagra se considerará una puerta deslizante. " +"Cuando se ejecuta el codigo de la puerta buscará una dirección en la que la " +"puerta pueda deslizarse y se moverá en esa dirección a una velocidad de un " +"bloque por segundo. Una vez que llega a una obstrucción se detendrá, y cuando " +"se ejecute de nuevo tratará de deslizarse en la dirección opuesta.\n" +"\n" +"Si una puerta tiene nodos de bisagra, entonces al activar la puerta tratara de " +"girar al rededor de la bisagra. Si la puerta tiene bisagras múltiples y no " +"estan bien alineadas, la puerta no podrá moverse. Tenga en cuenta que la " +"puerta sólo puede existir en incrementos de 90 grados de orientación, pero la " +"puerta todavía busca obstrucciones en la región que está moviéndose y no " +"girara si hay algo en el camino." + + +#: doors.lua:8 +msgid "Oak Door" +msgstr "Puerta de Roble" + +#: doors.lua:22 +msgid "Jail Door" +msgstr "Puerta de Cárcel" + +#: doors.lua:43 +msgid "Jail Bars" +msgstr "" + +#: gate_slots.lua:36 +msgid "Stonebrick" +msgstr "Ladrillo de Piedra" + +#: gate_slots.lua:45 +msgid "@1 Gate Slot" +msgstr "Espacio para Puerta de @1" + +#: gate_slots.lua:70 +msgid "@1 Gate Slot Reverse" +msgstr "Espacio para Puerta Invertido de @1" + +#: gates.lua:7 +msgid "Portcullis Bars" +msgstr "Barras de la Puerta Rastrillo" + +#: gates.lua:37 +msgid "Portcullis Bottom" +msgstr "Terminación de la Puerta Rastrillo" + +#: gates.lua:104 +msgid "Gate Door" +msgstr "Porción de la Puerta" + +#: gates.lua:136 +msgid "Gate Door Edge" +msgstr "Borde de la Puerta" + +#: gates.lua:175 +msgid "Gate Door With Handle" +msgstr "Pestillo de la Puerta" + +#: gates.lua:218 +msgid "Gate Door With Hinge" +msgstr "Bisagra de la Puerta" diff --git a/castle_lighting/locale/es.po b/castle_lighting/locale/es.po new file mode 100644 index 00000000..f0faee9b --- /dev/null +++ b/castle_lighting/locale/es.po @@ -0,0 +1,54 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-03-01 23:52-0700\n" +"PO-Revision-Date: 2017-04-28 12:40-0400\n" +"Last-Translator: Carlos Barraza\n" +"Language-Team: LANGUAGE \n" +"Language: Español\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: brasier.lua:7 +msgid "A brasier for producing copious amounts of light and heat." +msgstr "Un brasero para producir grandes cantidades de luz y calor." + +#: brasier.lua:8 +msgid "" +"To ignite the brasier place a flammable fuel in its inventory slot. A lump " +"of coal will burn for about half an hour." +msgstr "" +"Para encender el brasero coloque un combustible inflamable en su ranura de " +"inventario. Un trozo de carbón arderá durante media hora." + +#: brasier.lua:107 +msgid "Floor Brasier" +msgstr "Brasero con Patas" + +#: brasier.lua:156 +msgid "Stonebrick" +msgstr "Ladrillo de piedra" + +#: brasier.lua:228 +msgid "@1 Brasier" +msgstr "Brasero de @1" + +#: init.lua:17 +msgid "Light Block" +msgstr "Bloque de luz" + +#: init.lua:37 +msgid "Chandelier" +msgstr "Candelero" + +#: init.lua:76 +msgid "Chandelier Chain" +msgstr "Colgante de Candelero" diff --git a/caverealms/falling_ice.lua b/caverealms/falling_ice.lua index 46b704bc..f1ea438b 100644 --- a/caverealms/falling_ice.lua +++ b/caverealms/falling_ice.lua @@ -186,7 +186,7 @@ function caverealms:nodeupdate_single(p, delay) end if minetest.get_item_group(n.name, "attached_node") ~= 0 then - if not check_attached_node(p, n) then + if not caverealms:check_attached_node(p, n) then caverealms:drop_attached_node(p) caverealms:nodeupdate(p) end diff --git a/caverealms/nodes.lua b/caverealms/nodes.lua index a1e819cb..5292eea4 100644 --- a/caverealms/nodes.lua +++ b/caverealms/nodes.lua @@ -86,10 +86,10 @@ minetest.register_node("caverealms:thin_ice", { --alternate version for stalactites minetest.register_node("caverealms:hanging_thin_ice", { - description = "Thin Ice", + description = "Thin Ice (hanging)", tiles = {"caverealms_thin_ice.png"}, is_ground_content = true, - groups = {cracky=3}, + groups = {cracky=3, not_in_creative_inventory = 1}, sounds = default.node_sound_glass_defaults(), use_texture_alpha = true, drawtype = "glasslike", diff --git a/coloredwood/init.lua b/coloredwood/init.lua index 2c09e217..765938bf 100644 --- a/coloredwood/init.lua +++ b/coloredwood/init.lua @@ -18,7 +18,7 @@ coloredwood = {} coloredwood.enable_stairsplus = true -if minetest.setting_getbool("coloredwood_enable_stairsplus") == false or not minetest.get_modpath("moreblocks") then +if minetest.settings:get_bool("coloredwood_enable_stairsplus") == false or not minetest.get_modpath("moreblocks") then coloredwood.enable_stairsplus = false end diff --git a/concrete/locale/es.txt b/concrete/locale/es.txt new file mode 100644 index 00000000..b7ea30a2 --- /dev/null +++ b/concrete/locale/es.txt @@ -0,0 +1,8 @@ +# technic_concrete traducido por Carlos Barraza + +Rebar = Barra de refuerzo +Concrete Block = Bloque de concreto +Blast-resistant Concrete Block = Bloque de concreto resistente a explosiones +Concrete Post Platform = Plataforma de concreto +Concrete Post = Postes de concreto + diff --git a/currency/barter.lua b/currency/barter.lua index dad2e4a7..1fb4f1bc 100644 --- a/currency/barter.lua +++ b/currency/barter.lua @@ -1,5 +1,9 @@ barter = {} +-- internationalization boilerplate +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP.."/intllib.lua") + barter.chest = {} barter.chest.formspec = { main = "size[8,9]".. @@ -7,20 +11,20 @@ barter.chest.formspec = { "list[current_name;pl2;5,0;3,4;]".. "list[current_player;main;0,5;8,4;]", pl1 = { - start = "button[3,1;1,1;pl1_start;Start]", + start = "button[3,1;1,1;pl1_start;" .. S("Start") .. "]", player = function(name) return "label[3,0;"..name.."]" end, - accept1 = "button[3,1;1,1;pl1_accept1;Confirm]".. - "button[3,2;1,1;pl1_cancel;Cancel]", - accept2 = "button[3,1;1,1;pl1_accept2;Exchange]".. - "button[3,2;1,1;pl1_cancel;Cancel]", + accept1 = "button[3,1;1,1;pl1_accept1;" .. S("Confirm") .. "]".. + "button[3,2;1,1;pl1_cancel;" .. S("Cancel") .. "]", + accept2 = "button[3,1;1,1;pl1_accept2;" .. S("Exchange") .. "]".. + "button[3,2;1,1;pl1_cancel;" .. S("Cancel") .. "]", }, pl2 = { - start = "button[4,1;1,1;pl2_start;Start]", + start = "button[4,1;1,1;pl2_start;" .. S("Start") .. "]", player = function(name) return "label[4,0;"..name.."]" end, - accept1 = "button[4,1;1,1;pl2_accept1;Confirm]".. - "button[4,2;1,1;pl2_cancel;Cancel]", - accept2 = "button[4,1;1,1;pl2_accept2;Exchange]".. - "button[4,2;1,1;pl2_cancel;Cancel]", + accept1 = "button[4,1;1,1;pl2_accept1;" .. S("Confirm") .. "]".. + "button[4,2;1,1;pl2_cancel;" .. S("Cancel") .. "]", + accept2 = "button[4,1;1,1;pl2_accept2;" .. S("Exchange") .. "]".. + "button[4,2;1,1;pl2_cancel;" .. S("Cancel") .. "]", }, } @@ -90,7 +94,7 @@ end minetest.register_node("currency:barter", { drawtype = "nodebox", - description = "Barter Table", + description = S("Barter Table"), paramtype = "light", paramtype2 = "facedir", tiles = {"barter_top.png", @@ -111,7 +115,7 @@ minetest.register_node("currency:barter", { sounds = default.node_sound_wood_defaults(), on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("infotext", "Barter Table") + meta:set_string("infotext", S("Barter Table")) meta:set_string("pl1","") meta:set_string("pl2","") barter.chest.update_formspec(meta) diff --git a/currency/craftitems.lua b/currency/craftitems.lua index 47ad9532..a8d75706 100644 --- a/currency/craftitems.lua +++ b/currency/craftitems.lua @@ -1,26 +1,30 @@ +-- internationalization boilerplate +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP.."/intllib.lua") + minetest.register_craftitem("currency:minegeld", { - description = "1 MineGeld Note", + description = S("1 MineGeld Note"), inventory_image = "minegeld.png", stack_max = 30000, groups = {minegeld = 1} }) minetest.register_craftitem("currency:minegeld_5", { - description = "5 MineGeld Note", + description = S("5 MineGeld Note"), inventory_image = "minegeld_5.png", stack_max = 30000, groups = {minegeld = 1} }) minetest.register_craftitem("currency:minegeld_10", { - description = "10 MineGeld Note", + description = S("10 MineGeld Note"), inventory_image = "minegeld_10.png", stack_max = 30000, groups = {minegeld = 1} }) minetest.register_craftitem("currency:minegeld_bundle", { - description = "Bundle of random Minegeld notes", + description = S("Bundle of random Minegeld notes"), inventory_image = "minegeld_bundle.png", stack_max = 30000, }) diff --git a/currency/depends.txt b/currency/depends.txt index d3f04d85..b650e9bf 100644 --- a/currency/depends.txt +++ b/currency/depends.txt @@ -1,2 +1,4 @@ default -pipeworks? +intllib? +loot? +pipeworks? \ No newline at end of file diff --git a/currency/income.lua b/currency/income.lua index 2bb42bc4..cbbd5d80 100644 --- a/currency/income.lua +++ b/currency/income.lua @@ -1,5 +1,9 @@ players_income = {} +-- internationalization boilerplate +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP.."/intllib.lua") + local timer = 0 minetest.register_globalstep(function(dtime) timer = timer + dtime; @@ -11,7 +15,7 @@ minetest.register_globalstep(function(dtime) players_income[name] = 0 end players_income[name] = 1 - minetest.log("info", "[Currency] basic income for "..name.."") + minetest.log("info", "[Currency] "..S("basic income for @1", name)) end end end) @@ -27,7 +31,7 @@ earn_income = function(player) local inv = player:get_inventory() inv:add_item("main", {name="currency:minegeld_5", count=count}) players_income[name] = 0 - minetest.log("info", "[Currency] added basic income for "..name.." to inventory") + minetest.log("info", "[Currency] "..S("added basic income for @1 to inventory", name)) end end diff --git a/currency/init.lua b/currency/init.lua index 744fcad9..fa85bd2f 100644 --- a/currency/init.lua +++ b/currency/init.lua @@ -1,20 +1,24 @@ -minetest.log("info", " Currency mod loading... ") local modpath = minetest.get_modpath("currency") +-- internationalization boilerplate +local S, NS = dofile(modpath.."/intllib.lua") + +minetest.log("info", S("Currency mod loading...")) + dofile(modpath.."/craftitems.lua") -minetest.log("info", "[Currency] Craft_items Loaded!") +minetest.log("info", "[Currency] "..S("Craft_items Loaded!")) dofile(modpath.."/shop.lua") -minetest.log("info", "[Currency] Shop Loaded!") +minetest.log("info", "[Currency] "..S("Shop Loaded!")) dofile(modpath.."/barter.lua") -minetest.log("info", "[Currency] Barter Loaded!") +minetest.log("info", "[Currency] "..S("Barter Loaded!")) dofile(modpath.."/safe.lua") -minetest.log("info", "[Currency] Safe Loaded!") +minetest.log("info", "[Currency] "..S("Safe Loaded!")) dofile(modpath.."/crafting.lua") -minetest.log("info", "[Currency] Crafting Loaded!") +minetest.log("info", "[Currency] "..S("Crafting Loaded!")) if minetest.setting_getbool("creative_mode") then - minetest.log("info", "[Currency] Creative mode in use, skipping basic income.") + minetest.log("info", "[Currency] "..S("Creative mode in use, skipping basic income.")) else dofile(modpath.."/income.lua") - minetest.log("info", "[Currency] Income Loaded!") + minetest.log("info", "[Currency] "..S("Income Loaded!")) end diff --git a/currency/intllib.lua b/currency/intllib.lua new file mode 100644 index 00000000..6669d720 --- /dev/null +++ b/currency/intllib.lua @@ -0,0 +1,45 @@ + +-- Fallback functions for when `intllib` is not installed. +-- Code released under Unlicense . + +-- Get the latest version of this file at: +-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua + +local function format(str, ...) + local args = { ... } + local function repl(escape, open, num, close) + if escape == "" then + local replacement = tostring(args[tonumber(num)]) + if open == "" then + replacement = replacement..close + end + return replacement + else + return "@"..open..num..close + end + end + return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl)) +end + +local gettext, ngettext +if minetest.get_modpath("intllib") then + if intllib.make_gettext_pair then + -- New method using gettext. + gettext, ngettext = intllib.make_gettext_pair() + else + -- Old method using text files. + gettext = intllib.Getter() + end +end + +-- Fill in missing functions. + +gettext = gettext or function(msgid, ...) + return format(msgid, ...) +end + +ngettext = ngettext or function(msgid, msgid_plural, n, ...) + return format(n==1 and msgid or msgid_plural, ...) +end + +return gettext, ngettext diff --git a/currency/locale/template.pot b/currency/locale/template.pot new file mode 100644 index 00000000..f5282147 --- /dev/null +++ b/currency/locale/template.pot @@ -0,0 +1,177 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-02-20 13:58-0700\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: barter.lua:14 barter.lua:22 +msgid "Start" +msgstr "" + +#: barter.lua:16 barter.lua:24 +msgid "Confirm" +msgstr "" + +#: barter.lua:17 barter.lua:19 barter.lua:25 barter.lua:27 +msgid "Cancel" +msgstr "" + +#: barter.lua:18 barter.lua:26 shop.lua:20 +msgid "Exchange" +msgstr "" + +#: barter.lua:97 barter.lua:118 +msgid "Barter Table" +msgstr "" + +#: craftitems.lua:6 +msgid "1 MineGeld Note" +msgstr "" + +#: craftitems.lua:13 +msgid "5 MineGeld Note" +msgstr "" + +#: craftitems.lua:20 +msgid "10 MineGeld Note" +msgstr "" + +#: craftitems.lua:27 +msgid "Bundle of random Minegeld notes" +msgstr "" + +#: income.lua:18 +msgid "basic income for @1" +msgstr "" + +#: income.lua:34 +msgid "added basic income for @1 to inventory" +msgstr "" + +#: init.lua:6 +msgid "Currency mod loading..." +msgstr "" + +#: init.lua:9 +msgid "Craft_items Loaded!" +msgstr "" + +#: init.lua:11 +msgid "Shop Loaded!" +msgstr "" + +#: init.lua:13 +msgid "Barter Loaded!" +msgstr "" + +#: init.lua:15 +msgid "Safe Loaded!" +msgstr "" + +#: init.lua:17 +msgid "Crafting Loaded!" +msgstr "" + +#: init.lua:20 +msgid "Creative mode in use, skipping basic income." +msgstr "" + +#: init.lua:23 +msgid "Income Loaded!" +msgstr "" + +#: safe.lua:29 +msgid "Safe" +msgstr "" + +#: safe.lua:44 +msgid "Safe (owned by @1)" +msgstr "" + +#: safe.lua:61 safe.lua:70 safe.lua:79 +msgid "@1 tried to access a safe belonging to @2 at @3" +msgstr "" + +#: safe.lua:86 +msgid "@1 moves stuff in safe at @2" +msgstr "" + +#: safe.lua:89 +msgid "@1 moves stuff to safe at @2" +msgstr "" + +#: safe.lua:92 +msgid "@1 takes stuff from safe at @2" +msgstr "" + +#: shop.lua:11 +msgid "Customer gives (pay here!)" +msgstr "" + +#: shop.lua:13 +msgid "Customer gets:" +msgstr "" + +#: shop.lua:15 +msgid "Owner wants:" +msgstr "" + +#: shop.lua:17 +msgid "Owner gives:" +msgstr "" + +#: shop.lua:26 +msgid "Customers gave:" +msgstr "" + +#: shop.lua:28 +msgid "Your stock:" +msgstr "" + +#: shop.lua:30 +msgid "You want:" +msgstr "" + +#: shop.lua:32 +msgid "In exchange, you give:" +msgstr "" + +#: shop.lua:34 +msgid "Owner, Use (E)+Place (right mouse button) for customer interface" +msgstr "" + +#: shop.lua:88 +msgid "Shop" +msgstr "" + +#: shop.lua:102 +msgid "Exchange shop (owned by @1)" +msgstr "" + +#: shop.lua:151 +msgid "This is your own shop, you can't exchange to yourself!" +msgstr "" + +#: shop.lua:188 +msgid "Exchanged!" +msgstr "" + +#: shop.lua:191 +msgid "Exchange can not be done, contact the shop owner." +msgstr "" + +#: shop.lua:193 +msgid "Exchange can not be done, check if you put all items!" +msgstr "" diff --git a/currency/loot.lua b/currency/loot.lua new file mode 100644 index 00000000..e687724f --- /dev/null +++ b/currency/loot.lua @@ -0,0 +1,30 @@ +if not minetest.get_modpath("loot") then + return +end + +loot.register_loot({ + weights = { generic = 50 }, + payload = { + stack = ItemStack("currency:minegeld"), + min_size = 1, + max_size = 250, + }, +}) + +loot.register_loot({ + weights = { generic = 50 }, + payload = { + stack = ItemStack("currency:minegeld_5"), + min_size = 1, + max_size = 50, + }, +}) + +loot.register_loot({ + weights = { generic = 50 }, + payload = { + stack = ItemStack("currency:minegeld_10"), + min_size = 1, + max_size = 10, + }, +}) \ No newline at end of file diff --git a/currency/safe.lua b/currency/safe.lua index 794e23a7..1c531844 100644 --- a/currency/safe.lua +++ b/currency/safe.lua @@ -1,3 +1,7 @@ +-- internationalization boilerplate +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP.."/intllib.lua") + function default.get_safe_formspec(pos) local spos = pos.x .. "," .. pos.y .. "," ..pos.z local formspec = @@ -22,12 +26,12 @@ local function has_safe_privilege(meta, player) end minetest.register_node("currency:safe", { - description = "Safe", + description = S("Safe"), inventory_image = "safe_front.png", paramtype = "light", paramtype2 = "facedir", tiles = {"safe_side.png", - "safe_side.png", + "safe_side.png", "safe_side.png", "safe_side.png", "safe_side.png", @@ -37,8 +41,7 @@ minetest.register_node("currency:safe", { after_place_node = function(pos, placer) local meta = minetest.get_meta(pos) meta:set_string("owner", placer:get_player_name() or "") - meta:set_string("infotext", "Safe (owned by ".. - meta:get_string("owner")..")") + meta:set_string("infotext", S("Safe (owned by @1)", meta:get_string("owner"))) end, on_construct = function(pos) local meta = minetest.get_meta(pos) @@ -55,10 +58,8 @@ minetest.register_node("currency:safe", { allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) local meta = minetest.get_meta(pos) if not has_safe_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a safe belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) + minetest.log("action", S("@1 tried to access a safe belonging to @2 at @3", + player:get_player_name(), meta:get_string("owner"), minetest.pos_to_string(pos))) return 0 end return count @@ -66,10 +67,8 @@ minetest.register_node("currency:safe", { allow_metadata_inventory_put = function(pos, listname, index, stack, player) local meta = minetest.get_meta(pos) if not has_safe_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a safe belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) + minetest.log("action", S("@1 tried to access a safe belonging to @2 at @3", + player:get_player_name(), meta:get_string("owner"), minetest.pos_to_string(pos))) return 0 end return stack:get_count() @@ -77,25 +76,20 @@ minetest.register_node("currency:safe", { allow_metadata_inventory_take = function(pos, listname, index, stack, player) local meta = minetest.get_meta(pos) if not has_safe_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a safe belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) + minetest.log("action", S("@1 tried to access a safe belonging to @2 at @3", + player:get_player_name(), meta:get_string("owner"), minetest.pos_to_string(pos))) return 0 end return stack:get_count() end, on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in safe at "..minetest.pos_to_string(pos)) + minetest.log("action", S("@1 moves stuff in safe at @2", player:get_player_name(), minetest.pos_to_string(pos))) end, on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to safe at "..minetest.pos_to_string(pos)) + minetest.log("action", S("@1 moves stuff to safe at @2", player:get_player_name(), minetest.pos_to_string(pos))) end, on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from safe at "..minetest.pos_to_string(pos)) + minetest.log("action", S("@1 takes stuff from safe at @2", player:get_player_name(), minetest.pos_to_string(pos))) end, on_rightclick = function(pos, node, clicker) local meta = minetest.get_meta(pos) diff --git a/currency/shop.lua b/currency/shop.lua index 36765a3b..301a08c3 100644 --- a/currency/shop.lua +++ b/currency/shop.lua @@ -1,38 +1,44 @@ +-- internationalization boilerplate +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP.."/intllib.lua") + default.shop = {} default.shop.current_shop = {} default.shop.formspec = { customer = function(pos) local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z local formspec = "size[8,9.5]".. - "label[0,0;Customer gives (pay here !)]".. + "label[0,0;" .. S("Customer gives (pay here!)") .. "]".. "list[current_player;customer_gives;0,0.5;3,2;]".. - "label[0,2.5;Customer gets]".. + "label[0,2.5;" .. S("Customer gets:") .. "]".. "list[current_player;customer_gets;0,3;3,2;]".. - "label[5,0;Owner wants]".. + "label[5,0;" .. S("Owner wants:") .. "]".. "list["..list_name..";owner_wants;5,0.5;3,2;]".. - "label[5,2.5;Owner gives]".. + "label[5,2.5;" .. S("Owner gives:") .. "]".. "list["..list_name..";owner_gives;5,3;3,2;]".. "list[current_player;main;0,5.5;8,4;]".. - "button[3,2;2,1;exchange;Exchange]" + "button[3,2;2,1;exchange;" .. S("Exchange") .. "]" return formspec end, owner = function(pos) local list_name = "nodemeta:"..pos.x..','..pos.y..','..pos.z local formspec = "size[8,9.5]".. - "label[0,0;Customers gave:]".. + "label[0,0;" .. S("Customers gave:") .. "]".. "list["..list_name..";customers_gave;0,0.5;3,2;]".. - "label[0,2.5;Your stock:]".. + "label[0,2.5;" .. S("Your stock:") .. "]".. "list["..list_name..";stock;0,3;3,2;]".. - "label[5,0;You want:]".. + "label[5,0;" .. S("You want:") .. "]".. "list["..list_name..";owner_wants;5,0.5;3,2;]".. - "label[5,2.5;In exchange, you give:]".. + "label[5,2.5;" .. S("In exchange, you give:") .. "]".. "list["..list_name..";owner_gives;5,3;3,2;]".. - "label[0,5;Owner, Use(E)+Place(RMB) for customer interface]".. + "label[0,5;" .. S("Owner, Use (E)+Place (right mouse button) for customer interface") .. "]".. "list[current_player;main;0,5.5;8,4;]" return formspec end, } +local have_pipeworks = minetest.global_exists("pipeworks") + default.shop.check_privilege = function(listname,playername,meta) --[[if listname == "pl1" then if playername ~= meta:get_string("pl1") then @@ -81,10 +87,10 @@ default.shop.exchange = function(meta) end minetest.register_node("currency:shop", { - description = "Shop", + description = S("Shop"), paramtype2 = "facedir", tiles = {"shop_top.png", - "shop_top.png", + "shop_top.png", "shop_side.png", "shop_side.png", "shop_side.png", @@ -95,7 +101,7 @@ minetest.register_node("currency:shop", { after_place_node = function(pos, placer, itemstack) local owner = placer:get_player_name() local meta = minetest.get_meta(pos) - meta:set_string("infotext", "Exchange shop (owned by "..owner..")") + meta:set_string("infotext", S("Exchange shop (owned by @1)", owner)) meta:set_string("owner",owner) --[[meta:set_string("pl1","") meta:set_string("pl2","")]] @@ -104,9 +110,9 @@ minetest.register_node("currency:shop", { inv:set_size("stock", 3*2) inv:set_size("owner_wants", 3*2) inv:set_size("owner_gives", 3*2) - if minetest.get_modpath("pipeworks") then pipeworks.after_place(pos) end + if have_pipeworks then pipeworks.after_place(pos) end end, - after_dig_node = (pipeworks and pipeworks.after_dig), + after_dig_node = (have_pipeworks and pipeworks and pipeworks.after_dig), tube = { insert_object = function(pos, node, stack, direction) local meta = minetest.get_meta(pos) @@ -160,7 +166,7 @@ minetest.register_on_player_receive_fields(function(sender, formname, fields) local pos = default.shop.current_shop[name] local meta = minetest.get_meta(pos) if meta:get_string("owner") == name then - minetest.chat_send_player(name,"This is your own shop, you can't exchange to yourself !") + minetest.chat_send_player(name,S("This is your own shop, you can't exchange to yourself!")) else local minv = meta:get_inventory() local pinv = sender:get_inventory() @@ -197,12 +203,12 @@ minetest.register_on_player_receive_fields(function(sender, formname, fields) minv:remove_item("stock",item) pinv:add_item("customer_gets",item) end - minetest.chat_send_player(name,"Exchanged!") + minetest.chat_send_player(name,S("Exchanged!")) else if owners_fault then - minetest.chat_send_player(name,"Exchange can not be done, contact the shop owner.") + minetest.chat_send_player(name,S("Exchange can not be done, contact the shop owner.")) else - minetest.chat_send_player(name,"Exchange can not be done, check if you put all items !") + minetest.chat_send_player(name,S("Exchange can not be done, check if you put all items!")) end end end diff --git a/dryplants/juncus.lua b/dryplants/juncus.lua index bfbf23c5..2ea094f7 100644 --- a/dryplants/juncus.lua +++ b/dryplants/juncus.lua @@ -25,7 +25,7 @@ end minetest.register_node("dryplants:juncus", { description = "Juncus", drawtype = "plantlike", - visual_scale = 2, + visual_scale = math.sqrt(8), paramtype = "light", tiles = {"dryplants_juncus_03.png"}, inventory_image = "dryplants_juncus_inv.png", @@ -67,7 +67,7 @@ minetest.register_node("dryplants:juncus", { minetest.register_node("dryplants:juncus_02", { description = "Juncus", drawtype = "plantlike", - visual_scale = 2, + visual_scale = math.sqrt(8), paramtype = "light", tiles = {"dryplants_juncus_02.png"}, walkable = false, diff --git a/dryplants/reedmace.lua b/dryplants/reedmace.lua index 9547c7a0..b01e118f 100644 --- a/dryplants/reedmace.lua +++ b/dryplants/reedmace.lua @@ -125,7 +125,7 @@ minetest.register_node("dryplants:reedmace_top", { minetest.register_node("dryplants:reedmace_height_2", { description = "Reedmace, height: 2", drawtype = "plantlike", - visual_scale = 2, + visual_scale = math.sqrt(8), paramtype = "light", tiles = {"dryplants_reedmace_height_2.png"}, inventory_image = "dryplants_reedmace_top.png", @@ -148,7 +148,7 @@ minetest.register_node("dryplants:reedmace_height_2", { minetest.register_node("dryplants:reedmace_height_3", { description = "Reedmace, height: 3", drawtype = "plantlike", - visual_scale = 2, + visual_scale = math.sqrt(8), paramtype = "light", tiles = {"dryplants_reedmace_height_3.png"}, inventory_image = "dryplants_reedmace_top.png", @@ -171,7 +171,7 @@ minetest.register_node("dryplants:reedmace_height_3", { minetest.register_node("dryplants:reedmace_height_3_spikes", { description = "Reedmace, height: 3 & Spikes", drawtype = "plantlike", - visual_scale = 2, + visual_scale = math.sqrt(8), paramtype = "light", tiles = {"dryplants_reedmace_height_3_spikes.png"}, inventory_image = "dryplants_reedmace_top.png", diff --git a/extranodes/locale/es.txt b/extranodes/locale/es.txt new file mode 100644 index 00000000..8b282183 --- /dev/null +++ b/extranodes/locale/es.txt @@ -0,0 +1,7 @@ +# technic_extranodes traducido por Carlos Barraza + +Marble = Mármol +Marble Bricks = Ladrillos de mármol +Granite = Granito +Concrete = Concreto + diff --git a/farming/README.txt b/farming/README.txt index 811a5353..95c8154d 100644 --- a/farming/README.txt +++ b/farming/README.txt @@ -13,6 +13,8 @@ This mod works by adding your new plant to the {growing=1} group and numbering t Changelog: +1.25 - Added check for farming.conf setting file to disable specific crops globally (inside mod folder) or world specific (inside world folder) +1.24 - Added Hemp which can be crafted into fibre, paper, string, rope and oil. 1.23 - Huge code tweak and tidy done and added barley seeds to be found in dry grass, barley can make flour for bread also. 1.22 - Added grape bushes at high climates which can be cultivated into grape vines using trellis (9 sticks). 1.21 - Added auto-refill code for planting crops (thanks crabman77), also fixed a few bugs @@ -45,7 +47,7 @@ Changelog: 0.1 - Fixed growing bug 0.0 - Initial release -Lucky Blocks: 10 (plus 3 for default farming items) +Lucky Blocks: 11 (plus 3 for default farming items) License of media (textures): @@ -150,4 +152,5 @@ Created by TenPlus1 farming_rhubarb_2.png farming_rhubarb_3.png farming_rhubarb.png - farming_rhubarb_pie.png \ No newline at end of file + farming_rhubarb_pie.png + farming_hemp*.png diff --git a/farming/beanpole.lua b/farming/beanpole.lua index f06aea5f..fd933837 100644 --- a/farming/beanpole.lua +++ b/farming/beanpole.lua @@ -6,6 +6,60 @@ local S = farming.intllib +-- place beans +function place_beans(itemstack, placer, pointed_thing, plantname) + + local pt = pointed_thing + + -- check if pointing at a node + if not pt or pt.type ~= "node" then + + return + end + + local under = minetest.get_node(pt.under) + + -- return if any of the nodes are not registered + if not minetest.registered_nodes[under.name] then + return + end + + -- am I right-clicking on something that has a custom on_place set? + -- thanks to Krock for helping with this issue :) + local def = minetest.registered_nodes[under.name] + if def and def.on_rightclick then + return def.on_rightclick(pt.under, under, placer, itemstack) + end + + -- check if pointing at bean pole + if under.name ~= "farming:beanpole" then + return + end + + -- add the node and remove 1 item from the itemstack + minetest.set_node(pt.under, {name = plantname}) + + minetest.sound_play("default_place_node", {pos = pt.under, gain = 1.0}) + + if not minetest.setting_getbool("creative_mode") then + + itemstack:take_item() + + -- check for refill + if itemstack:get_count() == 0 then + + minetest.after(0.20, + farming.refill_plant, + placer, + "farming:beans", + placer:get_wield_index() + ) + end + end + + return itemstack +end + -- beans minetest.register_craftitem("farming:beans", { description = S("Green Beans"), @@ -13,39 +67,8 @@ minetest.register_craftitem("farming:beans", { on_use = minetest.item_eat(1), on_place = function(itemstack, placer, pointed_thing) - - if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then - return - end - - local nodename = minetest.get_node(pointed_thing.under).name - - if nodename == "farming:beanpole" then - minetest.set_node(pointed_thing.under, {name = "farming:beanpole_1"}) - - minetest.sound_play("default_place_node", {pos = pointed_thing.above, gain = 1.0}) - else - return - end - - if not minetest.setting_getbool("creative_mode") then - - itemstack:take_item() - - -- check for refill - if itemstack:get_count() == 0 then - - minetest.after(0.20, - farming.refill_plant, - placer, - "farming:beans", - placer:get_wield_index() - ) - end - end - - return itemstack - end + return place_beans(itemstack, placer, pointed_thing, "farming:beanpole_1") + end, }) -- beans can be used for green dye diff --git a/farming/compatibility.lua b/farming/compatibility.lua index 4354e60a..b7c906c8 100644 --- a/farming/compatibility.lua +++ b/farming/compatibility.lua @@ -140,3 +140,17 @@ minetest.register_alias("farming_plus:tomato", "farming:tomato_8") -- Weed minetest.register_alias("farming:weed", "default:grass_2") + +-- Classic Bushes compatibility +if minetest.get_modpath("bushes_classic") then + + if eth then + minetest.register_alias("bushes:strawberry", "farming:strawberry") + else + minetest.register_alias("bushes:strawberry", "farming:raspberries") + end + + minetest.register_alias("bushes:blueberry", "farming:blueberries") + minetest.register_alias("bushes:raspberry", "farming:raspberries") + +end \ No newline at end of file diff --git a/farming/corn.lua b/farming/corn.lua index 3c27ea3e..402ec828 100644 --- a/farming/corn.lua +++ b/farming/corn.lua @@ -31,9 +31,21 @@ minetest.register_craft({ }) -- ethanol (thanks to JKMurray for this idea) -minetest.register_craftitem("farming:bottle_ethanol", { +minetest.register_node("farming:bottle_ethanol", { description = S("Bottle of Ethanol"), + drawtype = "plantlike", + tiles = {"farming_bottle_ethanol.png"}, inventory_image = "farming_bottle_ethanol.png", + wield_image = "farming_bottle_ethanol.png", + paramtype = "light", + is_ground_content = false, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} + }, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_glass_defaults(), }) minetest.register_craft( { diff --git a/farming/cucumber.lua b/farming/cucumber.lua index 8e292154..eb29347b 100644 --- a/farming/cucumber.lua +++ b/farming/cucumber.lua @@ -48,7 +48,7 @@ crop_def.tiles = {"farming_cucumber_4.png"} crop_def.groups.growing = 0 crop_def.drop = { items = { - {items = {'farming:cucumber'}, rarity = 1}, + {items = {'farming:cucumber 2'}, rarity = 1}, {items = {'farming:cucumber 2'}, rarity = 2}, } } diff --git a/farming/farming.conf_example b/farming/farming.conf_example new file mode 100644 index 00000000..696d0079 --- /dev/null +++ b/farming/farming.conf_example @@ -0,0 +1,27 @@ + +--[[ + Farming settings can be changed here and kept inside mod folder + even after the mod has been updated, or you can place inside + world folder for map specific settings. +--]] + +-- true to enable crop/food in-game and on mapgen +farming.carrot = true +farming.potato = true +farming.tomato = true +farming.cucumber = true +farming.corn = true +farming.coffee = true +farming.coffee = true +farming.melon = true +farming.sugar = true +farming.pumpkin = true +farming.cocoa = true +farming.raspberry = true +farming.blueberry = true +farming.rhubarb = true +farming.beans = true +farming.grapes = true +farming.barley = true +farming.hemp = true +farming.donuts = true diff --git a/farming/hemp.lua b/farming/hemp.lua new file mode 100644 index 00000000..29b6a42d --- /dev/null +++ b/farming/hemp.lua @@ -0,0 +1,213 @@ + +local S = farming.intllib + +-- hemp seeds +minetest.register_node("farming:seed_hemp", { + description = S("Hemp Seed"), + tiles = {"farming_hemp_seed.png"}, + inventory_image = "farming_hemp_seed.png", + wield_image = "farming_hemp_seed.png", + drawtype = "signlike", + groups = {seed = 1, snappy = 3, attached_node = 1}, + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + sunlight_propagates = true, + selection_box = farming.select, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:hemp_1") + end, +}) + +-- harvested hemp +minetest.register_craftitem("farming:hemp_leaf", { + description = S("Hemp Leaf"), + inventory_image = "farming_hemp_leaf.png", +}) + +-- hemp oil +minetest.register_node("farming:hemp_oil", { + description = S("Bottle of Hemp Oil"), + drawtype = "plantlike", + tiles = {"farming_hemp_oil.png"}, + inventory_image = "farming_hemp_oil.png", + wield_image = "farming_hemp_oil.png", + paramtype = "light", + is_ground_content = false, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} + }, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_craft( { + output = "farming:hemp_oil", + recipe = { + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}, + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}, + {"", "vessels:glass_bottle", ""} + } +}) + +minetest.register_craft( { + output = "farming:hemp_oil", + recipe = { + {"farming:seed_hemp", "farming:seed_hemp", "farming:seed_hemp"}, + {"farming:seed_hemp", "farming:seed_hemp", "farming:seed_hemp"}, + {"farming:seed_hemp", "vessels:glass_bottle", "farming:seed_hemp"} + } +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:hemp_oil", + burntime = 20, + replacements = {{ "farming:hemp_oil", "vessels:glass_bottle"}} +}) + +-- hemp fibre +minetest.register_craftitem("farming:hemp_fibre", { + description = S("Hemp Fibre"), + inventory_image = "farming_hemp_fibre.png", +}) + +minetest.register_craft( { + output = "farming:hemp_fibre 8", + recipe = { + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}, + {"farming:hemp_leaf", "bucket:bucket_water", "farming:hemp_leaf"}, + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"} + }, + replacements = {{ "bucket:bucket_water", "bucket:bucket_empty"}} +}) + +minetest.register_craft( { + output = "farming:hemp_fibre 8", + recipe = { + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}, + {"farming:hemp_leaf", "bucket:bucket_river_water", "farming:hemp_leaf"}, + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"} + }, + replacements = {{ "bucket:bucket_river_water", "bucket:bucket_empty"}} +}) + +-- paper +minetest.register_craft( { + output = "default:paper", + recipe = { + {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}, + } +}) + +-- string +minetest.register_craft( { + output = "farming:cotton", + recipe = { + {"farming:hemp_fibre"}, + {"farming:hemp_fibre"}, + {"farming:hemp_fibre"}, + } +}) + +-- hemp rope +minetest.register_node("farming:hemp_rope", { + description = S("Hemp Rope"), + walkable = false, + climbable = true, + sunlight_propagates = true, + paramtype = "light", + tiles = {"farming_hemp_rope.png"}, + wield_image = "farming_hemp_rope.png", + inventory_image = "farming_hemp_rope.png", + drawtype = "plantlike", + groups = {flammable = 2, choppy = 3, oddly_breakable_by_hand = 3}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, + }, +}) + +-- string +minetest.register_craft( { + output = "farming:hemp_rope 6", + recipe = { + {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}, + {"farming:cotton", "farming:cotton", "farming:cotton"}, + {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}, + } +}) + +-- hemp definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_hemp_1.png"}, + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:hemp_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_hemp_2.png"} +minetest.register_node("farming:hemp_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_hemp_3.png"} +minetest.register_node("farming:hemp_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"farming_hemp_4.png"} +minetest.register_node("farming:hemp_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"farming_hemp_5.png"} +minetest.register_node("farming:hemp_5", table.copy(crop_def)) + +-- stage 6 +crop_def.tiles = {"farming_hemp_6.png"} +crop_def.drop = { + items = { + {items = {'farming:hemp_leaf'}, rarity = 2}, + {items = {'farming:seed_hemp'}, rarity = 1}, + } +} +minetest.register_node("farming:hemp_6", table.copy(crop_def)) + +-- stage 7 +crop_def.tiles = {"farming_hemp_7.png"} +crop_def.drop = { + items = { + {items = {'farming:hemp_leaf'}, rarity = 1}, + {items = {'farming:hemp_leaf'}, rarity = 3}, + {items = {'farming:seed_hemp'}, rarity = 1}, + {items = {'farming:seed_hemp'}, rarity = 3}, + } +} +minetest.register_node("farming:hemp_7", table.copy(crop_def)) + +-- stage 8 (final) +crop_def.tiles = {"farming_hemp_8.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {'farming:hemp_leaf 2'}, rarity = 1}, + {items = {'farming:hemp_leaf'}, rarity = 2}, + {items = {'farming:seed_hemp'}, rarity = 1}, + {items = {'farming:seed_hemp'}, rarity = 2}, + } +} +minetest.register_node("farming:hemp_8", table.copy(crop_def)) diff --git a/farming/init.lua b/farming/init.lua index 2d64f61f..07e935c8 100644 --- a/farming/init.lua +++ b/farming/init.lua @@ -1,5 +1,5 @@ --[[ - Minetest Farming Redo Mod 1.23 (12th November 2016) + Farming Redo Mod 1.25 (6th May 2017) by TenPlus1 NEW growing routine by prestidigitator auto-refill by crabman77 @@ -14,38 +14,6 @@ farming.select = { fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5} } -farming.DEBUG = false --- farming.DEBUG = {} -- Uncomment to turn on profiling code/functions - -local DEBUG_abm_runs = 0 -local DEBUG_abm_time = 0 -local DEBUG_timer_runs = 0 -local DEBUG_timer_time = 0 - -if farming.DEBUG then - - function farming.DEBUG.reset_times() - DEBUG_abm_runs = 0 - DEBUG_abm_time = 0 - DEBUG_timer_runs = 0 - DEBUG_timer_time = 0 - end - - function farming.DEBUG.report_times() - - local abm_n = DEBUG_abm_runs - local abm_dt = DEBUG_abm_time - local abm_avg = (abm_n > 0 and abm_dt / abm_n) or 0 - local timer_n = DEBUG_timer_runs - local timer_dt = DEBUG_timer_time - local timer_avg = (timer_n > 0 and timer_dt / timer_n) or 0 - local dt = abm_dt + timer_dt - - print("ABM ran for "..abm_dt.."µs over "..abm_n.." runs: "..abm_avg.."µs/run") - print("Timer ran for "..timer_dt.."µs over "..timer_n.." runs: "..timer_avg.."µs/run") - print("Total farming time: "..dt.."µs") - end -end local statistics = dofile(farming.path.."/statistics.lua") @@ -353,23 +321,6 @@ end) local abm_func = farming.handle_growth -if farming.DEBUG then - - local normal_abm_func = abm_func - - abm_func = function(...) - - local t0 = minetest.get_us_time() - local r = { normal_abm_func(...) } - local t1 = minetest.get_us_time() - - DEBUG_abm_runs = DEBUG_abm_runs + 1 - DEBUG_abm_time = DEBUG_abm_time + (t1 - t0) - - return unpack(r) - end -end - -- Just in case a growing type or added node is missed (also catches existing -- nodes added to map before timers were incorporated). @@ -399,8 +350,7 @@ function farming.plant_growth_timer(pos, elapsed, node_name) if stages.plant_name == "farming:cocoa" then - if not minetest.find_node_near(pos, 1, - {"default:jungletree", "moretrees:jungletree_leaves_green"}) then + if not minetest.find_node_near(pos, 1, {"default:jungletree"}) then return true end @@ -465,23 +415,6 @@ function farming.plant_growth_timer(pos, elapsed, node_name) return growth ~= max_growth end -if farming.DEBUG then - - local timer_func = farming.plant_growth_timer; - - farming.plant_growth_timer = function(pos, elapsed, node_name) - - local t0 = minetest.get_us_time() - local r = { timer_func(pos, elapsed, node_name) } - local t1 = minetest.get_us_time() - - DEBUG_timer_runs = DEBUG_timer_runs + 1 - DEBUG_timer_time = DEBUG_timer_time + (t1 - t0) - - return unpack(r) - end -end - -- refill placed plant by crabman (26/08/2015) local can_refill_plant = { ["farming:blueberry_1"] = "farming:blueberries", @@ -502,6 +435,7 @@ local can_refill_plant = { ["farming:rhubarb_1"] = "farming:rhubarb", ["farming:cocoa_1"] = "farming:cocoa_beans", ["farming:barley_1"] = "farming:seed_barley", + ["farming:hemp_1"] = "farming:seed_hemp", } function farming.refill_plant(player, plantname, index) @@ -595,7 +529,7 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname) end end --- Function to register plants (for compatibility) +-- Function to register plants (default farming compatibility) farming.register_plant = function(name, def) @@ -680,7 +614,7 @@ farming.register_plant = function(name, def) sounds = default.node_sound_leaves_defaults(), }) --- register_plant_node(node_name) + register_plant_node(node_name) end -- Return info @@ -688,30 +622,71 @@ farming.register_plant = function(name, def) return r end --- load crops +-- default settings +farming.carrot = true +farming.potato = true +farming.tomato = true +farming.cucumber = true +farming.corn = true +farming.coffee = true +farming.coffee = true +farming.melon = true +farming.sugar = true +farming.pumpkin = true +farming.cocoa = true +farming.raspberry = true +farming.blueberry = true +farming.rhubarb = true +farming.beans = true +farming.grapes = true +farming.barley = true +farming.hemp = true +farming.donuts = true + + +-- Load new global settings if found inside mod folder +local input = io.open(farming.path.."/farming.conf", "r") +if input then + dofile(farming.path .. "/farming.conf") + input:close() + input = nil +end + +-- load new world-specific settings if found inside world folder +local worldpath = minetest.get_worldpath() +local input = io.open(worldpath.."/farming.conf", "r") +if input then + dofile(worldpath .. "/farming.conf") + input:close() + input = nil +end + + +-- load crops dofile(farming.path.."/soil.lua") dofile(farming.path.."/hoes.lua") dofile(farming.path.."/grass.lua") dofile(farming.path.."/wheat.lua") dofile(farming.path.."/cotton.lua") -dofile(farming.path.."/carrot.lua") -dofile(farming.path.."/potato.lua") -dofile(farming.path.."/tomato.lua") -dofile(farming.path.."/cucumber.lua") -dofile(farming.path.."/corn.lua") -dofile(farming.path.."/coffee.lua") -dofile(farming.path.."/melon.lua") -dofile(farming.path.."/sugar.lua") -dofile(farming.path.."/pumpkin.lua") -dofile(farming.path.."/cocoa.lua") -dofile(farming.path.."/raspberry.lua") -dofile(farming.path.."/blueberry.lua") -dofile(farming.path.."/rhubarb.lua") -dofile(farming.path.."/beanpole.lua") -dofile(farming.path.."/grapes.lua") -dofile(farming.path.."/barley.lua") -dofile(farming.path.."/donut.lua") +if farming.carrot then dofile(farming.path.."/carrot.lua") end +if farming.potato then dofile(farming.path.."/potato.lua") end +if farming.tomato then dofile(farming.path.."/tomato.lua") end +if farming.cucumber then dofile(farming.path.."/cucumber.lua") end +if farming.corn then dofile(farming.path.."/corn.lua") end +if farming.coffee then dofile(farming.path.."/coffee.lua") end +if farming.melon then dofile(farming.path.."/melon.lua") end +if farming.sugar then dofile(farming.path.."/sugar.lua") end +if farming.pumpkin then dofile(farming.path.."/pumpkin.lua") end +if farming.cocoa then dofile(farming.path.."/cocoa.lua") end +if farming.raspberry then dofile(farming.path.."/raspberry.lua") end +if farming.blueberry then dofile(farming.path.."/blueberry.lua") end +if farming.rhubarb then dofile(farming.path.."/rhubarb.lua") end +if farming.beans then dofile(farming.path.."/beanpole.lua") end +if farming.grapes then dofile(farming.path.."/grapes.lua") end +if farming.barley then dofile(farming.path.."/barley.lua") end +if farming.hemp then dofile(farming.path.."/hemp.lua") end +if farming.donuts then dofile(farming.path.."/donut.lua") end dofile(farming.path.."/mapgen.lua") dofile(farming.path.."/compatibility.lua") -- Farming Plus compatibility dofile(farming.path.."/lucky_block.lua") diff --git a/farming/locale/de.txt b/farming/locale/de.txt index 82cee4f1..9b85a046 100644 --- a/farming/locale/de.txt +++ b/farming/locale/de.txt @@ -74,7 +74,7 @@ Baked Potato = Ofenkartoffel #pumpkin.lua Pumpkin = Kürbis Pumpkin Slice = Kürbisscheibe -Jack 'O Lantern = Kürbislaterne +Jack 'O Lantern (punch to turn on and off) = Kürbislaterne (Punch zum Ein- und Ausschalten) Pumpkin Bread = Kürbisbrot Pumpkin Dough = Kürbisteig diff --git a/farming/locale/template.txt b/farming/locale/template.txt index 6d067f58..3f527304 100644 --- a/farming/locale/template.txt +++ b/farming/locale/template.txt @@ -72,7 +72,7 @@ Baked Potato = #pumpkin.lua Pumpkin = Pumpkin Slice = -Jack 'O Lantern = +Jack 'O Lantern (punch to turn on and off) = Pumpkin Bread = Pumpkin Dough = diff --git a/farming/lucky_block.lua b/farming/lucky_block.lua index df5c54fb..94d7d366 100644 --- a/farming/lucky_block.lua +++ b/farming/lucky_block.lua @@ -14,5 +14,6 @@ if minetest.get_modpath("lucky_block") then {"dro", {"farming:bottle_ethanol"}, 1}, {"nod", "farming:melon", 0}, {"dro", {"farming:donut", "farming:donut_chocolate", "farming:donut_apple"}, 5}, + {"dro", {"farming:hemp_leaf", "farming:hemp_fibre", "farming:seed_hemp"}, 5}, }) end diff --git a/farming/mapgen.lua b/farming/mapgen.lua index 36d4792a..090c1938 100644 --- a/farming/mapgen.lua +++ b/farming/mapgen.lua @@ -1,5 +1,11 @@ + -- decoration function -local function register_plant(name, min, max, spawnby, num) +local function register_plant(name, min, max, spawnby, num, enabled) + + if enabled ~= true then + return + end + minetest.register_decoration({ deco_type = "simple", place_on = {"default:dirt_with_grass"}, @@ -20,46 +26,50 @@ local function register_plant(name, min, max, spawnby, num) }) end -function farming.register_mgv6_decorations() - register_plant("potato_3", 15, 40, "", -1) - register_plant("tomato_7", 5, 20, "", -1) - register_plant("carrot_8", 1, 30, "group:water", 1) - register_plant("cucumber_4", 1, 20, "group:water", 1) - register_plant("corn_7", 12, 22, "", -1) - register_plant("corn_8", 10, 20, "", -1) - register_plant("coffee_5", 20, 45, "", -1) - register_plant("melon_8", 1, 20, "group:water", 1) - register_plant("pumpkin_8", 1, 20, "group:water", 1) - register_plant("raspberry_4", 3, 10, "", -1) - register_plant("rhubarb_3", 3, 15, "", -1) - register_plant("blueberry_4", 3, 10, "", -1) - register_plant("beanbush", 18, 35, "", -1) - register_plant("grapebush", 25, 45, "", -1) -end --- v7 maps have a beach so plants growing near water is limited to 6 high -function farming.register_mgv7_decorations() - register_plant("potato_3", 15, 40, "", -1) - register_plant("tomato_7", 5, 20, "", -1) - register_plant("carrot_8", 1, 6, "", -1) - register_plant("cucumber_4", 1, 6, "", -1) - register_plant("corn_7", 12, 22, "", -1) - register_plant("corn_8", 10, 20, "", -1) - register_plant("coffee_5", 20, 45, "", -1) - register_plant("melon_8", 1, 6, "", -1) - register_plant("pumpkin_8", 1, 6, "", -1) - register_plant("raspberry_4", 3, 10, "", -1) - register_plant("rhubarb_3", 3, 15, "", -1) - register_plant("blueberry_4", 3, 10, "", -1) - register_plant("beanbush", 18, 35, "", -1) - register_plant("grapebush", 25, 45, "", -1) -end +-- add crops to mapgen +register_plant("potato_3", 15, 40, "", -1, farming.potato) +register_plant("tomato_7", 5, 20, "", -1, farming.tomato) +register_plant("corn_7", 12, 22, "", -1, farming.corn) +register_plant("coffee_5", 20, 45, "", -1, farming.coffee) +register_plant("raspberry_4", 3, 10, "", -1, farming.raspberry) +register_plant("rhubarb_3", 3, 15, "", -1, farming.rhubarb) +register_plant("blueberry_4", 3, 10, "", -1, farming.blueberry) +register_plant("beanbush", 18, 35, "", -1, farming.beans) +register_plant("grapebush", 25, 45, "", -1, farming.grapes) --- detect mapgen -local mg_name = minetest.get_mapgen_params().mgname -if mg_name == "v6" then - farming.register_mgv6_decorations() +if minetest.get_mapgen_params().mgname == "v6" then + + register_plant("carrot_8", 1, 30, "group:water", 1, farming.carrot) + register_plant("cucumber_4", 1, 20, "group:water", 1, farming.cucumber) + register_plant("melon_8", 1, 20, "group:water", 1, farming.melon) + register_plant("pumpkin_8", 1, 20, "group:water", 1, farming.pumpkin) else - farming.register_mgv7_decorations() + -- v7 maps have a beach so plants growing near water is limited to 6 high + register_plant("carrot_8", 1, 6, "", -1, farming.carrot) + register_plant("cucumber_4", 1, 6, "", -1, farming.cucumber) + register_plant("melon_8", 1, 6, "", -1, farming.melon) + register_plant("pumpkin_8", 1, 6, "", -1, farming.pumpkin) +end + +if farming.hemp then +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass", "default:dirt_with_rainforest_litter"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.06, + spread = {x = 100, y = 100, z = 100}, + seed = 420, + octaves = 3, + persist = 0.6 + }, + y_min = 5, + y_max = 35, + decoration = "farming:hemp_7", + spawn_by = "group:tree", + num_spawn_by = 1, +}) end diff --git a/farming/pumpkin.lua b/farming/pumpkin.lua index 4be0bf4a..8bff7789 100644 --- a/farming/pumpkin.lua +++ b/farming/pumpkin.lua @@ -53,7 +53,7 @@ minetest.register_craft({ -- jack 'o lantern minetest.register_node("farming:jackolantern", { - description = S("Jack 'O Lantern"), + description = S("Jack 'O Lantern (punch to turn on and off)"), tiles = { "farming_pumpkin_top.png", "farming_pumpkin_top.png", diff --git a/farming/textures/farming_hemp_1.png b/farming/textures/farming_hemp_1.png new file mode 100644 index 0000000000000000000000000000000000000000..6fb45108273f62dab7619fc6de9058858a9cc969 GIT binary patch literal 115 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9oB=)|t_%$647rR9jjV3-gth|( z8B2ovf*Bm1-ADs+Bs^UlLpZJ{CoEvmXyE8$Q#kmHK}AARf`RKb!w2_08FD~144$rj JF6*2Ung9?I8g&2w literal 0 HcmV?d00001 diff --git a/farming/textures/farming_hemp_2.png b/farming/textures/farming_hemp_2.png new file mode 100644 index 0000000000000000000000000000000000000000..a676173cc121e25ad11a1ba92c14f3bf604443db GIT binary patch literal 122 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9JOMr-uBp1|47rTfan=lttX*GT zX8^?+OM?7@862M7NCR?YJY5_^IIbrrC*kHxL>Bh#!AasziV*6pC QexN!APgg&ebxsLQ03=Nu`Tzg` literal 0 HcmV?d00001 diff --git a/farming/textures/farming_hemp_3.png b/farming/textures/farming_hemp_3.png new file mode 100644 index 0000000000000000000000000000000000000000..57136d5072aa265a9527dfac39d6cc5e2d5ba123 GIT binary patch literal 129 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9JOMr-uBp1|47rTfan=lttX*GT zX8^?+OM?7@862M7NCR?|JzX3_IIbrrD2SclVBq}5rf`tskx?UuGqZwXIitr0D+d(@ Y?K4b1az76&0xDl8?e70Tsn^Mvo0v b4k`?x8q6izX8*Yf)WP8C>gTe~DWM4fZ;&A$ literal 0 HcmV?d00001 diff --git a/farming/textures/farming_hemp_5.png b/farming/textures/farming_hemp_5.png new file mode 100644 index 0000000000000000000000000000000000000000..890a3d28e9486272f4f8c62a6bd9d0a78bf87918 GIT binary patch literal 142 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9JOMr-uBp1|47rTfan=lttX*GT zX8^?+OM?7@862M7NCR>VJY5_^IIbrr9N?6YZaBgiuMoI_)#C&U183O;31tCe`A4ji lTGbq!-Z4!`C~fdyU^uD97WB(&`a+;y22WQ%mvv4FO#l-7C7b{N literal 0 HcmV?d00001 diff --git a/farming/textures/farming_hemp_6.png b/farming/textures/farming_hemp_6.png new file mode 100644 index 0000000000000000000000000000000000000000..258d4e3815f596d725cf2d1a6c19bd3fa99a7ce4 GIT binary patch literal 148 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9JOMr-uBp1|47rTfan=lttX*GT zX8^?+OM?7@862M7NCR@rJY5_^IIbrrI53-;IW*Zaco>*5e`JhTSe?KLJY5_^IIbrrB&7T}aG>Tz0S|M2qdqrt_ZcxZHnwjK{5*ep z&KmM8V{b@eVpTAl$uPl%nK_{8Cqwf~#d}O_jZVUhY-~HZ9XP|-6%L*_z`!u2nlJi& T>FZfQvl%>H{an^LB{Ts5IB7CX literal 0 HcmV?d00001 diff --git a/farming/textures/farming_hemp_fibre.png b/farming/textures/farming_hemp_fibre.png new file mode 100644 index 0000000000000000000000000000000000000000..fe3c9187ef0e0d751ca94ea5078ac23b368d3b14 GIT binary patch literal 144 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9JOMr-uBp1|47rTfan=lttX*GT zX8^?+OM?7@862M7NCR?=JY5_^IIbrrC@>Z1G6<~_bx3+;%*M9tMyA6eqdkp{pI-(m o7}i!XF_*{OVP;!);sh(hV{PvDF;Ti-fw~zyUHx3vIVCg!0J)?n^#A|> literal 0 HcmV?d00001 diff --git a/farming/textures/farming_hemp_leaf.png b/farming/textures/farming_hemp_leaf.png new file mode 100644 index 0000000000000000000000000000000000000000..997c8f0cd73688c33f89d20d2bb5e78731db87d9 GIT binary patch literal 172 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9JOMr-uBp1|47rTfan=lttX*GT zX8^?+OM?7@862M7NCR^GJY5_^IIbrrBv>3c(BNWV&5-$wfvt_{A43{jW>uH@nQ7A7qru}`=9Yh$CKhe=CgV`n2H!^T8mYpVnX Pko63nu6{1-oD!M)fl)HSs!N#qp zPwlnezWemS!s01O+|=PKS(deSK^k zt38>to*rOK-O=WpvF*YIrjWMmj0_33!#u0hBo?(DT+Hmjz`(D-&H7jE=PjTS44$rj JF6*2UngF~sH;@1T literal 0 HcmV?d00001 diff --git a/farming/textures/farming_hemp_rope.png b/farming/textures/farming_hemp_rope.png new file mode 100644 index 0000000000000000000000000000000000000000..03a7082ff3a0d69445172c3ff65c2d3c2625a7ab GIT binary patch literal 122 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9JOMr-uBp1|hNf)Iy+SjWi7L$5 z6Au(;ED7=pW^j0RBMr!r@pN$v;kcfhknsD^fddDu7(F(yGjP7-c4(?GWH@Bc?Rqon RkS|ajgQu&X%Q~loCIGt-Au<2} literal 0 HcmV?d00001 diff --git a/farming/textures/farming_hemp_seed.png b/farming/textures/farming_hemp_seed.png new file mode 100644 index 0000000000000000000000000000000000000000..6be42c8607dc7e118b5493ae531668ed0031a823 GIT binary patch literal 147 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPHV5AX?bO)b&o$z|YbWXZ`@uB%qs z~85ATGG#ao;&Tio!4y1*gfi=)(U02l}E`sadQ^Om5CT6nq^R zm_fxKlGIvDk`#vL6~Jpa16Xy<0F(9O4i;vBXKoI_?&~H=UG)(F!n@u9VoqxSkc|UC zZNI|+Zrd~gY-tR-cE2=TBq_wtI{{eFFM#lAM1bhA09g8q4mhxEK7Tu2?iWc?RWg86 t=^0?e^=bf3!vV_piMD@u0N9=!{sDZ+fGg&J_K! zna}!zHQE`FxghirV$UG%Y06MOTZhuNoZidz`NbMhzY+6(^|8|q$Ss`Ev}=UdJb_vt zkUEOgzpz{00q*n~zv~u|9;N|{;n?px!Ldz|4%R=c&uT$jO(%!>Qwu~~!*P06$h96b cv~n!)4|DHFQpYX(?f?J)07*qoM6N<$f_@!U1^@s6 diff --git a/homedecor/textures/homedecor_bathroom_tiles_fg.png b/homedecor/textures/homedecor_bathroom_tiles_fg.png index a00c3a8e6f03b631418f6a8c454a6967c8d3821e..bf19c5bf3eb42aefe98e840dcd53b50f03f392ed 100644 GIT binary patch delta 220 zcmV<203-i{0{8)tB!9n2L_t(2&sEUTa)TfcM&S=ejpjc_l$)zfd49VOp8 z$IfJ}UN*?)le38BC}iYn*e1K_wAFY?ayclR9teuBJ$owj?p5cSY=Yazq7TE_5L~FD zB4X`fve|^AVK!(*VJ`6ScX+r;=-(bznaV@wDH+eGX#Mc8;PuDuAxUOkC2BP55B>+J W5KmClXA|rI00006reU}V9_{5z9LI(c@I zwCSp0CweB{xws*)Fmb2f2{BMOxM0KhqTnx_nCa+TFcT@1zhJC3dzDH0sXGK7Bx0?F zVN8zu2L^=ZbD6+e4Us#c>3wD!$KqRmsy7r?*e5RJYD@<);T3K0RW6D8PNa$ delta 119 zcma#;WSk&T$iV;vRx=jt1yTW?E{-7*myez~$lKt+;c}7RG3VgF>dl?85jLF{+2%Yx z{lxp@yieQ`2VSPFkvY!$E^p0Go1ELCOLi?>*6>nY>rz0Z!@9hbp58eZ4I&+nGVEaZ WyIN9>!Tpv7$PQ0eKbLh*2~7Zs@G?FC diff --git a/homedecor/textures/homedecor_glowlight_cube_sides_ceiling.png b/homedecor/textures/homedecor_glowlight_cube_sides_ceiling.png index 0f2fb3df9f931b45a736b642ade060ce65b32697..79608282f18473ec285a7be7e8c7b40160b6b70b 100644 GIT binary patch delta 75 zcmeBXjGZ9i%E-*Xz@TcIs|2Lj0(?STA3uKl|NsAa+m~tpMT9(E978y+C;vEbzCrZw d|9(+MhKG;EUrN`1vj)mCc)I$ztaD0e0szQK8-oA< delta 121 zcma#;W}F~V%)tNzRx=jt1yVttE{-7*m-n7ID0o;wfaRdwfg=z891i9vVA|g!+W7ru zsP)FeuVO~erFpCBLyJGOUX!l98?Ye6rI)$dT6=?#_Vvs&H(bxz7~FAv)=+V$zW4uO Y_WaG#LR|OHs(@_qboFyt=akR{0E=)kAOHXW diff --git a/homedecor/textures/homedecor_glowlight_cube_sides_ceiling_overlay.png b/homedecor/textures/homedecor_glowlight_cube_sides_ceiling_overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..b50bec0345a7500cee5385f33fe2256dedab2230 GIT binary patch literal 209 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Gdx`!Lo80eov@MbkO2?t`3~FI zh=nK5ojCS@#nyR^!UX}2tn&`=?&vyk^j&`Ca`tage(8(5zopr0JyeM9smFU literal 0 HcmV?d00001 diff --git a/homedecor/textures/homedecor_glowlight_cube_sides_overlay.png b/homedecor/textures/homedecor_glowlight_cube_sides_overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..4db5867493dc965bf58251d87f79c9aa364cd1d4 GIT binary patch literal 208 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`(>+}rLo80eooL8?$UvZVe@FJC z2Pr_ zIjSe5D%b3JIk%pX=Rja}v}3$gG<%1~mwSuZXV)fsY3hBq?_R0NeEVp!8_zopr0013TLjV8( literal 0 HcmV?d00001 diff --git a/homedecor/textures/homedecor_glowlight_cube_tb.png b/homedecor/textures/homedecor_glowlight_cube_tb.png index d5f0615d51eb2141b5c5a15493a8edee4c06f2fa..c415202c832ead9a82b5a72f01b2a3a31404f3b2 100644 GIT binary patch delta 76 zcmeBUjGG|g#>mXTz@TcIs|2Lj0(?ST@7=ri^XJcF;*$k|BEp_7jv*Y^lYji5&)8@8 dA=%v{i@|Y{_{)ahA6C?<}K}qj1@ZW;*;N$gTe~DWM4fU4Ai0 diff --git a/homedecor/textures/homedecor_glowlight_cube_tb_overlay.png b/homedecor/textures/homedecor_glowlight_cube_tb_overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..c5b9d9e7e78af8db19f04ccdd698db28e2506d5f GIT binary patch literal 209 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Gdx`!Lo80eon**;$UvZVe@FJC z2PDX=`p-sRd?ItDkJ+^selIc526pY=xoUTVVwIfHc8v@ z+KJ?+zTf|FCop`g+9vvC;oek-o{i#yC5fBUeKfzmKL7s;w~4wYb9tyh2+)lTp00i_ I>zopr0P%NJi~s-t literal 0 HcmV?d00001 diff --git a/homedecor/textures/homedecor_glowlight_thick_sides.png b/homedecor/textures/homedecor_glowlight_thick_sides.png index 81a9518478bbe61f78576ad5091f649764150122..bae01085c90a1a9c6198da1fb1e731cfe32d8c23 100644 GIT binary patch delta 77 zcmZ3>7(YS6ospS=fkD+aR|!b51^9%x-n)12=g*(V#3u^^MMOMZ978y+C;#|Ae_^Ab fEF)`S2Qx$POg`4_Q&N5dFVdQ I&MBb@08#}%H~;_u diff --git a/homedecor/textures/homedecor_glowlight_thick_sides_overlay.png b/homedecor/textures/homedecor_glowlight_thick_sides_overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..f22551cfad7f57f77e026f76cad9c3b7ec52de4f GIT binary patch literal 317 zcmV-D0mA-?P)>(nz*EJG<*y!!MTu2q8R} z**$Oz^gsu+fEVWiOuz`7fn$tu@ZLXf0L<(TSQ9WM3cxIZEzp=5z>ffM0QM5N26jLL zr2C5mQdQ`j2|aM5;2yXVd7~C)!50;Ml>(ixEB0-1-{=ie@FY$qv_d1am4Fqkl=uH& zIe=wZ9%bXcaG|YSn1B!99XJ7lbM7e-CSfiB5G#SiN&B2(1U{9)7cXDWLE?-;CYt!nV^$>R6orz)z7$|jou-NWGN>gTe~DWM4f#w|UTR3(j%J)9o#4lNh3(L~{3OYR+x}#5TxH_AoArk| z`K^`UbpC&~8=OiWdv5Y=u>m>2)78&qol`;+0M6Ju A0ssI2 diff --git a/homedecor/textures/homedecor_glowlight_top_overlay.png b/homedecor/textures/homedecor_glowlight_top_overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..ec27d4a9a719615eb4783784a30f0f4bc312757c GIT binary patch literal 417 zcmV;S0bc%zP)|6-FXjh&6{8XufXxf7{TNi1OajL!p_ta z031zV19U~C9b*hRXF^KpHiU2u+?c?iA%F?&O`ryzfrpgSgN6`>z!11F3|tB=6F3+; zF0F$Ec~^5dHx#?;$N_k_2-HRN25i-S>lwV=X*hU$SNLk7b_}QP>{B?p{Rdx7`NYTt z>h`kK-Iq5Ndkp+@sWr*b3RQ4)Vbi$#!BHzn!QRkvANax*&bO`Bo*Q6mwz^-n(MVgz z-vF;_oz*o+quMPewm0V&^QnPabI#8pgf`FyvKt)V${%hPUaXauDW#Pz7K^7CBO+2- z_U)Hh@B%fkN+~^7RkhUV-E<8QW6UCQusr`9=bZDZs_vKb`F#Be4(Xh##Ds7y00000 LNkvXXu0mjf!;H6f literal 0 HcmV?d00001 diff --git a/ilights/init.lua b/ilights/init.lua index eed4b03c..aee2a60e 100644 --- a/ilights/init.lua +++ b/ilights/init.lua @@ -12,7 +12,7 @@ else S = function(s) return s end end -if minetest.get_modpath("unified_inventory") or not minetest.setting_getbool("creative_mode") then +if minetest.get_modpath("unified_inventory") or not minetest.settings:get_bool("creative_mode") then ilights.expect_infinite_stacks = false else ilights.expect_infinite_stacks = true diff --git a/inbox/init.lua b/inbox/init.lua index 280edf2e..5ee77a8c 100644 --- a/inbox/init.lua +++ b/inbox/init.lua @@ -92,6 +92,19 @@ minetest.register_node("inbox:empty", { end end end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + local owner = meta:get_string("owner") + if player:get_player_name() == owner or + minetest.check_player_privs(player, "protection_bypass") and + clicker:get_player_control().aux1 then + return stack:get_count() + end + return 0 + end, + allow_metadata_inventory_move = function(pos) + return 0 + end, }) function inbox.get_inbox_formspec(pos) diff --git a/lrfurn/armchairs.lua b/lrfurn/armchairs.lua index 1488c959..ad230142 100644 --- a/lrfurn/armchairs.lua +++ b/lrfurn/armchairs.lua @@ -108,6 +108,6 @@ minetest.register_lbm({ end }) -if minetest.setting_get("log_mods") then +if minetest.settings:get("log_mods") then minetest.log("action", "[lrfurn/armchairs] "..S("Loaded!")) end diff --git a/lrfurn/coffeetable.lua b/lrfurn/coffeetable.lua index d2a920a2..f9246b8c 100644 --- a/lrfurn/coffeetable.lua +++ b/lrfurn/coffeetable.lua @@ -65,6 +65,6 @@ minetest.register_craft({ } }) -if minetest.setting_get("log_mods") then +if minetest.settings:get("log_mods") then minetest.log("action", "[lrfurn/coffeetable] "..S("Loaded!")) end diff --git a/lrfurn/endtable.lua b/lrfurn/endtable.lua index b94da3b0..a318376f 100644 --- a/lrfurn/endtable.lua +++ b/lrfurn/endtable.lua @@ -48,6 +48,6 @@ minetest.register_craft({ } }) -if minetest.setting_get("log_mods") then +if minetest.settings:get("log_mods") then minetest.log("action", "[lrfurn/endtable] "..S("Loaded!")) end diff --git a/lrfurn/longsofas.lua b/lrfurn/longsofas.lua index 39a6dc1c..05db65d3 100644 --- a/lrfurn/longsofas.lua +++ b/lrfurn/longsofas.lua @@ -122,6 +122,6 @@ minetest.register_lbm({ end }) -if minetest.setting_get("log_mods") then +if minetest.settings:get("log_mods") then minetest.log("action", "[lrfurn/longsofas] "..S("Loaded!")) end diff --git a/lrfurn/sofas.lua b/lrfurn/sofas.lua index 0f6a1533..de1b784c 100644 --- a/lrfurn/sofas.lua +++ b/lrfurn/sofas.lua @@ -122,6 +122,6 @@ minetest.register_lbm({ end }) -if minetest.setting_get("log_mods") then +if minetest.settings:get("log_mods") then minetest.log("action", "[lrfurn/sofas] "..S("Loaded!")) end diff --git a/mesecons/services.lua b/mesecons/services.lua index 1abbc0c3..1e12de08 100644 --- a/mesecons/services.lua +++ b/mesecons/services.lua @@ -66,30 +66,63 @@ minetest.register_on_placenode(mesecon.on_placenode) minetest.register_on_dignode(mesecon.on_dignode) -- Overheating service for fast circuits +local OVERHEAT_MAX = mesecon.setting("overheat_max", 20) +local COOLDOWN_TIME = mesecon.setting("cooldown_time", 2.0) +local COOLDOWN_STEP = mesecon.setting("cooldown_granularity", 0.5) +local COOLDOWN_MULTIPLIER = OVERHEAT_MAX / COOLDOWN_TIME +local cooldown_timer = 0.0 +local object_heat = {} -- returns true if heat is too high -mesecon.do_overheat = function(pos) - local meta = minetest.get_meta(pos) - local heat = meta:get_int("heat") or 0 - - heat = heat + 1 - meta:set_int("heat", heat) - - if heat < mesecon.setting("overheat_max", 20) then - mesecon.queue:add_action(pos, "cooldown", {}, 1, nil, 0) - else +function mesecon.do_overheat(pos) + local id = minetest.hash_node_position(pos) + local heat = (object_heat[id] or 0) + 1 + object_heat[id] = heat + if heat >= OVERHEAT_MAX then + minetest.log("action", "Node overheats at " .. minetest.pos_to_string(pos)) + object_heat[id] = nil return true end - return false end +function mesecon.do_cooldown(pos) + local id = minetest.hash_node_position(pos) + object_heat[id] = nil +end -mesecon.queue:add_function("cooldown", function (pos) - local meta = minetest.get_meta(pos) - local heat = meta:get_int("heat") +function mesecon.get_heat(pos) + local id = minetest.hash_node_position(pos) + return object_heat[id] or 0 +end - if (heat > 0) then - meta:set_int("heat", heat - 1) +function mesecon.move_hot_nodes(moved_nodes) + local new_heat = {} + for _, n in ipairs(moved_nodes) do + local old_id = minetest.hash_node_position(n.oldpos) + local new_id = minetest.hash_node_position(n.pos) + new_heat[new_id] = object_heat[old_id] + object_heat[old_id] = nil end -end) + for id, heat in pairs(new_heat) do + object_heat[id] = heat + end +end + +local function global_cooldown(dtime) + cooldown_timer = cooldown_timer + dtime + if cooldown_timer < COOLDOWN_STEP then + return -- don't overload the CPU + end + local cooldown = COOLDOWN_MULTIPLIER * cooldown_timer + cooldown_timer = 0 + for id, heat in pairs(object_heat) do + heat = heat - cooldown + if heat <= 0 then + object_heat[id] = nil -- free some RAM + else + object_heat[id] = heat + end + end +end +minetest.register_globalstep(global_cooldown) diff --git a/mesecons_gates/init.lua b/mesecons_gates/init.lua index 13e583be..3807d6f6 100644 --- a/mesecons_gates/init.lua +++ b/mesecons_gates/init.lua @@ -74,7 +74,8 @@ local function register_gate(name, inputnumber, assess, recipe, description) assess = assess, onstate = basename.."_on", offstate = basename.."_off", - inputnumber = inputnumber + inputnumber = inputnumber, + after_dig_node = mesecon.do_cooldown, },{ tiles = {"jeija_microcontroller_bottom.png^".."jeija_gate_off.png^".. "jeija_gate_"..name..".png"}, diff --git a/mesecons_luacontroller/init.lua b/mesecons_luacontroller/init.lua index c754eda7..25273a1c 100644 --- a/mesecons_luacontroller/init.lua +++ b/mesecons_luacontroller/init.lua @@ -315,7 +315,7 @@ local function create_environment(pos, mem, event) port = vports_copy, event = event, mem = mem, - heat = minetest.get_meta(pos):get_int("heat"), + heat = mesecon.get_heat(pos), heat_max = mesecon.setting("overheat_max", 20), print = safe_print, interrupt = get_interrupt(pos), @@ -478,14 +478,13 @@ local function reset_meta(pos, code, errmsg) local meta = minetest.get_meta(pos) meta:set_string("code", code) code = minetest.formspec_escape(code or "") - errmsg = minetest.formspec_escape(errmsg or "") - meta:set_string("formspec", "size[10,8]".. - "background[-0.2,-0.25;10.4,8.75;jeija_luac_background.png]".. - "textarea[0.2,0.6;10.2,5;code;;"..code.."]".. - "image_button[3.75,6;2.5,1;jeija_luac_runbutton.png;program;]".. - "image_button_exit[9.72,-0.25;0.425,0.4;jeija_close_window.png;exit;]".. - "label[0.1,5;"..errmsg.."]") - meta:set_int("heat", 0) + errmsg = minetest.formspec_escape(tostring(errmsg or "")) + meta:set_string("formspec", "size[12,10]".. + "background[-0.2,-0.25;12.4,10.75;jeija_luac_background.png]".. + "textarea[0.2,0.2;12.2,9.5;code;;"..code.."]".. + "image_button[4.75,8.75;2.5,1;jeija_luac_runbutton.png;program;]".. + "image_button_exit[11.72,-0.25;0.425,0.4;jeija_close_window.png;exit;]".. + "label[0.1,9;"..errmsg.."]") meta:set_int("luac_id", math.random(1, 65535)) end @@ -626,6 +625,7 @@ for d = 0, 1 do d = d == 1, }, after_dig_node = function (pos, node) + mesecon.do_cooldown(pos) mesecon.receptor_off(pos, output_rules) end, is_luacontroller = true, diff --git a/mesecons_luacontroller/textures/jeija_luac_background.png b/mesecons_luacontroller/textures/jeija_luac_background.png index 40e316c8316c2da3b632a736cdb8cbb6702a0552..40b427ebe933f90289bf256311167a4a31117e6c 100644 GIT binary patch literal 718 zcmeAS@N?(olHy`uVBq!ia0y~yV0;I}hnSdwA|c|3I)D^sfKQ0)^KC#DL*m-pH9||K z09lMBL4Lsu4$p3+fjCLt?k)@+tg;?J4rhT!WHAE+w=f7ZGR&GI0Tg5}@$_|Nf5^hk zE6LKbuYRaHSYDrNFPOji_LRSCzvzFK z-gk8F@rk$3e=T~@^!D-H(r?E04Dwz0N z@^R?9xS4Hx_AHOl`=DR3uQZdpro!E(S9N+!yOocj#QBxSrqA=TIvx{s&2Z{MxobP7 zB>6^7k2-rxTw%X>K@0oJRe1Ep;HeqB(Ch_x;-P&3ohD>6hhx*YtTE+2Hf>ct!jFs&5(M6VFe0&tH=) V5dT`=8JM^jJYD@<);T3K0RS>GJ`(@{ literal 2016 zcmeH`c~H|w6vy`m7Bn29K`s-6El{=PEMnvciqLQfqT*2yNjL<#O9BKG%1x1xAWVY< zg;GESDhOgYjbf-7Lrn~RW&VKg$cHY|~%iRsD z0@Hy3092eD?N0#!-I96GRs|XHvvakO4GO+4SbIR->?t*j1{v8F>G%}^044aQLx6fq zO9mB*POc7$V-Os+2Xuz_6v`0tvd4Miv52s+fN-L03c#_b06a0kUpMwLF-RBdOmS2jCq|c@&rlvBR*D^*j&ipT=mHge^SDCbaToSy&+jmN`Kgzlc5)t zCB>&6UZ06US^+j2w+rZ^5hKjeD@$Reqx-#>RjUO>sws^9Wny@2yqAb?+!WGBMCYBW zNixhK^3|b^NxUg6J#bGAFTrkaku7$9>0Tef)|Nzi0K@D&T%UrIktzHn8ReuULJPrs*r^1ge}9V|xN zU4FWx;F6;XC-a%X!BC5J&G@Tbf-1aa2Za9GUnndv&b(8xK{1G(8L`Icqmn;CgHN+x zc<|-TE1N1aMx&quEv}Kk4MFW+iAy`h2rKQbIE{7aBiLYER5;TRb$i)N4#^JX4bMJ1 z?^tb+CacQ+PPt`?MB=kG3e~9%!}730?d|OzhGY&vd~W7Fl(4(Dm8nOZN^E^y zcm0Ubfskj|NT7-+?$5!{@*gv+roYM4P6CmXfZBDn)sIqMKZi0-?`Eq&YH~UR*O9XV=|l#;U+- zwcu~$#nm2;+BO!*voO@2FPu0;<73B#`U`P_8Bg)uA7h3eRpCw~2ztyKQ>)i8Yuy)? zoAXAUAN%+fhs4Mo>>hY4cG=?tzwH5>DP^mx4MQ=;-mDPAa|^q_r4F5Vxy;a@vL@3m z-Y@l8WZ$rxPq!`6csFx5p}5zoO<&wj4662TaprPQI@272B_&~P1>r;b;s-ptH@CuY;LHXEhq98z4_dMVvN)!emZpG&R?QL17+g1_rzp^?pYMU!g4sQ0fcDR(^03}z{T>t<8 diff --git a/mesecons_mvps/init.lua b/mesecons_mvps/init.lua index 2c6161b7..252acf73 100644 --- a/mesecons_mvps/init.lua +++ b/mesecons_mvps/init.lua @@ -246,3 +246,4 @@ mesecon.register_mvps_stopper("doors:door_steel_t_1") mesecon.register_mvps_stopper("doors:door_steel_b_2") mesecon.register_mvps_stopper("doors:door_steel_t_2") mesecon.register_mvps_stopper("default:chest_locked") +mesecon.register_on_mvps_move(mesecon.move_hot_nodes) diff --git a/moreores/init.lua b/moreores/init.lua index 34c9a0e4..da4409f1 100644 --- a/moreores/init.lua +++ b/moreores/init.lua @@ -10,6 +10,11 @@ Licensed under the zlib license. See LICENSE.md for more information. moreores = {} +local default_tin = false +if minetest.registered_items["default:tin_ingot"] then + default_tin = true +end + local S if minetest.get_modpath("intllib") then S = intllib.Getter() @@ -266,17 +271,6 @@ local oredefs = { full_punch_interval = 1.0, damage_groups = {fleshy = 6}, }, - tin = { - description = "Tin", - makes = {ore = true, block = true, lump = true, ingot = true, chest = false}, - oredef = {clust_scarcity = moreores.tin_chunk_size * moreores.tin_chunk_size * moreores.tin_chunk_size, - clust_num_ores = moreores.tin_ore_per_chunk, - clust_size = moreores.tin_chunk_size, - y_min = moreores.tin_min_depth, - y_max = moreores.tin_max_depth - }, - tools = {}, - }, mithril = { description = "Mithril", makes = {ore = true, block = true, lump = true, ingot = true, chest = false}, @@ -311,6 +305,20 @@ local oredefs = { } } +if not default_tin then + oredefs.tin = { + description = "Tin", + makes = {ore = true, block = true, lump = true, ingot = true, chest = false}, + oredef = {clust_scarcity = moreores.tin_chunk_size * moreores.tin_chunk_size * moreores.tin_chunk_size, + clust_num_ores = moreores.tin_ore_per_chunk, + clust_size = moreores.tin_chunk_size, + y_min = moreores.tin_min_depth, + y_max = moreores.tin_max_depth + }, + tools = {}, + } +end + for orename,def in pairs(oredefs) do add_ore(modname, def.description, orename, def) end @@ -325,16 +333,23 @@ minetest.register_craft({ } }) --- Bronze has some special cases, because it is made from copper and tin: -minetest.register_craft( { - type = "shapeless", - output = "default:bronze_ingot 3", - recipe = { - "moreores:tin_ingot", - "default:copper_ingot", - "default:copper_ingot", - } -}) +if default_tin then + minetest.register_alias("moreores:mineral_tin", "default:stone_with_tin") + minetest.register_alias("moreores:tin_lump", "default:tin_lump") + minetest.register_alias("moreores:tin_ingot", "default:tin_ingot") + minetest.register_alias("moreores:tin_block", "default:tinblock") +else + -- Bronze has some special cases, because it is made from copper and tin: + minetest.register_craft( { + type = "shapeless", + output = "default:bronze_ingot 3", + recipe = { + "moreores:tin_ingot", + "default:copper_ingot", + "default:copper_ingot", + } + }) +end -- Unique node: minetest.register_node("moreores:copper_rail", { diff --git a/moreores/mg.lua b/moreores/mg.lua index 8c53456a..6551ae5d 100644 --- a/moreores/mg.lua +++ b/moreores/mg.lua @@ -5,20 +5,22 @@ Copyright (c) 2011-2017 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] -mg.register_ore({ - name = "moreores:mineral_tin", - wherein = "default:stone", - seeddiff = 8, - maxvdistance = 10.5, - maxheight = 8, - seglenghtn = 15, - seglenghtdev = 6, - segincln = 0, - segincldev = 0.6, - turnangle = 57, - forkturnangle = 57, - numperblock = 2 -}) +if not minetest.registered_items["default:tin_ingot"] then + mg.register_ore({ + name = "moreores:mineral_tin", + wherein = "default:stone", + seeddiff = 8, + maxvdistance = 10.5, + maxheight = 8, + seglenghtn = 15, + seglenghtdev = 6, + segincln = 0, + segincldev = 0.6, + turnangle = 57, + forkturnangle = 57, + numperblock = 2 + }) +end mg.register_ore({ name = "moreores:mineral_silver", diff --git a/pipeworks/default_settings.lua b/pipeworks/default_settings.lua new file mode 100644 index 00000000..99b86fe3 --- /dev/null +++ b/pipeworks/default_settings.lua @@ -0,0 +1,40 @@ +-- Various settings + +local prefix = "pipeworks_" + +local settings = { + enable_pipes = true, + enable_autocrafter = true, + enable_deployer = true, + enable_dispenser = true, + enable_node_breaker = true, + enable_teleport_tube = true, + enable_pipe_devices = true, + enable_redefines = true, + enable_mese_tube = true, + enable_detector_tube = true, + enable_digiline_detector_tube = true, + enable_conductor_tube = true, + enable_accelerator_tube = true, + enable_crossing_tube = true, + enable_sand_tube = true, + enable_mese_sand_tube = true, + enable_one_way_tube = true, + enable_priority_tube = true, + enable_cyclic_mode = true, + drop_on_routing_fail = false, + + delete_item_on_clearobject = true, +} + +for name, value in pairs(settings) do + local setting_type = type(value) + if setting_type == "boolean" then + pipeworks[name] = minetest.settings:get_bool(prefix..name) + if pipeworks[name] == nil then + pipeworks[name] = value + end + else + pipeworks[name] = value + end +end diff --git a/pipeworks/flowing_logic.lua b/pipeworks/flowing_logic.lua index e1c0bf54..632baa63 100644 --- a/pipeworks/flowing_logic.lua +++ b/pipeworks/flowing_logic.lua @@ -4,7 +4,7 @@ -- Contributed by mauvebic, 2013-01-03, rewritten a bit by Vanessa Ezekowitz -- -local finitewater = minetest.setting_getbool("liquid_finite") +local finitewater = minetest.settings:get_bool("liquid_finite") pipeworks.check_for_liquids = function(pos) local coords = { diff --git a/pipeworks/init.lua b/pipeworks/init.lua index ab5cf3c2..a3f31c74 100644 --- a/pipeworks/init.lua +++ b/pipeworks/init.lua @@ -13,7 +13,7 @@ local DEBUG = false pipeworks.worldpath = minetest.get_worldpath() pipeworks.modpath = minetest.get_modpath("pipeworks") -dofile(pipeworks.modpath.."/default_settings.txt") +dofile(pipeworks.modpath.."/default_settings.lua") -- Read the external config file if it exists. local worldsettingspath = pipeworks.worldpath.."/pipeworks_settings.txt" @@ -26,7 +26,7 @@ end -- Random variables pipeworks.expect_infinite_stacks = true -if minetest.get_modpath("unified_inventory") or not minetest.setting_getbool("creative_mode") then +if minetest.get_modpath("unified_inventory") or not minetest.settings:get_bool("creative_mode") then pipeworks.expect_infinite_stacks = false end diff --git a/pipeworks/item_transport.lua b/pipeworks/item_transport.lua index 43adeeae..b2d2aa29 100644 --- a/pipeworks/item_transport.lua +++ b/pipeworks/item_transport.lua @@ -1,6 +1,6 @@ local luaentity = pipeworks.luaentity -local enable_max_limit = minetest.setting_get("pipeworks_enable_items_per_tube_limit") -local max_tube_limit = tonumber(minetest.setting_get("pipeworks_max_items_per_tube")) or 30 +local enable_max_limit = minetest.settings:get("pipeworks_enable_items_per_tube_limit") +local max_tube_limit = tonumber(minetest.settings:get("pipeworks_max_items_per_tube")) or 30 if enable_max_limit == nil then enable_max_limit = true end function pipeworks.tube_item(pos, item) diff --git a/pipeworks/luaentity.lua b/pipeworks/luaentity.lua index ab7280c8..382b0c1c 100644 --- a/pipeworks/luaentity.lua +++ b/pipeworks/luaentity.lua @@ -71,7 +71,7 @@ end local active_blocks = {} -- These only contain active blocks near players (i.e., not forceloaded ones) local move_entities_globalstep_part1 = function(dtime) - local active_block_range = tonumber(minetest.setting_get("active_block_range")) or 2 + local active_block_range = tonumber(minetest.settings:get("active_block_range")) or 2 local new_active_blocks = {} for _, player in ipairs(minetest.get_connected_players()) do local blockpos = get_blockpos(player:getpos()) diff --git a/pipeworks/settingtypes.txt b/pipeworks/settingtypes.txt new file mode 100644 index 00000000..1d3c10c6 --- /dev/null +++ b/pipeworks/settingtypes.txt @@ -0,0 +1,70 @@ +#Enable pipes. +pipeworks_enable_pipes (Enable Pipes) bool true + +#Enable autocrafter. +pipeworks_enable_autocrafter (Enable Autocrafter) bool true + +#Enable deployer. +pipeworks_enable_deployer (Enable Deployer) bool true + +#Enable dispenser. +pipeworks_enable_dispenser (Enable Dispenser) bool true + +#Enable node breaker. +pipeworks_enable_node_breaker (Enable Node Breaker) bool true + +#Enable teleport tube. +pipeworks_enable_teleport_tube (Enable Teleport Tube) bool true + +#Enable pipe devices. +pipeworks_enable_pipe_devices (Enable Pipe Devices) bool true + +#Enable redefines. +pipeworks_enable_redefines (Enable Node Redefines) bool true + +#Enable sorting tube. +pipeworks_enable_mese_tube (Enable Sorting Tube) bool true + +#Enable detector tube. +pipeworks_enable_detector_tube (Enable Detector Tube) bool true + +#Enable digiline detector tube. +pipeworks_enable_digiline_detector_tube (Enable Digiline Detector Tube) bool true + +#Enable mesecon signal conducting tube. +pipeworks_enable_conductor_tube (Enable Conductor Tube) bool true + +#Enable accelerator tube. +pipeworks_enable_accelerator_tube (Enable Accelerator Tube) bool true + +#Enable crossing tube. +#It sends all incoming items to the other side, or if there is no other tube, it sends them back. +pipeworks_enable_crossing_tube (Enable Crossing Tube) bool true + +#Enable vacuum tube. +#It picks up all items that lay around next to it. +pipeworks_enable_sand_tube (Enable Vacuum Tube) bool true + +#Enable mese vacuum tube. +#It's like the normal vacuum tube with the +#differance that you can set the radius up to 8 nodes. +pipeworks_enable_mese_sand_tube (Enable Mese Vacuum Tube) bool true + +#Enable one way tube. +#It sends items only in one direction. +#Use it to drop items out of tubes. +pipeworks_enable_one_way_tube (Enable One Way Tube) bool true + +#Enable high priority tube. +#It has a very high priority and so, on crossings, the items will +#always go to it if there are multible ways. +pipeworks_enable_priority_tube (Enable High Priority Tube) bool true + +#Enable cyclic mode. +pipeworks_enable_cyclic_mode (Enable Cyclic Mode) bool true + +#Drop on routing fail. +pipeworks_drop_on_routing_fail (Drop On Routing Fail) bool false + +#Delete item on clearobject. +pipeworks_delete_item_on_clearobject (Delete Item On Clearobject) bool true \ No newline at end of file diff --git a/pipeworks/signal_tubes.lua b/pipeworks/signal_tubes.lua index 3b2653cc..a0a8039d 100644 --- a/pipeworks/signal_tubes.lua +++ b/pipeworks/signal_tubes.lua @@ -1,5 +1,5 @@ if pipeworks.enable_detector_tube then - local detector_tube_step = 5 * tonumber(minetest.setting_get("dedicated_server_step")) + local detector_tube_step = 5 * tonumber(minetest.settings:get("dedicated_server_step")) pipeworks.register_tube("pipeworks:detector_tube_on", { description = "Detecting Pneumatic Tube Segment on (you hacker you)", inventory_image = "pipeworks_detector_tube_inv.png", diff --git a/pipeworks/textures/pipeworks_nodebreaker_front_on.png b/pipeworks/textures/pipeworks_nodebreaker_front_on.png index bf7fe70217455c4a735b574b870093cbfc58ffb1..2b3a4a3c9f651fcc0fc227d75ed4e0d17c797d53 100644 GIT binary patch delta 301 zcmV+|0n+}U1k41mDFJ^0VoOIv0Eh)0NB{r;32;bRa{vGf6951U69E94oEQKA00(qQ zO+^Rc1p*Kk7M@hM%K!iX*-1n}R2b8Rk7rT>K^O%;BW5vY(J~Sw3+yfn8z$$O`ya-+ zfq%PRRlkPX``|<1)`U>677GZ*M8KW1K7yBX_?3An9Dt4vF-qKnkmBQ4Cld@1g4UWdC_Fm`|9e9Bf^oa z&u_y0V)$GoI~%kKC+&lamU|gIK8f?aZ2~x)%$xR3^!g7AxnFpvT{yO<*9+OZ?bfnZ z(!ecP$?4}%_q(ry@mHcqL9W|UYr9N8#=@wAAUJEQN-RgCrDdupfNN{@%6_M5W=%kZ zsHf6JC$gVk;iB>oU8N1rofMNl6TF8IO^iY1%oxV8Q~m>fW<9H6w(Hse0000l0i~j zF$_doZRvj)cHATELWLQwLDq1}BvoMrfow^IvrNrksk5*rUb$S7Td&o2b@eGCNJ^4K z(%nhE|9uw#0FnSzl_bf{jBKsVhEX6@Y1Z3(5hMT}^LSMOFng4iX0!S6?Yp~6qC~PX0U#6P0Dri@x68{*Z*5uEa39i; zU?wRud+)vX!GCl2^=@6yTvAo_j}J%_Q5x=4RaIrx_+pN>+ifFavpGLIJAe80B5BeA zRn>dXOaMkgx_@}E+uNpe5C?L}FEC*5Pp2@Av!t z{%|<<{&9W%c@)hYoq`C!kH_OkwN!wSjEL5HW)8}kyi-j60VAduLGf2S4*&oF07*qo IM6N<$g0C~z$^ZZW delta 575 zcmV-F0>J&@1I+}G8Gi!+001a04^sdD0T)nAR7GiNXi!j2T3T30NJn2^UO_=WK|w%X zUR*#xJ})mWIyyQ=Mnqv@U{X?1E-o!KH8oLDP*qh_M@K~>At63KJW)|kAs-(`MnxDH z7#0>5IyyKT8X6uR9v&PV85tQ13JMJj3=0bjG&D0pLP0z{I)5S{AUZlZ5fKqHGcrX* zLmV6&H#aslH8e|0N;o(-LqkG5JUd56MjjmOG!>nOixcuARiwN4Gjtk3O_$S zPft!gJv=}_KRY`*L_|YMN=QXTL>wC%PEJi37#I^16ATLrO-)QbK0P)zH6b7%9UL4N z78Vy57Zel}4Sx*{5)u*+5D*X#4;2&?5)ly*5D*v_7Zei{6A}^+4-Xa<6%P&$4h{~N zznn(^008kxL_t&-(*?l=V!}WW0Kl!gySKQzLqdQ++>_J&|2sMZ*Of-D(&(!(=MsPa zrf_!Cs#{j;9T8=)`A-{JB#Rq%*xh4rKM|B8A%`V!{_Sn%AN|h3nDOo$t+WGo$ z!!%U-peouGaXmsrDrFQ~P&i#_hVKhOqX}|EFx%b1&`5+!vpD8b!fe&tJdH-KCm0Je zL@=vOV>mOMzv@H?KjjiS`Q>ue9c;Wek6Qo&MN zF%Xk>_a#ii@B!sq4$yN+(!a?US05MJ=tDsWlQ2>u^?$A z%?N-5K;Z7nU1s*)Gm|9A%xtX%07wELkvuH{DJ79~_W}SUyMNDTGm>^Lk^q30mw(sS zpCa5n+eqR`Q|2KssfOi zKA+F|k%Dx0bB~B{fBN%udwV;ZO%dMvXzgg*?Uo-t;O-GIO;dQ$#P6TKmdnd&nz^)MzIO2_yjlt@q>M(8mY>08*;9Wo9N%%BnPzRE9_j01w|EKq~X( zi8M;CcXKx1Hv9eC>+4%)*U07l~7wZaov ztygtyX6})x5CFi>Spv+gkn7Frv;_fHsN!rw$yzr^ibVt{J&-1I+}G8Gi!+001a04^sdD0T)nAR7GiNXi!j2T3T30NJn2^UO_=WK|w%X zUR*#xK4D>CIyyQ=MnqClQ7< z7Dh%z7#J8C85tfP9v&PV8yXr53JMJj3=0bjLP9}2JUTQqGk+o=ARHVVIyyN;MMDu0 z5i>I~JUlx!H8e|0N;o(-9vvM+Lqaz678Dc|4Sx*{5)u*+4-XI!5ET>@5)ly*5D*v_7Zei{6A}^+4-Xa<6%P&$4h{~L zQULb=008kxL_t&-(*?l=V!}WW0Kl!gySKQzLqdQ++>_J&|2sMZ)4yMooJaFvqgH6t zu3`GK3nU`Gv~0WEy19bgZo;!HlH7P)E@$Tj2m%>1mVc&9eW)xhj>~{3Ge#5P>i4&b zaxepwJliJZqttGno$Q-O(2c7sA?wevbytMLy&RNRlqR|}ww|n_RT3c#S791@-(Sw! zan^)Z!H!}nQ$dL9kxO+o2SkpOm00f<@1m~g$(=y}uB zW*~X$3phdacV)0Kn-v2jPiZ1v-A%uzEf%>t1Q>^GyY=5XMm@ir+y7;bK)u1@v}ynV N002ovPDHLkV1g$*y7d46 diff --git a/pipeworks/vacuum_tubes.lua b/pipeworks/vacuum_tubes.lua index 51f6f810..211c3ee2 100644 --- a/pipeworks/vacuum_tubes.lua +++ b/pipeworks/vacuum_tubes.lua @@ -1,27 +1,27 @@ if pipeworks.enable_sand_tube then pipeworks.register_tube("pipeworks:sand_tube", { - description = "Vacuuming Pneumatic Tube Segment", - inventory_image = "pipeworks_sand_tube_inv.png", - short = "pipeworks_sand_tube_short.png", - noctr = { "pipeworks_sand_tube_noctr.png" }, - plain = { "pipeworks_sand_tube_plain.png" }, - ends = { "pipeworks_sand_tube_end.png" }, - node_def = { groups = {vacuum_tube = 1}}, + description = "Vacuuming Pneumatic Tube Segment", + inventory_image = "pipeworks_sand_tube_inv.png", + short = "pipeworks_sand_tube_short.png", + noctr = {"pipeworks_sand_tube_noctr.png"}, + plain = {"pipeworks_sand_tube_plain.png"}, + ends = {"pipeworks_sand_tube_end.png"}, + node_def = {groups = {vacuum_tube = 1}}, }) minetest.register_craft( { output = "pipeworks:sand_tube_1 2", recipe = { - { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, - { "group:sand", "group:sand", "group:sand" }, - { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" } + {"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting"}, + {"group:sand", "group:sand", "group:sand"}, + {"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting"} }, }) minetest.register_craft( { output = "pipeworks:sand_tube_1", recipe = { - { "group:sand", "pipeworks:tube_1", "group:sand" }, + {"group:sand", "pipeworks:tube_1", "group:sand"}, }, }) end @@ -31,9 +31,9 @@ if pipeworks.enable_mese_sand_tube then description = "Adjustable Vacuuming Pneumatic Tube Segment", inventory_image = "pipeworks_mese_sand_tube_inv.png", short = "pipeworks_mese_sand_tube_short.png", - noctr = { "pipeworks_mese_sand_tube_noctr.png" }, - plain = { "pipeworks_mese_sand_tube_plain.png" }, - ends = { "pipeworks_mese_sand_tube_end.png" }, + noctr = {"pipeworks_mese_sand_tube_noctr.png"}, + plain = {"pipeworks_mese_sand_tube_plain.png"}, + ends = {"pipeworks_mese_sand_tube_end.png"}, node_def = { groups = {vacuum_tube = 1}, on_construct = function(pos) @@ -63,9 +63,9 @@ if pipeworks.enable_mese_sand_tube then minetest.register_craft( { output = "pipeworks:mese_sand_tube_1 2", recipe = { - { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, - { "group:sand", "default:mese_crystal", "group:sand" }, - { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" } + {"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, + {"group:sand", "default:mese_crystal", "group:sand" }, + {"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" } }, }) @@ -82,23 +82,19 @@ if pipeworks.enable_mese_sand_tube then }) end -local sqrt_3 = math.sqrt(3) -local tube_inject_item = pipeworks.tube_inject_item -local get_objects_inside_radius = minetest.get_objects_inside_radius local function vacuum(pos, radius) radius = radius + 0.5 - for _, object in pairs(get_objects_inside_radius(pos, sqrt_3 * radius)) do + for _, object in pairs(minetest.get_objects_inside_radius(pos, math.sqrt(3) * radius)) do local lua_entity = object:get_luaentity() if not object:is_player() and lua_entity and lua_entity.name == "__builtin:item" then local obj_pos = object:getpos() - local x1, y1, z1 = pos.x, pos.y, pos.z - local x2, y2, z2 = obj_pos.x, obj_pos.y, obj_pos.z - - if x1 - radius <= x2 and x2 <= x1 + radius - and y1 - radius <= y2 and y2 <= y1 + radius - and z1 - radius <= z2 and z2 <= z1 + radius then + local minpos = vector.subtract(pos, radius) + local maxpos = vector.add(pos, radius) + if obj_pos.x >= minpos.x and obj_pos.x <= maxpos.x + and obj_pos.y >= minpos.y and obj_pos.y <= maxpos.y + and obj_pos.z >= minpos.z and obj_pos.z <= maxpos.z then if lua_entity.itemstring ~= "" then - tube_inject_item(pos, pos, vector.new(0, 0, 0), lua_entity.itemstring) + pipeworks.tube_inject_item(pos, pos, vector.new(0, 0, 0), lua_entity.itemstring) lua_entity.itemstring = "" end object:remove() @@ -108,15 +104,15 @@ local function vacuum(pos, radius) end minetest.register_abm({nodenames = {"group:vacuum_tube"}, - interval = 1, - chance = 1, - label = "Vacuum tubes", - action = function(pos, node, active_object_count, active_object_count_wider) - if node.name:find("pipeworks:sand_tube") then - vacuum(pos, 2) - else - local radius = minetest.get_meta(pos):get_int("dist") - vacuum(pos, radius) - end - end + interval = 1, + chance = 1, + label = "Vacuum tubes", + action = function(pos, node, active_object_count, active_object_count_wider) + if node.name:find("pipeworks:sand_tube") then + vacuum(pos, 2) + else + local radius = minetest.get_meta(pos):get_int("dist") + vacuum(pos, radius) + end + end }) diff --git a/poisonivy/init.lua b/poisonivy/init.lua index 466b930b..8f7f7ba4 100644 --- a/poisonivy/init.lua +++ b/poisonivy/init.lua @@ -1,7 +1,12 @@ -- This file supplies poison ivy for the plantlife modpack -- Last revision: 2013-01-24 -local S = biome_lib.intllib +local S +if minetest.get_modpath("intllib") then + S = intllib.Getter() +else + S = function(s) return s end +end local SPAWN_DELAY = 1000 local SPAWN_CHANCE = 200 diff --git a/poisonivy/locale/es.txt b/poisonivy/locale/es.txt new file mode 100644 index 00000000..e9880e46 --- /dev/null +++ b/poisonivy/locale/es.txt @@ -0,0 +1,7 @@ +# Traducido por Carlos Barraza + +Poison ivy (seedling) = Hiedra venenosa (retoño) +Poison ivy (sproutling) = Hiedra venenosa (brotes) +Poison ivy (climbing plant) = Hiedra venenosa (planta trepadora) + +[Poison Ivy] Loaded. = [Hiedra venenosa] Cargado. diff --git a/ropes/crafts.lua b/ropes/crafts.lua index 299c0cc3..2c33dd32 100644 --- a/ropes/crafts.lua +++ b/ropes/crafts.lua @@ -3,16 +3,33 @@ local MP = minetest.get_modpath(minetest.get_current_modname()) local S, NS = dofile(MP.."/intllib.lua") if minetest.get_modpath("farming") then +-- this doesn't work reliably due to side effects of https://github.com/minetest/minetest/issues/5518 +-- local old_def = minetest.registered_craftitems["farming:cotton"] +-- if old_def then +-- old_def.groups["thread"] = 1 +-- minetest.override_item("farming:cotton", { +-- groups = old_def.groups +-- }) +-- end minetest.register_craft({ - output = 'ropes:ropesegment', + output = 'ropes:ropesegment', recipe = { {'farming:cotton','farming:cotton'}, {'farming:cotton','farming:cotton'}, - {'farming:cotton','farming:cotton'} + {'farming:cotton','farming:cotton'}, } }) end +minetest.register_craft({ + output = 'ropes:ropesegment', + recipe = { + {'group:thread','group:thread'}, + {'group:thread','group:thread'}, + {'group:thread','group:thread'}, + } +}) + minetest.register_craftitem("ropes:ropesegment", { description = S("Rope Segment"), _doc_items_longdesc = ropes.doc.ropesegment_longdesc, diff --git a/ropes/ladder.lua b/ropes/ladder.lua index 5ac872c5..7097c727 100644 --- a/ropes/ladder.lua +++ b/ropes/ladder.lua @@ -46,6 +46,17 @@ local rope_ladder_top_def = { }, groups = { choppy=2, oddly_breakable_by_hand=1,flammable=2}, sounds = default.node_sound_wood_defaults(), + + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type == "node" then + local target_node = minetest.get_node(pointed_thing.under) + local target_def = minetest.registered_nodes[target_node.name] + if target_def.walkable == false then + return itemstack + end + end + return minetest.item_place(itemstack, placer, pointed_thing) + end, after_place_node = function(pos, placer) local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} diff --git a/ropes/ropeboxes.lua b/ropes/ropeboxes.lua index 676f1c20..626b1588 100644 --- a/ropes/ropeboxes.lua +++ b/ropes/ropeboxes.lua @@ -134,6 +134,17 @@ local function register_rope_block(multiple, max_multiple, name_prefix, node_pre selection_box = {type="regular"}, collision_box = {type="regular"}, groups = {choppy=2, oddly_breakable_by_hand=1, rope_block = 1}, + + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type == "node" then + local target_node = minetest.get_node(pointed_thing.under) + local target_def = minetest.registered_nodes[target_node.name] + if target_def.walkable == false then + return itemstack + end + end + return minetest.item_place(itemstack, placer, pointed_thing) + end, after_place_node = function(pos, placer) local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} diff --git a/signs_lib/depends.txt b/signs_lib/depends.txt index abb8bd5c..7f4e061c 100644 --- a/signs_lib/depends.txt +++ b/signs_lib/depends.txt @@ -2,3 +2,4 @@ default intllib? screwdriver? keyword_interact? +craft_guide? diff --git a/signs_lib/init.lua b/signs_lib/init.lua index 536066f3..775db95f 100644 --- a/signs_lib/init.lua +++ b/signs_lib/init.lua @@ -13,7 +13,7 @@ local enable_colored_metal_signs = true -- CWz's keyword interact mod uses this setting. -local current_keyword = minetest.setting_get("interact_keyword") or "iaccept" +local current_keyword = minetest.settings:get("interact_keyword") or "iaccept" signs_lib = {} screwdriver = screwdriver or {} @@ -165,7 +165,7 @@ end -- infinite stacks -if not minetest.setting_getbool("creative_mode") then +if not minetest.settings:get_bool("creative_mode") then signs_lib.expect_infinite_stacks = false else signs_lib.expect_infinite_stacks = true @@ -793,7 +793,7 @@ minetest.register_node(":locked_sign:sign_wall_locked", { local meta = minetest.get_meta(pos) local owner = meta:get_string("owner") local pname = sender:get_player_name() or "" - if pname ~= owner and pname ~= minetest.setting_get("name") + if pname ~= owner and pname ~= minetest.settings:get("name") and not minetest.check_player_privs(pname, {sign_editor=true}) then return end @@ -806,7 +806,7 @@ minetest.register_node(":locked_sign:sign_wall_locked", { local meta = minetest.get_meta(pos) local owner = meta:get_string("owner") local pname = player:get_player_name() - return pname == owner or pname == minetest.setting_get("name") + return pname == owner or pname == minetest.settings:get("name") or minetest.check_player_privs(pname, {sign_editor=true}) end, on_rotate = signs_lib.wallmounted_rotate @@ -1158,6 +1158,6 @@ if enable_colored_metal_signs then }) end -if minetest.setting_get("log_mods") then +if minetest.settings:get("log_mods") then minetest.log("action", S("signs loaded")) end diff --git a/signs_lib/locale/es.txt b/signs_lib/locale/es.txt new file mode 100644 index 00000000..6741584e --- /dev/null +++ b/signs_lib/locale/es.txt @@ -0,0 +1,9 @@ +#Traducido por Carlos Barraza + +Reading cached character database. = Leyendo la base de datos de caracteres en caché. +Font seems to have changed. Rebuilding cache. = La fuente parece haber cambiado. Reconstruyendo caché. +Could not find font line height in cached DB. Trying brute force. = No se puede encontrar la fuente en la base de datos almacenada en el caché. Tratando fuerza bruta. +Sign = Letrero +%s wrote "%s" to sign at %s = %s escribio "%s" en el cartel en %s +Registered %s and %s = Registrado %s y %s +signs loaded = letreros cargados diff --git a/technic/config.lua b/technic/config.lua index 29321f9b..bb748ec4 100644 --- a/technic/config.lua +++ b/technic/config.lua @@ -12,6 +12,7 @@ local defaults = { enable_radiation_protection = "true", enable_entity_radiation_damage = "true", enable_longterm_radiation_damage = "true", + enable_nuclear_reactor_digiline_selfdestruct = "false", } for k, v in pairs(defaults) do diff --git a/technic/crafts.lua b/technic/crafts.lua index 9e07978c..14bafd35 100644 --- a/technic/crafts.lua +++ b/technic/crafts.lua @@ -9,33 +9,37 @@ minetest.clear_craft({ }) -- Accelerator tube -minetest.clear_craft({ - output = "pipeworks:accelerator_tube_1", -}) +if pipeworks.enable_accelerator_tube then + minetest.clear_craft({ + output = "pipeworks:accelerator_tube_1", + }) + + minetest.register_craft({ + output = 'pipeworks:accelerator_tube_1', + recipe = { + {'technic:copper_coil', 'pipeworks:tube_1', 'technic:copper_coil'}, + } + }) +end -- Teleport tube -minetest.clear_craft({ - output = "pipeworks:teleport_tube_1", -}) +if pipeworks.enable_teleport_tube then + minetest.clear_craft({ + output = "pipeworks:teleport_tube_1", + }) + + minetest.register_craft({ + output = 'pipeworks:teleport_tube_1', + recipe = { + {'default:mese_crystal', 'technic:copper_coil', 'default:mese_crystal'}, + {'pipeworks:tube_1', 'technic:control_logic_unit', 'pipeworks:tube_1'}, + {'default:mese_crystal', 'technic:copper_coil', 'default:mese_crystal'}, + } + }) +end -- tubes crafting recipes -minetest.register_craft({ - output = 'pipeworks:accelerator_tube_1', - recipe = { - {'technic:copper_coil', 'pipeworks:tube_1', 'technic:copper_coil'}, - } -}) - -minetest.register_craft({ - output = 'pipeworks:teleport_tube_1', - recipe = { - {'default:mese_crystal', 'technic:copper_coil', 'default:mese_crystal'}, - {'pipeworks:tube_1', 'technic:control_logic_unit', 'pipeworks:tube_1'}, - {'default:mese_crystal', 'technic:copper_coil', 'default:mese_crystal'}, - } -}) - minetest.register_craft({ output = 'technic:diamond_drill_head', recipe = { diff --git a/technic/depends.txt b/technic/depends.txt index 777e94fe..5bf9f9fc 100644 --- a/technic/depends.txt +++ b/technic/depends.txt @@ -2,9 +2,11 @@ default pipeworks technic_worldgen bucket? +screwdriver? mesecons? mesecons_mvps? digilines? +digiline_remote? intllib? unified_inventory? vector_extras? diff --git a/technic/doc/api.md b/technic/doc/api.md new file mode 100644 index 00000000..2e5b6d3e --- /dev/null +++ b/technic/doc/api.md @@ -0,0 +1,130 @@ +This file is fairly incomplete. Help is welcome. + +Tiers +----- +The tier is a string, currently `"LV"`, `"MV"` and `"HV"` are supported. + +Network +------- +The network is the cable with the connected machine nodes. Currently the +switching station handles the network activity. + +Helper functions +---------------- +* `technic.pretty_num(num)` + * Converts the number `num` to a human-readable string. + * Use this function when showing players power values. +* `technic.swap_node(pos, nodename)` + * Same as `mintest.swap_node` but it only changes the nodename. + * It uses `minetest.get_node` before swapping to ensure the new nodename + is not the same as the current one. +* `technic.get_or_load_node(pos)` + * If the mapblock is loaded, it returns the node at pos, + else it loads the chunk and returns `nil`. +* `technic.set_RE_wear(itemstack, item_load, max_charge)` + * If the `wear_represents` field in the item's nodedef is + `"technic_RE_charge"`, this function does nothing. +* `technic.refill_RE_charge(itemstack)` + * This function fully recharges an RE chargeable item. + * If `technic.power_tools[itemstack:get_name()]` is `nil` (or `false`), this + function does nothing, else that value is the maximum charge. + * The itemstack metadata is changed to contain the charge. +* `technic.is_tier_cable(nodename, tier)` + * Tells whether the node `nodename` is the cable of the tier `tier`. +* `technic.get_cable_tier(nodename)` + * Returns the tier of the cable `nodename` or `nil`. +* `technic.trace_node_ray(pos, dir, range)` + * Returns an iteration function (usable in the for loop) to iterate over the + node positions along the specified ray. + * The returned positions will not include the starting position `pos`. +* `technic.trace_node_ray_fat(pos, dir, range)` + * Like `technic.trace_node_ray` but includes extra positions near the ray. + * The node ray functions are used for mining lasers. +* `technic.config:get(name)` + * Some configuration function +* `technic.tube_inject_item(pos, start_pos, velocity, item)` + * Same as `pipeworks.tube_inject_item` + +Registration functions +---------------------- +* `technic.register_power_tool(itemname, max_charge)` + * Same as `technic.power_tools[itemname] = max_charge` + * This function makes the craftitem `itemname` chargeable. +* `technic.register_machine(tier, nodename, machine_type)` + * Same as `technic.machines[tier][nodename] = machine_type` + * Currently this is requisite to make technic recognize your node. + * See also `Machine types` +* `technic.register_tier(tier)` + * Same as `technic.machines[tier] = {}` + * See also `tiers` + +### Specific machines +* `technic.register_solar_array(data)` + * data is a table + +Used itemdef fields +------------------- +* groups: + * `technic_ = 1` ltier is a tier in small letters; this group makes + the node connect to the cable(s) of the right tier. + * `technic_machine = 1` Currently used for +* `connect_sides` + * In addition to the default use (see lua_api.txt), this tells where the + machine can be connected. +# +# +* `technic_run(pos, node)` + * This function is currently used to update the node. + Modders have to manually change the information about supply etc. in the + node metadata. + +Machine types +------------- +There are currently following types: +* `technic.receiver = "RE"` e.g. grinder +* `technic.producer = "PR"` e.g. solar panel +* `technic.producer_receiver = "PR_RE"` supply converter +* `technic.battery = "BA"` e.g. LV batbox + +Switching Station +----------------- +The switching station is the center of all power distribution on an electric +network. + +The station collects power from sources (PR), distributes it to sinks (RE), +and uses the excess/shortfall to charge and discharge batteries (BA). + +For now, all supply and demand values are expressed in kW. + +It works like this: + All PR,BA,RE nodes are indexed and tagged with the switching station. +The tagging is a workaround to allow more stations to be built without allowing +a cheat with duplicating power. + All the RE nodes are queried for their current EU demand. Those which are off +would require no or a small standby EU demand, while those which are on would +require more. +If the total demand is less than the available power they are all updated with +the demand number. +If any surplus exists from the PR nodes the batteries will be charged evenly +with this. +If the total demand requires draw on the batteries they will be discharged +evenly. + +If the total demand is more than the available power all RE nodes will be shut +down. We have a brown-out situation. + +Hence for now all the power distribution logic resides in this single node. + +### Node meta usage +Nodes connected to the network will have one or more of these parameters as meta +data: + * `_EU_supply` : Exists for PR and BA node types. + This is the EU value supplied by the node. Output + * `_EU_demand` : Exists for RE and BA node types. + This is the EU value the node requires to run. Output + * `_EU_input` : Exists for RE and BA node types. + This is the actual EU value the network can give the node. Input + +The reason the LV|MV|HV type is prepended to meta data is because some machine +could require several supplies to work. +This way the supplies are separated per network. diff --git a/technic/init.lua b/technic/init.lua index 4464082a..0d97319e 100644 --- a/technic/init.lua +++ b/technic/init.lua @@ -5,7 +5,7 @@ local load_start = os.clock() technic = rawget(_G, "technic") or {} -technic.creative_mode = minetest.setting_getbool("creative_mode") +technic.creative_mode = minetest.settings:get_bool("creative_mode") local modpath = minetest.get_modpath("technic") @@ -47,7 +47,7 @@ dofile(modpath.."/tools/init.lua") -- Aliases for legacy node/item names dofile(modpath.."/legacy.lua") -if minetest.setting_getbool("log_mods") then +if minetest.settings:get_bool("log_mods") then print(S("[Technic] Loaded in %f seconds"):format(os.clock() - load_start)) end diff --git a/technic/machines/HV/forcefield.lua b/technic/machines/HV/forcefield.lua index 3bb8d032..157dc337 100644 --- a/technic/machines/HV/forcefield.lua +++ b/technic/machines/HV/forcefield.lua @@ -17,9 +17,9 @@ local cable_entry = "^technic_cable_connection_overlay.png" minetest.register_craft({ output = "technic:forcefield_emitter_off", recipe = { - {"default:mese", "technic:motor", "default:mese" }, - {"technic:deployer_off", "technic:machine_casing", "technic:deployer_off"}, - {"default:mese", "technic:hv_cable", "default:mese" }, + {"default:mese", "technic:motor", "default:mese" }, + {"technic:deployer_off", "technic:machine_casing", "technic:deployer_off"}, + {"default:mese", "technic:hv_cable", "default:mese" }, } }) @@ -170,44 +170,68 @@ local digiline_def = { if channel ~= meta:get_string("channel") then return end - msg = msg:lower() - if msg == "get" then + local msgt = type(msg) + if msgt == "string" then + local smsg = msg:lower() + msg = {} + if smsg == "get" then + msg.command = "get" + elseif smsg == "off" then + msg.command = "off" + elseif smsg == "on" then + msg.command = "on" + elseif smsg == "toggle" then + msg.command = "toggle" + elseif smsg:sub(1, 5) == "range" then + msg.command = "range" + msg.value = tonumber(smsg:sub(7)) + elseif smsg:sub(1, 5) == "shape" then + msg.command = "shape" + msg.value = smsg:sub(7):lower() + msg.value = tonumber(msg.value) or msg.value + end + elseif msgt ~= "table" then + return + end + if msg.command == "get" then digilines.receptor_send(pos, digilines.rules.default, channel, { enabled = meta:get_int("enabled"), range = meta:get_int("range"), shape = meta:get_int("shape") }) return - elseif msg == "off" then + elseif msg.command == "off" then meta:set_int("enabled", 0) - elseif msg == "on" then + elseif msg.command == "on" then meta:set_int("enabled", 1) - elseif msg == "toggle" then + elseif msg.command == "toggle" then local onn = meta:get_int("enabled") onn = 1-onn -- Mirror onn with pivot 0.5, so switch between 1 and 0. meta:set_int("enabled", onn) - elseif msg:sub(1, 5) == "range" then - local range = tonumber(msg:sub(7)) - if not range then + elseif msg.command == "range" then + if type(msg.value) ~= "number" then return end - range = math.max(range, 5) - range = math.min(range, 20) + msg.value = math.max(msg.value, 5) + msg.value = math.min(msg.value, 20) update_forcefield(pos, meta, false) - meta:set_int("range", range) - elseif msg:sub(1, 5) == "shape" then - local shape = msg:sub(7):lower() - if shape == "sphere" then - shape = 0 - elseif shape == "cube" then - shape = 1 + meta:set_int("range", msg.value) + elseif msg.command == "shape" then + local valuet = type(msg.value) + if valuet == "string" then + if msg.value == "sphere" then + msg.value = 0 + elseif msg.value == "cube" then + msg.value = 1 + end + elseif valuet ~= "number" then + return end - shape = tonumber(shape) - if not shape then + if not msg.value then return end update_forcefield(pos, meta, false) - meta:set_int("shape", shape) + meta:set_int("shape", msg.value) else return end @@ -219,7 +243,8 @@ local digiline_def = { local function run(pos, node) local meta = minetest.get_meta(pos) local eu_input = meta:get_int("HV_EU_input") - local enabled = meta:get_int("enabled") ~= 0 and (meta:get_int("mesecon_mode") == 0 or meta:get_int("mesecon_effect") ~= 0) + local enabled = meta:get_int("enabled") ~= 0 and + (meta:get_int("mesecon_mode") == 0 or meta:get_int("mesecon_effect") ~= 0) local machine_name = S("%s Forcefield Emitter"):format("HV") local range = meta:get_int("range") @@ -315,6 +340,10 @@ minetest.register_node("technic:forcefield_emitter_on", { update_forcefield(pos, meta, false) technic.swap_node(pos, "technic:forcefield_emitter_off") end, + on_blast = function(pos, intensity) + minetest.dig_node(pos) + return {"technic:forcefield_emitter_off"} + end, }) minetest.register_node("technic:forcefield", { @@ -323,7 +352,7 @@ minetest.register_node("technic:forcefield", { drawtype = "glasslike", groups = {not_in_creative_inventory=1}, paramtype = "light", - light_source = 15, + light_source = default.LIGHT_MAX, diggable = false, drop = '', tiles = {{ @@ -335,6 +364,8 @@ minetest.register_node("technic:forcefield", { length = 1.0, }, }}, + on_blast = function(pos, intensity) + end, }) diff --git a/technic/machines/HV/nuclear_reactor.lua b/technic/machines/HV/nuclear_reactor.lua index 7338d28c..33777106 100644 --- a/technic/machines/HV/nuclear_reactor.lua +++ b/technic/machines/HV/nuclear_reactor.lua @@ -12,6 +12,8 @@ intact the reactor will melt down! local burn_ticks = 7 * 24 * 60 * 60 -- Seconds local power_supply = 100000 -- EUs local fuel_type = "technic:uranium_fuel" -- The reactor burns this +local digiline_meltdown = technic.config:get_bool("enable_nuclear_reactor_digiline_selfdestruct") +local digiline_remote_path = minetest.get_modpath("digiline_remote") local S = technic.getter @@ -28,12 +30,26 @@ minetest.register_craft({ } }) -local reactor_formspec = - "invsize[8,9;]".. +local function make_reactor_formspec(meta) + local f = "size[8,9]".. "label[0,0;"..S("Nuclear Reactor Rod Compartment").."]".. "list[current_name;src;2,1;3,2;]".. "list[current_player;main;0,5;8,4;]".. - "listring[]" + "listring[]".. + "button[5.5,1.5;2,1;start;Start]".. + "checkbox[5.5,2.5;autostart;automatic Start;"..meta:get_string("autostart").."]" + if not digiline_remote_path then + return f + end + local digiline_enabled = meta:get_string("enable_digiline") + f = f.."checkbox[0.5,2.8;enable_digiline;Enable Digiline;"..digiline_enabled.."]" + if digiline_enabled ~= "true" then + return f + end + return f.. + "button_exit[4.6,3.69;2,1;save;Save]".. + "field[1,4;4,1;remote_channel;Digiline Remote Channel;${remote_channel}]" +end local SS_OFF = 0 local SS_DANGER = 1 @@ -196,7 +212,37 @@ end local function melt_down_reactor(pos) minetest.log("action", "A reactor melted down at "..minetest.pos_to_string(pos)) - minetest.set_node(pos, {name="technic:corium_source"}) + minetest.set_node(pos, {name = "technic:corium_source"}) +end + + +local function start_reactor(pos, meta) + if minetest.get_node(pos).name ~= "technic:hv_nuclear_reactor_core" then + return false + end + local inv = meta:get_inventory() + if inv:is_empty("src") then + return false + end + local src_list = inv:get_list("src") + local correct_fuel_count = 0 + for _, src_stack in pairs(src_list) do + if src_stack and src_stack:get_name() == fuel_type then + correct_fuel_count = correct_fuel_count + 1 + end + end + -- Check that the reactor is complete and has the correct fuel + if correct_fuel_count ~= 6 or reactor_structure_badness(pos) ~= 0 then + return false + end + meta:set_int("burn_time", 1) + technic.swap_node(pos, "technic:hv_nuclear_reactor_core_active") + meta:set_int("HV_EU_supply", power_supply) + for idx, src_stack in pairs(src_list) do + src_stack:take_item() + inv:set_stack("src", idx, src_stack) + end + return true end @@ -229,27 +275,13 @@ minetest.register_abm({ local function run(pos, node) local meta = minetest.get_meta(pos) local burn_time = meta:get_int("burn_time") or 0 - if burn_time >= burn_ticks or burn_time == 0 then - local inv = meta:get_inventory() - if not inv:is_empty("src") then - local src_list = inv:get_list("src") - local correct_fuel_count = 0 - for _, src_stack in pairs(src_list) do - if src_stack and src_stack:get_name() == fuel_type then - correct_fuel_count = correct_fuel_count + 1 - end - end - -- Check that the reactor is complete and has the correct fuel - if correct_fuel_count == 6 and - reactor_structure_badness(pos) == 0 then - meta:set_int("burn_time", 1) - technic.swap_node(pos, "technic:hv_nuclear_reactor_core_active") - meta:set_int("HV_EU_supply", power_supply) - for idx, src_stack in pairs(src_list) do - src_stack:take_item() - inv:set_stack("src", idx, src_stack) - end + if digiline_remote_path and meta:get_int("HV_EU_supply") == power_supply then + digiline_remote.send_to_node(pos, meta:get_string("remote_channel"), + "fuel used", 6, true) + end + if meta:get_string("autostart") == "true" then + if start_reactor(pos, meta) then return end end @@ -268,6 +300,100 @@ local function run(pos, node) end end +local nuclear_reactor_receive_fields = function(pos, formname, fields, sender) + local player_name = sender:get_player_name() + if minetest.is_protected(pos, player_name) then + minetest.chat_send_player(player_name, "You are not allowed to edit this!") + minetest.record_protection_violation(pos, player_name) + return + end + local meta = minetest.get_meta(pos) + local update_formspec = false + if fields.remote_channel then + meta:set_string("remote_channel", fields.remote_channel) + end + if fields.start then + local b = start_reactor(pos, meta) + if b then + minetest.chat_send_player(player_name, "Start successful") + else + minetest.chat_send_player(player_name, "Error") + end + end + if fields.autostart then + meta:set_string("autostart", fields.autostart) + update_formspec = true + end + if fields.enable_digiline then + meta:set_string("enable_digiline", fields.enable_digiline) + update_formspec = true + end + if update_formspec then + meta:set_string("formspec", make_reactor_formspec(meta)) + end +end + +local digiline_remote_def = function(pos, channel, msg) + local meta = minetest.get_meta(pos) + if meta:get_string("enable_digiline") ~= "true" or + channel ~= meta:get_string("remote_channel") then + return + end + -- Convert string messages to tables: + local msgt = type(msg) + if msgt == "string" then + local smsg = msg:lower() + msg = {} + if smsg == "get" then + msg.command = "get" + elseif smsg:sub(1, 13) == "self_destruct" then + msg.command = "self_destruct" + msg.timer = tonumber(smsg:sub(15)) or 0 + elseif smsg == "start" then + msg.command = "start" + end + elseif msgt ~= "table" then + return + end + + if msg.command == "get" then + local inv = meta:get_inventory() + local invtable = {} + for i = 1, 6 do + local stack = inv:get_stack("src", i) + if stack:is_empty() then + invtable[i] = 0 + elseif stack:get_name() == fuel_type then + invtable[i] = stack:get_count() + else + invtable[i] = -stack:get_count() + end + end + digiline_remote.send_to_node(pos, channel, { + burn_time = meta:get_int("burn_time"), + enabled = meta:get_int("HV_EU_supply") == power_supply, + siren = meta:get_int("siren") == 1, + structure_accumulated_badness = meta:get_int("structure_accumulated_badness"), + rods = invtable + }, 6, true) + elseif digiline_meltdown and msg.command == "self_destruct" and + minetest.get_node(pos).name == "technic:hv_nuclear_reactor_core_active" then + if msg.timer ~= 0 and type(msg.timer) == "number" then + siren_danger(pos, meta) + minetest.after(msg.timer, melt_down_reactor, pos) + else + melt_down_reactor(pos) + end + elseif msg.command == "start" then + local b = start_reactor(pos, meta) + if b then + digiline_remote.send_to_node(pos, channel, "Start successful", 6, true) + else + digiline_remote.send_to_node(pos, channel, "Error", 6, true) + end + end +end + minetest.register_node("technic:hv_nuclear_reactor_core", { description = reactor_desc, tiles = { @@ -276,19 +402,25 @@ minetest.register_node("technic:hv_nuclear_reactor_core", { }, drawtype = "mesh", mesh = "technic_reactor.obj", - groups = {cracky=1, technic_machine=1, technic_hv=1}, + groups = {cracky = 1, technic_machine = 1, technic_hv = 1, digiline_remote_receive = 1}, legacy_facedir_simple = true, sounds = default.node_sound_wood_defaults(), paramtype = "light", paramtype2 = "facedir", stack_max = 1, + on_receive_fields = nuclear_reactor_receive_fields, on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("infotext", reactor_desc) - meta:set_string("formspec", reactor_formspec) + meta:set_string("formspec", make_reactor_formspec(meta)) + if digiline_remote_path then + meta:set_string("remote_channel", + "nucelear_reactor"..minetest.pos_to_string(pos)) + end local inv = meta:get_inventory() inv:set_size("src", 6) end, + _on_digiline_remote_receive = digiline_remote_def, can_dig = technic.machine_can_dig, on_destruct = function(pos) siren_set_state(pos, SS_OFF) end, allow_metadata_inventory_put = technic.machine_inventory_put, @@ -304,14 +436,16 @@ minetest.register_node("technic:hv_nuclear_reactor_core_active", { }, drawtype = "mesh", mesh = "technic_reactor.obj", - groups = {cracky=1, technic_machine=1, technic_hv=1, - radioactive=4, not_in_creative_inventory=1}, + groups = {cracky = 1, technic_machine = 1, technic_hv = 1, radioactive = 4, + not_in_creative_inventory = 1, digiline_remote_receive = 1}, legacy_facedir_simple = true, sounds = default.node_sound_wood_defaults(), drop = "technic:hv_nuclear_reactor_core", light_source = 14, paramtype = "light", paramtype2 = "facedir", + on_receive_fields = nuclear_reactor_receive_fields, + _on_digiline_remote_receive = digiline_remote_def, can_dig = technic.machine_can_dig, after_dig_node = melt_down_reactor, on_destruct = function(pos) siren_set_state(pos, SS_OFF) end, diff --git a/technic/machines/other/frames.lua b/technic/machines/other/frames.lua index 2d630a2a..54592899 100644 --- a/technic/machines/other/frames.lua +++ b/technic/machines/other/frames.lua @@ -3,7 +3,7 @@ local S = technic.getter frames = {} -local infinite_stacks = minetest.setting_getbool("creative_mode") and minetest.get_modpath("unified_inventory") == nil +local infinite_stacks = minetest.settings:get_bool("creative_mode") and minetest.get_modpath("unified_inventory") == nil local frames_pos = {} diff --git a/technic/machines/register/battery_box.lua b/technic/machines/register/battery_box.lua index c04875bc..84e992c3 100644 --- a/technic/machines/register/battery_box.lua +++ b/technic/machines/register/battery_box.lua @@ -12,12 +12,59 @@ technic.register_power_tool("technic:red_energy_crystal", 50000) technic.register_power_tool("technic:green_energy_crystal", 150000) technic.register_power_tool("technic:blue_energy_crystal", 450000) +-- Battery recipes: +-- Tin-copper recipe: minetest.register_craft({ - output = 'technic:battery', + output = "technic:battery", recipe = { - {'group:wood', 'default:copper_ingot', 'group:wood'}, - {'group:wood', 'moreores:tin_ingot', 'group:wood'}, - {'group:wood', 'default:copper_ingot', 'group:wood'}, + {"group:wood", "default:copper_ingot", "group:wood"}, + {"group:wood", "moreores:tin_ingot", "group:wood"}, + {"group:wood", "default:copper_ingot", "group:wood"}, + } +}) +-- Sulfur-lead-water recipes: +-- With sulfur lumps: +-- With water: +minetest.register_craft({ + output = "technic:battery", + recipe = { + {"group:wood", "technic:sulfur_lump", "group:wood"}, + {"technic:lead_ingot", "bucket:bucket_water", "technic:lead_ingot"}, + {"group:wood", "technic:sulfur_lump", "group:wood"}, + }, + replacements = { + {"bucket:bucket_water", "bucket:bucket_empty"} + } +}) +-- With oil extract: +minetest.register_craft({ + output = "technic:battery", + recipe = { + {"group:wood", "technic:sulfur_lump", "group:wood"}, + {"technic:lead_ingot", "homedecor:oil_extract", "technic:lead_ingot"}, + {"group:wood", "technic:sulfur_lump", "group:wood"}, + } +}) +-- With sulfur dust: +-- With water: +minetest.register_craft({ + output = "technic:battery", + recipe = { + {"group:wood", "technic:sulfur_dust", "group:wood"}, + {"technic:lead_ingot", "bucket:bucket_water", "technic:lead_ingot"}, + {"group:wood", "technic:sulfur_dust", "group:wood"}, + }, + replacements = { + {"bucket:bucket_water", "bucket:bucket_empty"} + } +}) +-- With oil extract: +minetest.register_craft({ + output = "technic:battery", + recipe = { + {"group:wood", "technic:sulfur_dust", "group:wood"}, + {"technic:lead_ingot", "homedecor:oil_extract", "technic:lead_ingot"}, + {"group:wood", "technic:sulfur_dust", "group:wood"}, } }) @@ -35,26 +82,38 @@ minetest.register_tool("technic:battery", { } }) +-- x+2 + (z+2)*2 +local dirtab = { + [4] = 2, + [5] = 3, + [7] = 1, + [8] = 0 +} + local tube = { insert_object = function(pos, node, stack, direction) - if direction.y == 0 then + print(minetest.pos_to_string(direction), dirtab[direction.x+2+(direction.z+2)*2], node.param2) + if direction.y == 1 + or (direction.y == 0 and dirtab[direction.x+2+(direction.z+2)*2] == node.param2) then return stack end local meta = minetest.get_meta(pos) local inv = meta:get_inventory() - if direction.y > 0 then + if direction.y == 0 then return inv:add_item("src", stack) else return inv:add_item("dst", stack) end end, can_insert = function(pos, node, stack, direction) - if direction.y == 0 then + print(minetest.pos_to_string(direction), dirtab[direction.x+2+(direction.z+2)*2], node.param2) + if direction.y == 1 + or (direction.y == 0 and dirtab[direction.x+2+(direction.z+2)*2] == node.param2) then return false end local meta = minetest.get_meta(pos) local inv = meta:get_inventory() - if direction.y > 0 then + if direction.y == 0 then if meta:get_int("split_src_stacks") == 1 then stack = stack:peek_item(1) end @@ -66,7 +125,7 @@ local tube = { return inv:room_for_item("dst", stack) end end, - connect_sides = {left=1, right=1, back=1, top=1, bottom=1}, + connect_sides = {left=1, right=1, back=1, top=1}, } local function add_on_off_buttons(meta, ltier, charge_percent) @@ -219,13 +278,12 @@ function technic.register_battery_box(data) local top_tex = "technic_"..ltier.."_battery_box_top.png"..tube_entry local front_tex = "technic_"..ltier.."_battery_box_front.png^technic_power_meter"..i..".png" local side_tex = "technic_"..ltier.."_battery_box_side.png"..tube_entry - local bottom_tex = "technic_"..ltier.."_battery_box_bottom.png"..tube_entry + local bottom_tex = "technic_"..ltier.."_battery_box_bottom.png"..cable_entry if ltier == "lv" then top_tex = "technic_"..ltier.."_battery_box_top.png" front_tex = "technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png" side_tex = "technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png" - bottom_tex = "technic_"..ltier.."_battery_box_bottom.png"..cable_entry end minetest.register_node("technic:"..ltier.."_battery_box"..i, { @@ -271,6 +329,7 @@ function technic.register_battery_box(data) allow_metadata_inventory_take = technic.machine_inventory_take, allow_metadata_inventory_move = technic.machine_inventory_move, technic_run = run, + on_rotate = screwdriver.rotate_simple, after_place_node = data.tube and pipeworks.after_place, after_dig_node = technic.machine_after_dig_node, on_receive_fields = function(pos, formname, fields, sender) diff --git a/technic/machines/register/cables.lua b/technic/machines/register/cables.lua index d65c399a..1e8cee90 100644 --- a/technic/machines/register/cables.lua +++ b/technic/machines/register/cables.lua @@ -203,12 +203,31 @@ function technic.register_cable(tier, size) def.on_place = function(itemstack, placer, pointed_thing) local pointed_thing_diff = vector.subtract(pointed_thing.above, pointed_thing.under) local num + local changed for k, v in pairs(pointed_thing_diff) do if v ~= 0 then + changed = k num = xyz[s(tostring(v):sub(-2, -2)..k)] break end end + local crtl = placer:get_player_control() + if (crtl.aux1 or crtl.sneak) and not (crtl.aux1 and crtl.sneak) then + local fine_pointed = minetest.pointed_thing_to_face_pos(placer, pointed_thing) + fine_pointed = vector.subtract(fine_pointed, pointed_thing.above) + fine_pointed[changed] = nil + local ps = {} + for p, _ in pairs(fine_pointed) do + ps[#ps+1] = p + end + local bigger = (math.abs(fine_pointed[ps[1]]) > math.abs(fine_pointed[ps[2]]) and ps[1]) or ps[2] + if math.abs(fine_pointed[bigger]) < 0.3 then + num = num + 3 + num = (num <= 6 and num) or num - 6 + else + num = xyz[((fine_pointed[bigger] < 0 and "-") or "") .. bigger] + end + end minetest.set_node(pointed_thing.above, {name = "technic:"..ltier.."_cable_plate_"..num}) if not (creative and creative.is_enabled_for(placer)) then itemstack:take_item() @@ -218,6 +237,19 @@ function technic.register_cable(tier, size) else def.groups.not_in_creative_inventory = 1 end + def.on_rotate = function(pos, node, user, mode, new_param2) + local dir = 0 + if mode == screwdriver.ROTATE_FACE then -- left-click + dir = 1 + elseif mode == screwdriver.ROTATE_AXIS then -- right-click + dir = -1 + end + local num = tonumber(node.name:sub(-1)) + num = num + dir + num = (num >= 1 and num) or num + 6 + num = (num <= 6 and num) or num - 6 + minetest.swap_node(pos, {name = "technic:"..ltier.."_cable_plate_"..num}) + end minetest.register_node("technic:"..ltier.."_cable_plate_"..i, def) cable_tier["technic:"..ltier.."_cable_plate_"..i] = tier end diff --git a/technic/machines/switching_station.lua b/technic/machines/switching_station.lua index 9c6f32c3..40b40e71 100644 --- a/technic/machines/switching_station.lua +++ b/technic/machines/switching_station.lua @@ -1,35 +1,4 @@ --- SWITCHING STATION --- The switching station is the center of all power distribution on an electric network. --- --- The station collects power from sources (PR), distributes it to sinks (RE), --- and uses the excess/shortfall to charge and discharge batteries (BA). --- --- For now, all supply and demand values are expressed in kW. --- --- It works like this: --- All PR,BA,RE nodes are indexed and tagged with the switching station. --- The tagging is to allow more stations to be built without allowing a cheat --- with duplicating power. --- All the RE nodes are queried for their current EU demand. Those which are off --- would require no or a small standby EU demand, while those which are on would --- require more. --- If the total demand is less than the available power they are all updated with the --- demand number. --- If any surplus exists from the PR nodes the batteries will be charged evenly with this. --- If the total demand requires draw on the batteries they will be discharged evenly. --- --- If the total demand is more than the available power all RE nodes will be shut down. --- We have a brown-out situation. --- --- Hence all the power distribution logic resides in this single node. --- --- Nodes connected to the network will have one or more of these parameters as meta data: --- _EU_supply : Exists for PR and BA node types. This is the EU value supplied by the node. Output --- _EU_demand : Exists for RE and BA node types. This is the EU value the node requires to run. Output --- _EU_input : Exists for RE and BA node types. This is the actual EU value the network can give the node. Input --- --- The reason the LV|MV|HV type is prepended toe meta data is because some machine could require several supplies to work. --- This way the supplies are separated per network. +-- See also technic/doc/api.md technic.networks = {} technic.cables = {} diff --git a/technic/radiation.lua b/technic/radiation.lua index 6a934838..722b0ac6 100644 --- a/technic/radiation.lua +++ b/technic/radiation.lua @@ -344,7 +344,7 @@ local function dmg_abm(pos, node) end end -if minetest.setting_getbool("enable_damage") then +if minetest.settings:get_bool("enable_damage") then minetest.register_abm({ label = "Radiation damage", nodenames = {"group:radioactive"}, @@ -384,7 +384,7 @@ for _, state in pairs({"flowing", "source"}) do minetest.register_node("technic:corium_"..state, { description = S(state == "source" and "Corium Source" or "Flowing Corium"), drawtype = (state == "source" and "liquid" or "flowingliquid"), - [state == "source" and "tiles" or "special_tiles"] = {{ + tiles = {{ name = "technic_corium_"..state.."_animated.png", animation = { type = "vertical_frames", @@ -393,6 +393,28 @@ for _, state in pairs({"flowing", "source"}) do length = 3.0, }, }}, + special_tiles = { + { + name = "technic_corium_"..state.."_animated.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 3.0, + }, + }, + { + name = "technic_corium_"..state.."_animated.png", + backface_culling = true, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 3.0, + }, + }, + }, paramtype = "light", paramtype2 = (state == "flowing" and "flowingliquid" or nil), light_source = (state == "source" and 8 or 5), diff --git a/technic/tools/vacuum.lua b/technic/tools/vacuum.lua index f5fac9aa..037f3bb1 100644 --- a/technic/tools/vacuum.lua +++ b/technic/tools/vacuum.lua @@ -26,7 +26,7 @@ minetest.register_tool("technic:vacuum", { end local pos = user:getpos() local inv = user:get_inventory() - for _, object in ipairs(minetest.env:get_objects_inside_radius(pos, vacuum_range)) do + for _, object in ipairs(minetest.get_objects_inside_radius(pos, vacuum_range)) do local luaentity = object:get_luaentity() if not object:is_player() and luaentity and luaentity.name == "__builtin:item" and luaentity.itemstring ~= "" then if inv and inv:room_for_item("main", ItemStack(luaentity.itemstring)) then diff --git a/technic_chests/locale/es.txt b/technic_chests/locale/es.txt new file mode 100644 index 00000000..ec38d3f9 --- /dev/null +++ b/technic_chests/locale/es.txt @@ -0,0 +1,39 @@ +# technic_chests translation template + +%s Chest = Cofre de %s +%s Locked Chest = Cofre de %s Bloqueado +%s Locked Chest (owned by %s) = Cofre de %s Bloqueado (propiedad de %s) +Color Filter: %s = Filtro por Color: %s +Edit chest description: = Editar la descripción del cofre + +# Colors +Black = Negro +Blue = Azul +Brown = Café +Cyan = Cian +Dark Green = Verde Oscuro +Dark Grey = Gris Oscuro +Green = Verde +Grey = Gris +Magenta = Magenta +Orange = Naranja +Pink = Rosado +Red = Rojo +Violet = Violeta +White = Blanco +Yellow = Amarillo +None = Ninguno + +# Materials +Copper = Cobre +Gold = Oro +Iron = Hierro +Mithril = Mitrilo +Silver = Plata +Wooden = Madera + +# Sorting +Sort = Ordenar +Auto-sort is %s = El orden Automático esta %s +Off = Apagado +On = Encendido diff --git a/technic_worldgen/locale/es.txt b/technic_worldgen/locale/es.txt new file mode 100644 index 00000000..a3920c26 --- /dev/null +++ b/technic_worldgen/locale/es.txt @@ -0,0 +1,36 @@ +# technic_worldgen traducido por Carlos Barraza + +###crafts.lua +Uranium Lump = Pepita de Uranio +Uranium Ingot = Lingote de Uranio +Chromium Lump = Pepita de Cromo +Chromium Ingot = Lingote de Cromo +Zinc Lump = Pepita de Zinc +Zinc Ingot = Lingote de Zinc +Brass Ingot = Lingote de Latón +Wrought Iron Ingot = Lingote de Hierro Forjado +Cast Iron Ingot = Lingote de Hierro Fundido +Carbon Steel Ingot = Lingote de Acero al Carbon +Stainless Steel Ingot = Lingote de Acero inoxidable +Iron = Lingote + +###nodes.lua +Uranium Ore = Mineral de Uranio +Chromium Ore = Mineral de Cromo +Zinc Ore = Mineral de Zinc +Granite = Granito +Marble = Mármol +Marble Bricks = Ladrillos de Mármol +Uranium Block = Bloque de Uranio +Chromium Block = Bloque de Cromo +Zinc Block = Bloque de Zinc +Wrought Iron Block = Bloque de Hierro Forjado +Cast Iron Block = Bloque de Hierro Fundido +Carbon Steel Block = Bloque de Acero al Carbon +Stainless Steel Block = Bloque de Acero Inoxidable +Brass Block = Bloque de Latón +Wrought Iron = Hierro Forjado + +###rubber.lua +Rubber Tree Sapling = Retoño de Árbol de Goma +Rubber Tree = Árbol de Goma diff --git a/technic_worldgen/oregen.lua b/technic_worldgen/oregen.lua index 96a3c197..8e7af917 100644 --- a/technic_worldgen/oregen.lua +++ b/technic_worldgen/oregen.lua @@ -118,7 +118,7 @@ minetest.register_ore({ }) -- Sulfur -local sulfur_buf = nil +local sulfur_buf = {} local sulfur_noise= nil minetest.register_on_generated(function(minp, maxp, seed) diff --git a/technic_worldgen/rubber.lua b/technic_worldgen/rubber.lua index 3307b8b2..11da9ca8 100644 --- a/technic_worldgen/rubber.lua +++ b/technic_worldgen/rubber.lua @@ -10,7 +10,7 @@ minetest.register_node(":moretrees:rubber_tree_sapling", { wield_image = "technic_rubber_sapling.png", paramtype = "light", walkable = false, - groups = {dig_immediate=3, flammable=2}, + groups = {dig_immediate=3, flammable=2, sapling=1}, sounds = default.node_sound_defaults(), }) @@ -98,4 +98,3 @@ if technic.config:get_bool("enable_rubber_tree_generation") then end end) end - diff --git a/unified_inventory/README.md b/unified_inventory/README.md index 489ebab0..d0ca9cfa 100644 --- a/unified_inventory/README.md +++ b/unified_inventory/README.md @@ -20,4 +20,4 @@ RealBadAngel: (WTFPL) * Everything else. Tango Project: (WTFPL) - * `ui_reset_icon.png + * `ui_reset_icon.png` diff --git a/unifiedbricks/init.lua b/unifiedbricks/init.lua index 4d1f44c9..80eba028 100644 --- a/unifiedbricks/init.lua +++ b/unifiedbricks/init.lua @@ -95,11 +95,12 @@ FORMALDARKNESS = { minetest.register_node("unifiedbricks:brickblock", { description = "Brick Block", tiles = { - "unifiedbricks_brickblock.png", - { name = "unifiedbricks_mortar.png", color = 0xffffffff }, + "unifiedbricks_brickblock.png" }, - drawtype = "mesh", - mesh = "unifiedbricks_brick_block.obj", + overlay_tiles = { + { name = "unifiedbricks_mortar.png", color = "white" } + }, + use_texture_alpha = true, paramtype = "light", paramtype2 = "color", palette = "unifieddyes_palette_extended.png", @@ -150,10 +151,11 @@ minetest.register_node("unifiedbricks:brickblock_multicolor_dark", { description = "Brick block (dark multicolor)", tiles = { "unifiedbricks_brickblock_multicolor_dark.png", - { name = "unifiedbricks_mortar.png", color = 0xffffffff }, }, - drawtype = "mesh", - mesh = "unifiedbricks_brick_block.obj", + overlay_tiles = { + { name = "unifiedbricks_mortar2.png", color = "white" } + }, + use_texture_alpha = true, paramtype = "light", paramtype2 = "color", palette = "unifieddyes_palette_extended.png", @@ -169,11 +171,12 @@ minetest.register_node("unifiedbricks:brickblock_multicolor_dark", { minetest.register_node("unifiedbricks:brickblock_multicolor_medium", { description = "Brick block (medium multicolor)", tiles = { - "unifiedbricks_brickblock_multicolor_medium.png", - { name = "unifiedbricks_mortar.png", color = 0xffffffff }, + "unifiedbricks_brickblock_multicolor_medium.png" }, - drawtype = "mesh", - mesh = "unifiedbricks_brick_block.obj", + overlay_tiles = { + { name = "unifiedbricks_mortar3.png", color = "white" } + }, + use_texture_alpha = true, paramtype = "light", paramtype2 = "color", palette = "unifieddyes_palette_extended.png", @@ -189,11 +192,12 @@ minetest.register_node("unifiedbricks:brickblock_multicolor_medium", { minetest.register_node("unifiedbricks:brickblock_multicolor_light", { description = "Brick block (light multicolor)", tiles = { - "unifiedbricks_brickblock_multicolor_light.png", - { name = "unifiedbricks_mortar.png", color = 0xffffffff }, + "unifiedbricks_brickblock_multicolor_light.png" }, - drawtype = "mesh", - mesh = "unifiedbricks_brick_block.obj", + overlay_tiles = { + { name = "unifiedbricks_mortar4.png", color = "white" } + }, + use_texture_alpha = true, paramtype = "light", paramtype2 = "color", palette = "unifieddyes_palette_extended.png", diff --git a/unifiedbricks/textures/unifiedbricks_mortar2.png b/unifiedbricks/textures/unifiedbricks_mortar2.png new file mode 100644 index 0000000000000000000000000000000000000000..6d523356f57e57e548d53e184dd872248f8f4c95 GIT binary patch literal 247 zcmVfRRsVn%VHKpjPbE2JwCvD50fCJWD=cc)45sc&bPV-&wh!8y x+~Jdva?a?cX)41oz&UqR-QT$NN2^~%umL4Xb{z*kLW2MR002ovPDHLkV1lVJWWfLc literal 0 HcmV?d00001 diff --git a/unifiedbricks/textures/unifiedbricks_mortar3.png b/unifiedbricks/textures/unifiedbricks_mortar3.png new file mode 100644 index 0000000000000000000000000000000000000000..6d523356f57e57e548d53e184dd872248f8f4c95 GIT binary patch literal 247 zcmVfRRsVn%VHKpjPbE2JwCvD50fCJWD=cc)45sc&bPV-&wh!8y x+~Jdva?a?cX)41oz&UqR-QT$NN2^~%umL4Xb{z*kLW2MR002ovPDHLkV1lVJWWfLc literal 0 HcmV?d00001 diff --git a/unifiedbricks/textures/unifiedbricks_mortar4.png b/unifiedbricks/textures/unifiedbricks_mortar4.png new file mode 100644 index 0000000000000000000000000000000000000000..6d523356f57e57e548d53e184dd872248f8f4c95 GIT binary patch literal 247 zcmVfRRsVn%VHKpjPbE2JwCvD50fCJWD=cc)45sc&bPV-&wh!8y x+~Jdva?a?cX)41oz&UqR-QT$NN2^~%umL4Xb{z*kLW2MR002ovPDHLkV1lVJWWfLc literal 0 HcmV?d00001 diff --git a/unifieddyes/init.lua b/unifieddyes/init.lua index 9b85903b..35b2e729 100644 --- a/unifieddyes/init.lua +++ b/unifieddyes/init.lua @@ -33,7 +33,7 @@ unifieddyes = {} unifieddyes.last_used_dye = {} unifieddyes.last_dyed_node = {} -local creative_mode = minetest.setting_getbool("creative_mode") +local creative_mode = minetest.settings:get_bool("creative_mode") -- Boilerplate to support localized strings if intllib mod is installed. local S @@ -207,8 +207,8 @@ end) function unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) local node = minetest.get_node(pos) - local yaw = placer:get_look_yaw() - local dir = minetest.yaw_to_dir(yaw-1.5) + local yaw = placer:get_look_horizontal() + local dir = minetest.yaw_to_dir(yaw) -- -1.5) local pitch = placer:get_look_vertical() local fdir = minetest.dir_to_wallmounted(dir) @@ -226,8 +226,8 @@ end function unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) local node = minetest.get_node(pos) - local yaw = placer:get_look_yaw() - local dir = minetest.yaw_to_dir(yaw) + local yaw = placer:get_look_horizontal() + local dir = minetest.yaw_to_dir(yaw+1.5) local fdir = minetest.dir_to_wallmounted(dir) minetest.swap_node(pos, { name = node.name, param2 = fdir }) end diff --git a/worldedit_commands/init.lua b/worldedit_commands/init.lua index 12c296c9..325a31c7 100644 --- a/worldedit_commands/init.lua +++ b/worldedit_commands/init.lua @@ -1123,16 +1123,13 @@ minetest.register_chatcommand("/lua", { description = "Executes as a Lua chunk in the global namespace", privs = {worldedit=true, server=true}, func = function(name, param) - local admin = minetest.setting_get("name") - if not admin or not name == admin then - worldedit.player_notify(name, "this command can only be run by the server administrator") - return - end local err = worldedit.lua(param) if err then worldedit.player_notify(name, "code error: " .. err) + minetest.log("action", name.." tried to execute "..param) else worldedit.player_notify(name, "code successfully executed", false) + minetest.log("action", name.." executed "..param) end end, }) @@ -1142,17 +1139,13 @@ minetest.register_chatcommand("/luatransform", { description = "Executes as a Lua chunk in the global namespace with the variable pos available, for each node in the current WorldEdit region", privs = {worldedit=true, server=true}, func = safe_region(function(name, param) - local admin = minetest.setting_get("name") - if not admin or not name == admin then - worldedit.player_notify(name, "this command can only be run by the server administrator") - return - end - local err = worldedit.luatransform(worldedit.pos1[name], worldedit.pos2[name], param) if err then worldedit.player_notify(name, "code error: " .. err, false) + minetest.log("action", name.." tried to execute luatransform "..param) else worldedit.player_notify(name, "code successfully executed", false) + minetest.log("action", name.." executed luatransform "..param) end end), }) diff --git a/worldedit_gui/functionality.lua b/worldedit_gui/functionality.lua index 5cbf8fa6..17a8a79b 100644 --- a/worldedit_gui/functionality.lua +++ b/worldedit_gui/functionality.lua @@ -46,7 +46,7 @@ local combine_privs = function(...) for i, privs in ipairs({...}) do for name, value in pairs(privs) do if result[name] ~= nil and result[name] ~= value then --the priv must be both true and false, which can never happen - return {__fake_priv_that_nobody_has__=true} --priviledge table that can never be satisfied + return {__fake_priv_that_nobody_has__=true} --privilege table that can never be satisfied end result[name] = value end @@ -60,22 +60,38 @@ local formspec_node = function(pos, nodename) or string.format("image[%s;1,1;worldedit_gui_unknown.png]", pos) end +-- two further priv helpers +local function we_privs(command) + return minetest.chatcommands["/" .. command].privs +end + +local function combine_we_privs(list) + local args = {} + for _, t in ipairs(list) do + table.insert(args, we_privs(t)) + end + return combine_privs(unpack(args)) +end + worldedit.register_gui_function("worldedit_gui_about", { - name = "About", privs = minetest.chatcommands["/about"].privs, + name = "About", + privs = {interact=true}, on_select = function(name) minetest.chatcommands["/about"].func(name, "") end, }) worldedit.register_gui_function("worldedit_gui_inspect", { - name = "Toggle Inspect", privs = minetest.chatcommands["/inspect"].privs, + name = "Toggle Inspect", + privs = we_privs("inspect"), on_select = function(name) minetest.chatcommands["/inspect"].func(name, worldedit.inspect[name] and "disable" or "enable") end, }) worldedit.register_gui_function("worldedit_gui_region", { - name = "Get/Set Region", privs = combine_privs(minetest.chatcommands["/p"].privs, minetest.chatcommands["/pos1"].privs, minetest.chatcommands["/pos2"].privs, minetest.chatcommands["/reset"].privs, minetest.chatcommands["/mark"].privs, minetest.chatcommands["/unmark"].privs, minetest.chatcommands["/volume"].privs, minetest.chatcommands["/fixedpos"].privs), + name = "Get/Set Region", + privs = combine_we_privs({"p", "pos1", "pos2", "reset", "mark", "unmark", "volume", "fixedpos"}), get_formspec = function(name) local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] return "size[9,7]" .. worldedit.get_formspec_header("worldedit_gui_region") .. @@ -154,7 +170,8 @@ worldedit.register_gui_handler("worldedit_gui_region", function(name, fields) end) worldedit.register_gui_function("worldedit_gui_set", { - name = "Set Nodes", privs = minetest.chatcommands["/set"].privs, + name = "Set Nodes", + privs = we_privs("set"), get_formspec = function(name) local node = gui_nodename1[name] local nodename = worldedit.normalize_nodename(node) @@ -182,7 +199,8 @@ worldedit.register_gui_handler("worldedit_gui_set", function(name, fields) end) worldedit.register_gui_function("worldedit_gui_replace", { - name = "Replace Nodes", privs = combine_privs(minetest.chatcommands["/replace"].privs, minetest.chatcommands["/replaceinverse"].privs), + name = "Replace Nodes", + privs = combine_we_privs({"replace", "replaceinverse"}), get_formspec = function(name) local search, replace = gui_nodename1[name], gui_nodename2[name] local search_nodename, replace_nodename = worldedit.normalize_nodename(search), worldedit.normalize_nodename(replace) @@ -224,7 +242,8 @@ worldedit.register_gui_handler("worldedit_gui_replace", function(name, fields) end) worldedit.register_gui_function("worldedit_gui_sphere_dome", { - name = "Sphere/Dome", privs = combine_privs(minetest.chatcommands["/hollowsphere"].privs, minetest.chatcommands["/sphere"].privs, minetest.chatcommands["/hollowdome"].privs, minetest.chatcommands["/dome"].privs), + name = "Sphere/Dome", + privs = combine_we_privs({"hollowsphere", "sphere", "hollowdome", "dome"}), get_formspec = function(name) local node, radius = gui_nodename1[name], gui_distance2[name] local nodename = worldedit.normalize_nodename(node) @@ -270,7 +289,8 @@ worldedit.register_gui_handler("worldedit_gui_sphere_dome", function(name, field end) worldedit.register_gui_function("worldedit_gui_cylinder", { - name = "Cylinder", privs = combine_privs(minetest.chatcommands["/hollowcylinder"].privs, minetest.chatcommands["/cylinder"].privs), + name = "Cylinder", + privs = combine_we_privs({"hollowcylinder", "cylinder"}), get_formspec = function(name) local node, axis, length, radius = gui_nodename1[name], gui_axis1[name], gui_distance1[name], gui_distance2[name] local nodename = worldedit.normalize_nodename(node) @@ -318,7 +338,8 @@ worldedit.register_gui_handler("worldedit_gui_cylinder", function(name, fields) end) worldedit.register_gui_function("worldedit_gui_pyramid", { - name = "Pyramid", privs = minetest.chatcommands["/pyramid"].privs, + name = "Pyramid", + privs = we_privs("pyramid"), get_formspec = function(name) local node, axis, length = gui_nodename1[name], gui_axis1[name], gui_distance1[name] local nodename = worldedit.normalize_nodename(node) @@ -363,7 +384,8 @@ worldedit.register_gui_handler("worldedit_gui_pyramid", function(name, fields) end) worldedit.register_gui_function("worldedit_gui_spiral", { - name = "Spiral", privs = minetest.chatcommands["/spiral"].privs, + name = "Spiral", + privs = we_privs("spiral"), get_formspec = function(name) local node, length, height, space = gui_nodename1[name], gui_distance1[name], gui_distance2[name], gui_distance3[name] local nodename = worldedit.normalize_nodename(node) @@ -397,7 +419,8 @@ worldedit.register_gui_handler("worldedit_gui_spiral", function(name, fields) end) worldedit.register_gui_function("worldedit_gui_copy_move", { - name = "Copy/Move", privs = combine_privs(minetest.chatcommands["/copy"].privs, minetest.chatcommands["/move"].privs), + name = "Copy/Move", + privs = combine_we_privs({"copy", "move"}), get_formspec = function(name) local axis = gui_axis1[name] or 4 local amount = gui_distance1[name] or "10" @@ -430,7 +453,8 @@ worldedit.register_gui_handler("worldedit_gui_copy_move", function(name, fields) end) worldedit.register_gui_function("worldedit_gui_stack", { - name = "Stack", privs = minetest.chatcommands["/stack"].privs, + name = "Stack", + privs = we_privs("stack"), get_formspec = function(name) local axis, count = gui_axis1[name], gui_count1[name] return "size[6.5,3]" .. worldedit.get_formspec_header("worldedit_gui_stack") .. @@ -457,7 +481,8 @@ worldedit.register_gui_handler("worldedit_gui_stack", function(name, fields) end) worldedit.register_gui_function("worldedit_gui_stretch", { - name = "Stretch", privs = minetest.chatcommands["/stretch"].privs, + name = "Stretch", + privs = we_privs("stretch"), get_formspec = function(name) local stretchx, stretchy, stretchz = gui_count1[name], gui_count2[name], gui_count3[name] return "size[5,5]" .. worldedit.get_formspec_header("worldedit_gui_stretch") .. @@ -481,7 +506,8 @@ worldedit.register_gui_handler("worldedit_gui_stretch", function(name, fields) end) worldedit.register_gui_function("worldedit_gui_transpose", { - name = "Transpose", privs = minetest.chatcommands["/transpose"].privs, + name = "Transpose", + privs = we_privs("transpose"), get_formspec = function(name) local axis1, axis2 = gui_axis1[name], gui_axis2[name] return "size[5.5,3]" .. worldedit.get_formspec_header("worldedit_gui_transpose") .. @@ -512,7 +538,8 @@ worldedit.register_gui_handler("worldedit_gui_transpose", function(name, fields) end) worldedit.register_gui_function("worldedit_gui_flip", { - name = "Flip", privs = minetest.chatcommands["/flip"].privs, + name = "Flip", + privs = we_privs("flip"), get_formspec = function(name) local axis = gui_axis1[name] return "size[5,3]" .. worldedit.get_formspec_header("worldedit_gui_flip") .. @@ -537,7 +564,8 @@ worldedit.register_gui_handler("worldedit_gui_flip", function(name, fields) end) worldedit.register_gui_function("worldedit_gui_rotate", { - name = "Rotate", privs = minetest.chatcommands["/rotate"].privs, + name = "Rotate", + privs = we_privs("rotate"), get_formspec = function(name) local axis, angle = gui_axis1[name], gui_angle[name] return "size[5.5,3]" .. worldedit.get_formspec_header("worldedit_gui_rotate") .. @@ -569,7 +597,8 @@ worldedit.register_gui_handler("worldedit_gui_rotate", function(name, fields) end) worldedit.register_gui_function("worldedit_gui_orient", { - name = "Orient", privs = minetest.chatcommands["/orient"].privs, + name = "Orient", + privs = we_privs("orient"), get_formspec = function(name) local angle = gui_angle[name] return "size[5,3]" .. worldedit.get_formspec_header("worldedit_gui_orient") .. @@ -594,21 +623,24 @@ worldedit.register_gui_handler("worldedit_gui_orient", function(name, fields) end) worldedit.register_gui_function("worldedit_gui_fixlight", { - name = "Fix Lighting", privs = minetest.chatcommands["/fixlight"].privs, + name = "Fix Lighting", + privs = we_privs("fixlight"), on_select = function(name) minetest.chatcommands["/fixlight"].func(name, "") end, }) worldedit.register_gui_function("worldedit_gui_hide", { - name = "Hide Region", privs = minetest.chatcommands["/hide"].privs, + name = "Hide Region", + privs = we_privs("hide"), on_select = function(name) minetest.chatcommands["/hide"].func(name, "") end, }) worldedit.register_gui_function("worldedit_gui_suppress", { - name = "Suppress Nodes", privs = minetest.chatcommands["/suppress"].privs, + name = "Suppress Nodes", + privs = we_privs("suppress"), get_formspec = function(name) local node = gui_nodename1[name] local nodename = worldedit.normalize_nodename(node) @@ -636,7 +668,8 @@ worldedit.register_gui_handler("worldedit_gui_suppress", function(name, fields) end) worldedit.register_gui_function("worldedit_gui_highlight", { - name = "Highlight Nodes", privs = minetest.chatcommands["/highlight"].privs, + name = "Highlight Nodes", + privs = we_privs("highlight"), get_formspec = function(name) local node = gui_nodename1[name] local nodename = worldedit.normalize_nodename(node) @@ -664,14 +697,16 @@ worldedit.register_gui_handler("worldedit_gui_highlight", function(name, fields) end) worldedit.register_gui_function("worldedit_gui_restore", { - name = "Restore Region", privs = minetest.chatcommands["/restore"].privs, + name = "Restore Region", + privs = we_privs("restore"), on_select = function(name) minetest.chatcommands["/restore"].func(name, "") end, }) worldedit.register_gui_function("worldedit_gui_save_load", { - name = "Save/Load", privs = combine_privs(minetest.chatcommands["/save"].privs, minetest.chatcommands["/allocate"].privs, minetest.chatcommands["/load"].privs), + name = "Save/Load", + privs = combine_we_privs({"save", "allocate", "load"}), get_formspec = function(name) local filename = gui_filename[name] return "size[6,4]" .. worldedit.get_formspec_header("worldedit_gui_save_load") .. @@ -700,6 +735,7 @@ end) worldedit.register_gui_function("worldedit_gui_lua", { name = "Run Lua", + privs = we_privs("lua"), get_formspec = function(name) local code = gui_code[name] return "size[8,6.5]" .. worldedit.get_formspec_header("worldedit_gui_lua") .. @@ -724,28 +760,9 @@ worldedit.register_gui_handler("worldedit_gui_lua", function(name, fields) end) worldedit.register_gui_function("worldedit_gui_clearobjects", { - name = "Clear Objects", privs = minetest.chatcommands["/clearobjects"].privs, + name = "Clear Objects", + privs = we_privs("clearobjects"), on_select = function(name) minetest.chatcommands["/clearobjects"].func(name, "") end, }) - -worldedit.register_gui_function("worldedit_gui_formspec_tester", { - name = "Formspec Tester", - get_formspec = function(name) - local value = gui_formspec[name] - return "size[8,6.5]" .. worldedit.get_formspec_header("worldedit_gui_formspec_tester") .. - string.format("textarea[0.5,1;7.5,5.5;worldedit_gui_formspec_tester_value;Formspec Code;%s]", minetest.formspec_escape(value)) .. - "button_exit[0,6;3,0.8;worldedit_gui_formspec_tester_show;Show Formspec]" - end, -}) - -worldedit.register_gui_handler("worldedit_gui_formspec_tester", function(name, fields) - if fields.worldedit_gui_formspec_tester_show then - gui_formspec[name] = fields.worldedit_gui_formspec_tester_value or "" - worldedit.show_page(name, "worldedit_gui_formspec_tester") - minetest.show_formspec(name, "worldedit:formspec_tester", gui_formspec[name]) - return true - end - return false -end) diff --git a/worldedit_gui/init.lua b/worldedit_gui/init.lua index 0a770c6b..dafd7c26 100644 --- a/worldedit_gui/init.lua +++ b/worldedit_gui/init.lua @@ -14,7 +14,7 @@ Use `nil` for the `options` parameter to unregister the function associated with Use `nil` for the `get_formspec` field to denote that the function does not have its own screen. -Use `nil` for the `privs` field to denote that no special privileges are required to use the function. +The `privs` field may not be `nil`. If the identifier is already registered to another function, it will be replaced by the new one. @@ -24,6 +24,9 @@ The `on_select` function must not call `worldedit.show_page` worldedit.pages = {} --mapping of identifiers to options local identifiers = {} --ordered list of identifiers worldedit.register_gui_function = function(identifier, options) + if options.privs == nil or next(options.privs) == nil then + error("privs unset") + end worldedit.pages[identifier] = options table.insert(identifiers, identifier) end @@ -46,7 +49,7 @@ worldedit.register_gui_handler = function(identifier, handler) --ensure the player has permission to perform the action local entry = worldedit.pages[identifier] - if entry and minetest.check_player_privs(name, entry.privs or {}) then + if entry and minetest.check_player_privs(name, entry.privs) then return handler(name, fields) end return false @@ -240,6 +243,7 @@ end worldedit.register_gui_function("worldedit_gui", { name = "WorldEdit GUI", + privs = {interact=true}, get_formspec = function(name) --create a form with all the buttons arranged in a grid local buttons, x, y, index = {}, 0, 1, 0 @@ -272,7 +276,7 @@ worldedit.register_gui_handler("worldedit_gui", function(name, fields) for identifier, entry in pairs(worldedit.pages) do --check for WorldEdit GUI main formspec button selection if fields[identifier] and identifier ~= "worldedit_gui" then --ensure player has permission to perform action - local has_privs, missing_privs = minetest.check_player_privs(name, entry.privs or {}) + local has_privs, missing_privs = minetest.check_player_privs(name, entry.privs) if not has_privs then worldedit.player_notify(name, "you are not allowed to use this function (missing privileges: " .. table.concat(missing_privs, ", ") .. ")") return false diff --git a/wrench/init.lua b/wrench/init.lua index 76605c48..f99fd143 100644 --- a/wrench/init.lua +++ b/wrench/init.lua @@ -39,9 +39,10 @@ local function restore(pos, placer, itemstack) local node = minetest.get_node(pos) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() - local data = minetest.deserialize(itemstack:get_metadata()) + local data = itemstack:get_meta():get_string("data") + data = (data ~= "" and data) or itemstack:get_metadata() + data = minetest.deserialize(data) minetest.set_node(pos, {name = data.name, param2 = node.param2}) - local lists = data.lists for name, value in pairs(data.metas) do local meta_type = get_meta_type(data.name, name) if meta_type == wrench.META_TYPE_INT then @@ -52,6 +53,7 @@ local function restore(pos, placer, itemstack) meta:set_string(name, value) end end + local lists = data.lists for listname, list in pairs(lists) do inv:set_list(listname, list) end @@ -96,8 +98,9 @@ minetest.register_tool("wrench:wrench", { if not placer or not pos then return end - if minetest.is_protected(pos, placer:get_player_name()) then - minetest.record_protection_violation(pos, placer:get_player_name()) + local player_name = placer:get_player_name() + if minetest.is_protected(pos, player_name) then + minetest.record_protection_violation(pos, player_name) return end local name = minetest.get_node(pos).name @@ -114,9 +117,9 @@ minetest.register_tool("wrench:wrench", { local meta = minetest.get_meta(pos) if def.owned then local owner = meta:get_string("owner") - if owner and owner ~= placer:get_player_name() then - minetest.log("action", placer:get_player_name().. - " tried to pick up a owned node belonging to ".. + if owner and owner ~= player_name then + minetest.log("action", player_name.. + " tried to pick up an owned node belonging to ".. owner.." at ".. minetest.pos_to_string(pos)) return @@ -130,9 +133,6 @@ minetest.register_tool("wrench:wrench", { local inv = meta:get_inventory() local lists = {} for _, listname in pairs(def.lists or {}) do - if not inv:is_empty(listname) then - empty = false - end local list = inv:get_list(listname) for i, stack in pairs(list) do list[i] = stack:to_string() @@ -140,20 +140,20 @@ minetest.register_tool("wrench:wrench", { lists[listname] = list end metadata.lists = lists - - local metas = {} + + local item_meta = stack:get_meta() + metadata.metas = {} for name, meta_type in pairs(def.metas or {}) do if meta_type == wrench.META_TYPE_INT then - metas[name] = meta:get_int(name) + metadata.metas[name] = meta:get_int(name) elseif meta_type == wrench.META_TYPE_FLOAT then - metas[name] = meta:get_float(name) + metadata.metas[name] = meta:get_float(name) elseif meta_type == wrench.META_TYPE_STRING then - metas[name] = meta:get_string(name) + metadata.metas[name] = meta:get_string(name) end end - metadata.metas = metas - - stack:set_metadata(minetest.serialize(metadata)) + + item_meta:set_string("data", minetest.serialize(metadata)) minetest.remove_node(pos) itemstack:add_wear(65535 / 20) player_inv:add_item("main", stack) diff --git a/wrench/locale/es.txt b/wrench/locale/es.txt new file mode 100644 index 00000000..1d79a96e --- /dev/null +++ b/wrench/locale/es.txt @@ -0,0 +1,5 @@ +# technic_wrench traducido por Carlos Barraza + +Wrench = Llave Inglesa +%s with items = %s con elementos + diff --git a/xban2/README.md b/xban2/README.md new file mode 100644 index 00000000..90eed0da --- /dev/null +++ b/xban2/README.md @@ -0,0 +1,106 @@ + +# Extended Ban Mod for Minetest + +This mod attempts to be an improvement to Minetest's ban system. + +* It supports normal bans and temporary bans (from 60 seconds up to the end of + time, with 1 second granularity). +* Records and joins all accounts using the same IP address and several IP + addresses using the same name into a single record, and can ban/unban them as + a single user. +* Can ban offline players if you know their IP or username. +* Holds a record of bans for each user, so moderators and administrators can + consult it to know if a player is a repeat offender. +* Does not modify the default ban database in any way (`ipban.txt'). +* Has an API to ban and check the ban database to allows other mods to manage + users (for example, anticheat mods). + +## Chat commands + +The mod provides the following chat commands. All commands require the `ban` +privilege. + +### `xban` + +Bans a player permanently. + +**Usage:** `/xban ` + +**Example:** `/xban 127.0.0.1 Some reason.` + +### `xtempban` + +Bans a player temporarily. + +**Usage:** `/xtempban