From 026c1ae6fe8e3f88550e9c734914952137303254 Mon Sep 17 00:00:00 2001 From: Louis <55180044+louisroyer@users.noreply.github.com> Date: Tue, 18 Feb 2020 14:32:36 +0100 Subject: [PATCH] Fix translation of wrought iron blocks Note: nodes to convert from steel blocks to wroughtiron blocks now require to be added manually since doing this automatically breaks translations. --- .../locale/technic_worldgen.de.tr | 6 ++ .../locale/technic_worldgen.es.tr | 6 ++ .../locale/technic_worldgen.fr.tr | 6 ++ .../locale/technic_worldgen.pl.tr | 6 ++ .../locale/technic_worldgen.pt_BR.tr | 6 ++ .../locale/technic_worldgen.tr.tr | 6 ++ technic_worldgen/locale/template.txt | 6 ++ technic_worldgen/mod.conf | 2 +- technic_worldgen/nodes.lua | 75 +++++++++---------- 9 files changed, 78 insertions(+), 41 deletions(-) diff --git a/technic_worldgen/locale/technic_worldgen.de.tr b/technic_worldgen/locale/technic_worldgen.de.tr index 6d50082..931bb53 100644 --- a/technic_worldgen/locale/technic_worldgen.de.tr +++ b/technic_worldgen/locale/technic_worldgen.de.tr @@ -47,6 +47,12 @@ Stainless Steel Block=Edelstahlblock Brass Block=Messingblock Wrought Iron=Schmiedeeisen +#### Steel to wrought iron +Outer Wrought Iron Block Stair= +Inner Wrought Iron Block Stair= +Wrought Iron Block Stair= +Wrought Iron Block Slab= + ## rubber.lua Rubber Tree Sapling=Gummibaumsetzling Rubber Tree=Gummibaum diff --git a/technic_worldgen/locale/technic_worldgen.es.tr b/technic_worldgen/locale/technic_worldgen.es.tr index 155ee85..7eb364f 100644 --- a/technic_worldgen/locale/technic_worldgen.es.tr +++ b/technic_worldgen/locale/technic_worldgen.es.tr @@ -45,6 +45,12 @@ Stainless Steel Block=Bloque de Acero Inoxidable Brass Block=Bloque de Latón Wrought Iron=Hierro Forjado +#### Steel to wrought iron +Outer Wrought Iron Block Stair= +Inner Wrought Iron Block Stair= +Wrought Iron Block Stair= +Wrought Iron Block Slab= + ###rubber.lua Rubber Tree Sapling=Retoño de Árbol de Goma Rubber Tree=Árbol de Goma diff --git a/technic_worldgen/locale/technic_worldgen.fr.tr b/technic_worldgen/locale/technic_worldgen.fr.tr index d2d92ad..e8da946 100644 --- a/technic_worldgen/locale/technic_worldgen.fr.tr +++ b/technic_worldgen/locale/technic_worldgen.fr.tr @@ -52,6 +52,12 @@ Stainless Steel Block=Bloc d'acier inoxydable Brass Block=Bloc de laiton Wrought Iron=Fer forgé +#### Steel to wrought iron +Outer Wrought Iron Block Stair=Escalier extérieur en bloc de fer forgé +Inner Wrought Iron Block Stair=Escalier intérieur en bloc de fer forgé +Wrought Iron Block Stair=Escalier en bloc de fer forgé +Wrought Iron Block Slab=Dalle en bloc de fer forgé + ###rubber.lua Rubber Tree Sapling=Pousse d'arbre à caoutchouc Rubber Tree=Arbre à caoutchouc diff --git a/technic_worldgen/locale/technic_worldgen.pl.tr b/technic_worldgen/locale/technic_worldgen.pl.tr index b679d45..faf2048 100644 --- a/technic_worldgen/locale/technic_worldgen.pl.tr +++ b/technic_worldgen/locale/technic_worldgen.pl.tr @@ -47,6 +47,12 @@ Stainless Steel Block=Blok stali nierdzewnej Brass Block=Blok mosiądzu Wrought Iron=Kute żelazo +#### Steel to wrought iron +Outer Wrought Iron Block Stair= +Inner Wrought Iron Block Stair= +Wrought Iron Block Stair= +Wrought Iron Block Slab= + ###rubber.lua Rubber Tree Sapling=Sadzonka kauczukowca Rubber Tree=Kauczukowiec diff --git a/technic_worldgen/locale/technic_worldgen.pt_BR.tr b/technic_worldgen/locale/technic_worldgen.pt_BR.tr index bcb57e9..1d1f1f7 100644 --- a/technic_worldgen/locale/technic_worldgen.pt_BR.tr +++ b/technic_worldgen/locale/technic_worldgen.pt_BR.tr @@ -47,6 +47,12 @@ Stainless Steel Block=Bloco de Aço Inoxidável Brass Block=Bloco de Latão Wrought Iron=Ferro Forjado +#### Steel to wrought iron +Outer Wrought Iron Block Stair= +Inner Wrought Iron Block Stair= +Wrought Iron Block Stair= +Wrought Iron Block Slab= + ###rubber.lua Rubber Tree Sapling=Muda de Árvore de Borracha Rubber Tree=Árvore de Borracha diff --git a/technic_worldgen/locale/technic_worldgen.tr.tr b/technic_worldgen/locale/technic_worldgen.tr.tr index f3dde28..758b7fe 100644 --- a/technic_worldgen/locale/technic_worldgen.tr.tr +++ b/technic_worldgen/locale/technic_worldgen.tr.tr @@ -47,6 +47,12 @@ Stainless Steel Block=Paslanmaz çelik blok Brass Block=Pirinç blok Wrought Iron=İşlenmiş demir +#### Steel to wrought iron +Outer Wrought Iron Block Stair= +Inner Wrought Iron Block Stair= +Wrought Iron Block Stair= +Wrought Iron Block Slab= + ###rubber.lua Rubber Tree Sapling=Kauçuk ağacı fidanı Rubber Tree=Kauçuk ağacı diff --git a/technic_worldgen/locale/template.txt b/technic_worldgen/locale/template.txt index 9f7690c..fff78ca 100644 --- a/technic_worldgen/locale/template.txt +++ b/technic_worldgen/locale/template.txt @@ -53,6 +53,12 @@ Stainless Steel Block= Brass Block= Wrought Iron= +#### Steel to wrought iron +Outer Wrought Iron Block Stair= +Inner Wrought Iron Block Stair= +Wrought Iron Block Stair= +Wrought Iron Block Slab= + ###rubber.lua Rubber Tree Sapling= Rubber Tree= diff --git a/technic_worldgen/mod.conf b/technic_worldgen/mod.conf index e2e5639..cf597f6 100644 --- a/technic_worldgen/mod.conf +++ b/technic_worldgen/mod.conf @@ -1,3 +1,3 @@ name = technic_worldgen depends = default, basic_materials -optional_depends = mg, doors, farming, glooptest, mesecons_doors, vessels, toolranks +optional_depends = mg, doors, farming, glooptest, mesecons_doors, vessels, toolranks, stairs diff --git a/technic_worldgen/nodes.lua b/technic_worldgen/nodes.lua index d68af18..a4496b8 100644 --- a/technic_worldgen/nodes.lua +++ b/technic_worldgen/nodes.lua @@ -144,47 +144,42 @@ minetest.register_craft({ minetest.register_alias("technic:diamond_block", "default:diamondblock") minetest.register_alias("technic:diamond", "default:diamond") minetest.register_alias("technic:mineral_diamond", "default:stone_with_diamond") + +local steel_to_wrought_iron = { + {name="stairs:stair_outer_steelblock", description=S("Outer Wrought Iron Block Stair")}, + {name="stairs:stair_inner_steelblock", description=S("Inner Wrought Iron Block Stair")}, + {name="stairs:stair_steelblock", description=S("Wrought Iron Block Stair")}, + {name="stairs:slab_steelblock", description=S("Wrought Iron Block Slab")} +} -local function for_each_registered_node(action) - local really_register_node = minetest.register_node - minetest.register_node = function(name, def) - really_register_node(name, def) - action(name:gsub("^:", ""), def) - end - for name, def in pairs(minetest.registered_nodes) do - action(name, def) +for _, v in ipairs(steel_to_wrought_iron) do + local node_name = v.name + local node_def = minetest.registered_items[node_name] + if node_def then + minetest.override_item(node_name, { + description = v.description + }) + + local tiles = node_def.tiles or node_def.tile_images + if tiles then + local new_tiles = {} + local do_override = false + if type(tiles) == "string" then + tiles = {tiles} + end + for i, t in ipairs(tiles) do + if type(t) == "string" and t == "default_steel_block.png" then + do_override = true + t = "technic_wrought_iron_block.png" + end + table.insert(new_tiles, t) + end + if do_override then + minetest.override_item(node_name, { + tiles = new_tiles + }) + end + end end end -for_each_registered_node(function(node_name, node_def) - if node_name ~= "default:steelblock" and - node_name:find("steelblock", 1, true) and - node_def.description:find("Steel", 1, true) then - minetest.override_item(node_name, { - -- TODO: fix this line - -- This is not the good way of doing this because this breaks translations - description = node_def.description:gsub("Steel", "Wrought Iron"), - }) - end - local tiles = node_def.tiles or node_def.tile_images - if tiles then - local new_tiles = {} - local do_override = false - if type(tiles) == "string" then - tiles = {tiles} - end - for i, t in ipairs(tiles) do - if type(t) == "string" and t == "default_steel_block.png" then - do_override = true - t = "technic_wrought_iron_block.png" - end - table.insert(new_tiles, t) - end - if do_override then - minetest.override_item(node_name, { - tiles = new_tiles - }) - end - end -end) -