From 3a5df885e9da3abf01befd5bce7ec88c2bb8f1d0 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 24 Mar 2019 09:23:26 +0100 Subject: [PATCH] Squash help entries for wool and carpet --- mods/ITEMS/mcl_wool/depends.txt | 1 + mods/ITEMS/mcl_wool/init.lua | 27 +++++++++++++++++++++-- mods/ITEMS/mcl_wool/locale/mcl_wool.de.tr | 2 ++ mods/ITEMS/mcl_wool/locale/template.txt | 2 ++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_wool/depends.txt b/mods/ITEMS/mcl_wool/depends.txt index 3d96266de..9699080ad 100644 --- a/mods/ITEMS/mcl_wool/depends.txt +++ b/mods/ITEMS/mcl_wool/depends.txt @@ -1 +1,2 @@ mcl_sounds +doc? diff --git a/mods/ITEMS/mcl_wool/init.lua b/mods/ITEMS/mcl_wool/init.lua index 40c2340b9..912a6ccd1 100644 --- a/mods/ITEMS/mcl_wool/init.lua +++ b/mods/ITEMS/mcl_wool/init.lua @@ -1,4 +1,5 @@ local S = minetest.get_translator("mcl_wool") +local mod_doc = minetest.get_modpath("doc") -- minetest/wool/init.lua @@ -29,6 +30,7 @@ wool.dyes = { {"lime", "mcl_wool_lime", S("Lime Wool"), S("Lime Carpet"), "green", "basecolor_green"}, {"light_blue", "mcl_wool_light_blue", S("Light Blue Wool"), S("Light Blue Carpet"), "lightblue", "unicolor_light_blue"}, } +local canonical_color = "white" for _, row in ipairs(wool.dyes) do local name = row[1] @@ -37,10 +39,24 @@ for _, row in ipairs(wool.dyes) do local desc_carpet = row[4] local dye = row[5] local color_group = row[6] + local longdesc_wool, longdesc_carpet, create_entry, name_wool, name_carpet + local is_canonical = name == canonical_color + if mod_doc then + if is_canonical then + longdesc_wool = S("Wool is a decorative block which comes in many different colors.") + longdesc_carpet = S("Carpets are thin floor covers which come in many different colors.") + name_wool = S("Wool") + name_carpet = S("Carpet") + else + create_entry = false + end + end -- Node Definition minetest.register_node("mcl_wool:"..name, { description = desc_wool, - _doc_items_longdesc = S("Wool is a decorative block which comes in many different colors."), + _doc_items_create_entry = create_entry, + _doc_items_entry_name = name_wool, + _doc_items_longdesc = longdesc_wool, stack_max = 64, is_ground_content = false, tiles = {texture..".png"}, @@ -51,7 +67,10 @@ for _, row in ipairs(wool.dyes) do }) minetest.register_node("mcl_wool:"..name.."_carpet", { description = desc_carpet, - _doc_items_longdesc = S("Carpets are thin floor covers which come in many different colors."), + _doc_items_create_entry = create_entry, + _doc_items_entry_name = name_carpet, + _doc_items_longdesc = longdesc_carpet, + walkable = false, -- See is_ground_content = false, tiles = {texture..".png"}, @@ -72,6 +91,10 @@ for _, row in ipairs(wool.dyes) do _mcl_hardness = 0.1, _mcl_blast_resistance = 0.5, }) + if mod_doc and not is_canonical then + doc.add_entry_alias("nodes", "mcl_wool:"..canonical_color, "nodes", "mcl_wool:"..name) + doc.add_entry_alias("nodes", "mcl_wool:"..canonical_color.."_carpet", "nodes", "mcl_wool:"..name.."_carpet") + end if dye then -- Crafting from dye and white wool minetest.register_craft({ diff --git a/mods/ITEMS/mcl_wool/locale/mcl_wool.de.tr b/mods/ITEMS/mcl_wool/locale/mcl_wool.de.tr index de758d1e0..5b979d51b 100644 --- a/mods/ITEMS/mcl_wool/locale/mcl_wool.de.tr +++ b/mods/ITEMS/mcl_wool/locale/mcl_wool.de.tr @@ -1,4 +1,6 @@ # textdomain: mcl_wool +Wool=Wolle +Carpet=Teppich White Wool=Weiße Wolle White Carpet=Weißer Teppich Grey Wool=Graue Wolle diff --git a/mods/ITEMS/mcl_wool/locale/template.txt b/mods/ITEMS/mcl_wool/locale/template.txt index 0358fb503..26de1ec7a 100644 --- a/mods/ITEMS/mcl_wool/locale/template.txt +++ b/mods/ITEMS/mcl_wool/locale/template.txt @@ -1,4 +1,6 @@ # textdomain: mcl_wool +Wool= +Carpet= White Wool= White Carpet= Grey Wool=