From 8636b94c74ba73eac45c3a1d9cf159c04e95feec Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 24 Mar 2019 08:55:42 +0100 Subject: [PATCH] Squash help entries of colorblocks --- mods/ITEMS/mcl_colorblocks/depends.txt | 1 + mods/ITEMS/mcl_colorblocks/init.lua | 42 ++++++++++++++++--- .../locale/mcl_colorblocks.de.tr | 6 ++- .../ITEMS/mcl_colorblocks/locale/template.txt | 4 ++ mods/ITEMS/mclx_stairs/depends.txt | 1 + mods/ITEMS/mclx_stairs/init.lua | 18 ++++++++ .../mclx_stairs/locale/mclx_stairs.de.tr | 3 ++ mods/ITEMS/mclx_stairs/locale/template.txt | 3 ++ 8 files changed, 72 insertions(+), 6 deletions(-) diff --git a/mods/ITEMS/mcl_colorblocks/depends.txt b/mods/ITEMS/mcl_colorblocks/depends.txt index 7f3fdc37e..c9db3b289 100644 --- a/mods/ITEMS/mcl_colorblocks/depends.txt +++ b/mods/ITEMS/mcl_colorblocks/depends.txt @@ -1,4 +1,5 @@ mcl_core mcl_sounds mcl_dye +doc? screwdriver? diff --git a/mods/ITEMS/mcl_colorblocks/init.lua b/mods/ITEMS/mcl_colorblocks/init.lua index a4471fe47..15c12ab37 100644 --- a/mods/ITEMS/mcl_colorblocks/init.lua +++ b/mods/ITEMS/mcl_colorblocks/init.lua @@ -1,5 +1,6 @@ local init = os.clock() local S = minetest.get_translator("mcl_colorblocks") +local doc_mod = minetest.get_modpath("doc") local block = {} @@ -21,6 +22,7 @@ block.dyes = { {"lime", S("Lime Terracotta"), S("Lime Glazed Terracotta"), S("Lime Concrete Powder"), S("Lime Concrete"), "green"}, {"light_blue", S("Light Blue Terracotta"), S("Light Blue Glazed Terracotta"), S("Light Blue Concrete Powder"), S("Light Blue Concrete"), "lightblue"}, } +local canonical_color = "yellow" local hc_desc = S("Terracotta is a basic building material. It comes in many different colors.") local gt_desc = S("Glazed terracotta is a decorative block with a complex pattern. It can be rotated by placing it in different directions.") @@ -52,15 +54,33 @@ end for _, row in ipairs(block.dyes) do local name = row[1] + local is_canonical = name == canonical_color local sdesc_hc = row[2] local sdesc_gt = row[3] local sdesc_cp = row[4] local sdesc_c = row[5] + local ldesc_hc, ldesc_gt, ldesc_cp, ldesc_c + local create_entry + local ename_hc, ename_gt, ename_cp, ename_c + if is_canonical then + ldesc_hc = hc_desc + ldesc_gt = gt_desc + ldesc_cp = cp_desc + ldesc_c = c_desc + ename_hc = S("Colored Terracotta") + ename_gt = S("Glazed Terracotta") + ename_cp = S("Concrete Powder") + ename_c = S("Concrete") + else + create_entry = false + end local craft_color_group = row[6] -- Node Definition minetest.register_node("mcl_colorblocks:hardened_clay_"..name, { description = sdesc_hc, - _doc_items_longdesc = hc_desc, + _doc_items_longdesc = ldesc_hc, + _doc_items_create_entry = create_entry, + _doc_items_entry_name = ename_hc, tiles = {"hardened_clay_stained_"..name..".png"}, groups = {pickaxey=1, hardened_clay=1,building_block=1, material_stone=1}, stack_max = 64, @@ -71,7 +91,9 @@ for _, row in ipairs(block.dyes) do minetest.register_node("mcl_colorblocks:concrete_powder_"..name, { description = sdesc_cp, - _doc_items_longdesc = cp_desc, + _doc_items_longdesc = ldesc_cp, + _doc_items_create_entry = create_entry, + _doc_items_entry_name = ename_cp, tiles = {"mcl_colorblocks_concrete_powder_"..name..".png"}, groups = {handy=1,shovely=1, concrete_powder=1,building_block=1,falling_node=1, material_sand=1}, stack_max = 64, @@ -109,7 +131,9 @@ for _, row in ipairs(block.dyes) do minetest.register_node("mcl_colorblocks:concrete_"..name, { description = sdesc_c, - _doc_items_longdesc = c_desc, + _doc_items_longdesc = ldesc_c, + _doc_items_create_entry = create_entry, + _doc_items_entry_name = ename_c, tiles = {"mcl_colorblocks_concrete_"..name..".png"}, groups = {handy=1,pickaxey=1, concrete=1,building_block=1, material_stone=1}, stack_max = 64, @@ -123,7 +147,9 @@ for _, row in ipairs(block.dyes) do local texes = { tex, tex, tex.."^[transformR180", tex, tex.."^[transformR270", tex.."^[transformR90" } minetest.register_node("mcl_colorblocks:glazed_terracotta_"..name, { description = sdesc_gt, - _doc_items_longdesc = gt_desc, + _doc_items_longdesc = ldesc_gt, + _doc_items_create_entry = create_entry, + _doc_items_entry_name = ename_gt, tiles = texes, groups = {handy=1,pickaxey=1, glazed_terracotta=1,building_block=1, material_stone=1}, paramtype2 = "facedir", @@ -135,6 +161,13 @@ for _, row in ipairs(block.dyes) do on_rotate = on_rotate, }) + if not is_canonical and doc_mod then + doc.add_entry_alias("nodes", "mcl_colorblocks:hardened_clay_"..canonical_color, "nodes", "mcl_colorblocks:hardened_clay_"..name) + doc.add_entry_alias("nodes", "mcl_colorblocks:glazed_terracotta_"..canonical_color, "nodes", "mcl_colorblocks:glazed_terracotta_"..name) + doc.add_entry_alias("nodes", "mcl_colorblocks:concrete_"..canonical_color, "nodes", "mcl_colorblocks:concrete_"..name) + doc.add_entry_alias("nodes", "mcl_colorblocks:concrete_powder_"..canonical_color, "nodes", "mcl_colorblocks:concrete_powder_"..name) + end + -- Crafting recipes if craft_color_group then minetest.register_craft({ @@ -184,4 +217,3 @@ minetest.register_abm({ local time_to_load= os.clock() - init print(string.format("[MOD] "..minetest.get_current_modname().." loaded in %.4f s", time_to_load)) - diff --git a/mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr b/mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr index 372bd3462..f0d771970 100644 --- a/mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr +++ b/mods/ITEMS/mcl_colorblocks/locale/mcl_colorblocks.de.tr @@ -68,4 +68,8 @@ Glazed terracotta is a decorative block with a complex pattern. It can be rotate Concrete powder is used for creating concrete, but it can also be used as decoration itself. It comes in different colors. Concrete powder turns into concrete of the same color when it comes in contact with water.=Betonpulver wird benutzt, um Beton herzustellen, aber es kann auch selbst als Dekoration benutzt werden. Es kommt in verschiedenen Farben daher. Betonpulver verwandelt sich in Beton der selben Farbe, wenn es mit Wasser in Berührung kommt. Concrete is a decorative block which comes in many different colors. It is notable for having a very strong and clean color.=Beton ist ein dekorativer Block, der in verschiedenen Farben daherkommt. Er hat eine besonders kräftige und klare Farbe. Terracotta=Terrakotta -Terracotta is a basic building material which comes in many different colors. This particular block is uncolored.=Terrakotta ist ein Baumaterial, welches in vielen verschiedenen Farben vorkommt. Dieser Block ist farblos. +Terracotta is a basic building material which comes in many different colors. This particular block is uncolored.=Terrakotta ist ein Baumaterial, welches in vielen verschiedenen Farben vorkommt. Diese Variante ist ungefärbt. +Colored Terracotta=Gefärbte Terrakotta +Glazed Terracotta=Glasierte Terrakotta +Concrete Powder=Betonpulver +Concrete=Beton diff --git a/mods/ITEMS/mcl_colorblocks/locale/template.txt b/mods/ITEMS/mcl_colorblocks/locale/template.txt index 2736a54bd..f20c7965c 100644 --- a/mods/ITEMS/mcl_colorblocks/locale/template.txt +++ b/mods/ITEMS/mcl_colorblocks/locale/template.txt @@ -69,3 +69,7 @@ Concrete powder is used for creating concrete, but it can also be used as decora Concrete is a decorative block which comes in many different colors. It is notable for having a very strong and clean color.= Terracotta= Terracotta is a basic building material which comes in many different colors. This particular block is uncolored.= +Colored Terracotta= +Glazed Terracotta= +Concrete Powder= +Concrete= diff --git a/mods/ITEMS/mclx_stairs/depends.txt b/mods/ITEMS/mclx_stairs/depends.txt index 89eb864a6..49805c174 100644 --- a/mods/ITEMS/mclx_stairs/depends.txt +++ b/mods/ITEMS/mclx_stairs/depends.txt @@ -5,3 +5,4 @@ mcl_nether mcl_end mcl_colorblocks mcl_stairs +doc? diff --git a/mods/ITEMS/mclx_stairs/init.lua b/mods/ITEMS/mclx_stairs/init.lua index 70ffdc33c..d43fa9c51 100644 --- a/mods/ITEMS/mclx_stairs/init.lua +++ b/mods/ITEMS/mclx_stairs/init.lua @@ -1,4 +1,5 @@ local S = minetest.get_translator("mclx_stairs") +local doc_mod = minetest.get_modpath("doc") mcl_stairs.register_stair_and_slab_simple("tree_bark", "mcl_core:tree_bark", S("Oak Bark Stairs"), S("Oak Bark Slab"), S("Double Oak Bark Slab"), "woodlike") mcl_stairs.register_stair_and_slab_simple("acaciatree_bark", "mcl_core:acaciatree_bark", S("Acacia Bark Stairs"), S("Acacia Bark Slab"), S("Double Acacia Bark Slab"), "woodlike") @@ -47,12 +48,29 @@ block.dyes = { {"lime", S("Lime Concrete Stairs"), S("Lime Concrete Slab"), S("Double Lime Concrete Slab"), "green"}, {"light_blue", S("Light Blue Concrete Stairs"), S("Light Blue Concrete Slab"), S("Double Light Blue Concrete Slab"), "lightblue"}, } +local canonical_color = "yellow" for i=1, #block.dyes do local c = block.dyes[i][1] + local is_canonical = c == canonical_color mcl_stairs.register_stair_and_slab_simple("concrete_"..c, "mcl_colorblocks:concrete_"..c, block.dyes[i][2], block.dyes[i][3], block.dyes[i][4]) + + if doc_mod then + if not is_canonical then + doc.add_entry_alias("nodes", "mcl_stairs:slab_concrete_"..canonical_color, "nodes", "mcl_stairs:slab_concrete_"..c) + doc.add_entry_alias("nodes", "mcl_stairs:slab_concrete_"..canonical_color.."_double", "nodes", "mcl_stairs:slab_concrete_"..c.."_double") + doc.add_entry_alias("nodes", "mcl_stairs:stair_concrete_"..canonical_color, "nodes", "mcl_stairs:stair_concrete_"..c) + minetest.override_item("mcl_stairs:slab_concrete_"..c, { _doc_items_create_entry = false }) + minetest.override_item("mcl_stairs:slab_concrete_"..c.."_double", { _doc_items_create_entry = false }) + minetest.override_item("mcl_stairs:stair_concrete_"..c, { _doc_items_create_entry = false }) + else + minetest.override_item("mcl_stairs:slab_concrete_"..c, { _doc_items_entry_name = S("Concrete Slab") }) + minetest.override_item("mcl_stairs:slab_concrete_"..c.."_double", { _doc_items_entry_name = S("Double Concrete Slab") }) + minetest.override_item("mcl_stairs:stair_concrete_"..c, { _doc_items_entry_name = S("Concrete Stairs") }) + end + end end diff --git a/mods/ITEMS/mclx_stairs/locale/mclx_stairs.de.tr b/mods/ITEMS/mclx_stairs/locale/mclx_stairs.de.tr index a9973c77f..c6f9f65d7 100644 --- a/mods/ITEMS/mclx_stairs/locale/mclx_stairs.de.tr +++ b/mods/ITEMS/mclx_stairs/locale/mclx_stairs.de.tr @@ -77,3 +77,6 @@ Double Lime Concrete Slab=Doppelte Betonplatte Light Blue Concrete Stairs=Hellblaue Betontreppe Light Blue Concrete Slab=Hellblaue Betonplatte Double Light Blue Concrete Slab=Doppelte hellblaue Betonplatte +Concrete Slab=Betonplatte +Double Concrete Slab=Doppelte Betonplatte +Concrete Stairs=Betontreppe diff --git a/mods/ITEMS/mclx_stairs/locale/template.txt b/mods/ITEMS/mclx_stairs/locale/template.txt index fcadd57ec..b6272dbcf 100644 --- a/mods/ITEMS/mclx_stairs/locale/template.txt +++ b/mods/ITEMS/mclx_stairs/locale/template.txt @@ -77,3 +77,6 @@ Double Lime Concrete Slab= Light Blue Concrete Stairs= Light Blue Concrete Slab= Double Light Blue Concrete Slab= +Concrete Slab= +Double Concrete Slab= +Concrete Stairs=