From 5c1717971b4b02fa2568e294149489eba2bc9640 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 24 Mar 2019 10:31:58 +0100 Subject: [PATCH] Squash help entries for stained glass and panes --- mods/ITEMS/mcl_core/locale/mcl_core.de.tr | 2 +- mods/ITEMS/mcl_core/nodes_glass.lua | 55 +++++++++++++++-------- mods/ITEMS/xpanes/init.lua | 25 +++++++++-- 3 files changed, 58 insertions(+), 24 deletions(-) diff --git a/mods/ITEMS/mcl_core/locale/mcl_core.de.tr b/mods/ITEMS/mcl_core/locale/mcl_core.de.tr index e53bbf294..e5e528654 100644 --- a/mods/ITEMS/mcl_core/locale/mcl_core.de.tr +++ b/mods/ITEMS/mcl_core/locale/mcl_core.de.tr @@ -199,7 +199,7 @@ Spruce Sapling=Fichtensetzling Spruce Wood=Fichtenholz Spruce Wood Planks=Fichtenholzplanken Spruce leaves are grown from spruce trees.=Fichtenblätter wachsen an Fichten. -Stained glass is a decorative and mostly transparent block which comes in various different colors.=Farbglas ist ein dekorativer und größtenteils durchsichtiger Block, der in verschiedenen Farben daherkommt. +Stained glass is a decorative and mostly transparent block which comes in various different colors.=Buntglas ist ein dekorativer und größtenteils durchsichtiger Block, der in verschiedenen Farben daherkommt. Stick=Stock Sticks are a very versatile crafting material; used in countless crafting recipes.=Stöcke sind ein vielseitiges Material, sie werden in zahllosen Fertigungsrezepten gebraucht. Stone=Stein diff --git a/mods/ITEMS/mcl_core/nodes_glass.lua b/mods/ITEMS/mcl_core/nodes_glass.lua index f87ce79ba..d1ab99861 100644 --- a/mods/ITEMS/mcl_core/nodes_glass.lua +++ b/mods/ITEMS/mcl_core/nodes_glass.lua @@ -1,5 +1,6 @@ -- Glass nodes local S = minetest.get_translator("mcl_core") +local mod_doc = minetest.get_modpath("doc") minetest.register_node("mcl_core:glass", { description = S("Glass"), @@ -20,11 +21,23 @@ minetest.register_node("mcl_core:glass", { ------------------------ -- Create Color Glass -- ------------------------ -function mcl_core.add_glass(desc, recipeitem, colorgroup, color) +local canonical_color = "blue" +function mcl_core.add_stained_glass(desc, recipeitem, colorgroup, color) + local longdesc, create_entry, entry_name + if mod_doc then + if color == canonical_color then + longdesc = S("Stained glass is a decorative and mostly transparent block which comes in various different colors.") + entry_name = S("Stained Glass") + else + create_entry = false + end + end minetest.register_node("mcl_core:glass_"..color, { description = desc, - _doc_items_longdesc = S("Stained glass is a decorative and mostly transparent block which comes in various different colors."), + _doc_items_create_entry = create_entry, + _doc_items_entry_name = entry_name, + _doc_items_longdesc = longdesc, drawtype = "glasslike", is_ground_content = false, tiles = {"mcl_core_glass_"..color..".png"}, @@ -48,23 +61,27 @@ function mcl_core.add_glass(desc, recipeitem, colorgroup, color) {'mcl_core:glass','mcl_core:glass','mcl_core:glass'}, } }) + + if mod_doc and color ~= canonical_color then + doc.add_entry_alias("nodes", "mcl_core:glass_"..canonical_color, "nodes", "mcl_core:glass_"..color) + end + end ---- colored glass -mcl_core.add_glass( S("Red Stained Glass"), "mcl_dye:red", "basecolor_red", "red") -mcl_core.add_glass( S("Green Stained Glass"), "mcl_dye:dark_green", "unicolor_dark_green", "green") -mcl_core.add_glass( S("Blue Stained Glass"), "mcl_dye:blue", "basecolor_blue", "blue") -mcl_core.add_glass( S("Light Blue Stained Glass"), "mcl_dye:lightblue", "unicolor_light_blue", "light_blue") -mcl_core.add_glass( S("Black Stained Glass"), "mcl_dye:black", "basecolor_black", "black") -mcl_core.add_glass( S("White Stained Glass"), "mcl_dye:white", "basecolor_white", "white") -mcl_core.add_glass( S("Yellow Stained Glass"), "mcl_dye:yellow", "basecolor_yellow", "yellow") -mcl_core.add_glass( S("Brown Stained Glass"), "mcl_dye:brown", "unicolor_dark_orange", "brown") -mcl_core.add_glass( S("Orange Stained Glass"), "mcl_dye:orange", "excolor_orange", "orange") -mcl_core.add_glass( S("Pink Stained Glass"), "mcl_dye:pink", "unicolor_light_red", "pink") -mcl_core.add_glass( S("Grey Stained Glass"), "mcl_dye:dark_grey", "unicolor_darkgrey", "gray") -mcl_core.add_glass( S("Lime Stained Glass"), "mcl_dye:green", "basecolor_green", "lime") -mcl_core.add_glass( S("Light Grey Stained Glass"), "mcl_dye:grey", "basecolor_grey", "silver") -mcl_core.add_glass( S("Magenta Stained Glass"), "mcl_dye:magenta", "basecolor_magenta", "magenta") -mcl_core.add_glass( S("Purple Stained Glass"), "mcl_dye:violet", "excolor_violet", "purple") -mcl_core.add_glass( S("Cyan Stained Glass"), "mcl_dye:cyan", "basecolor_cyan", "cyan") - +mcl_core.add_stained_glass( S("Red Stained Glass"), "mcl_dye:red", "basecolor_red", "red") +mcl_core.add_stained_glass( S("Green Stained Glass"), "mcl_dye:dark_green", "unicolor_dark_green", "green") +mcl_core.add_stained_glass( S("Blue Stained Glass"), "mcl_dye:blue", "basecolor_blue", "blue") +mcl_core.add_stained_glass( S("Light Blue Stained Glass"), "mcl_dye:lightblue", "unicolor_light_blue", "light_blue") +mcl_core.add_stained_glass( S("Black Stained Glass"), "mcl_dye:black", "basecolor_black", "black") +mcl_core.add_stained_glass( S("White Stained Glass"), "mcl_dye:white", "basecolor_white", "white") +mcl_core.add_stained_glass( S("Yellow Stained Glass"), "mcl_dye:yellow", "basecolor_yellow", "yellow") +mcl_core.add_stained_glass( S("Brown Stained Glass"), "mcl_dye:brown", "unicolor_dark_orange", "brown") +mcl_core.add_stained_glass( S("Orange Stained Glass"), "mcl_dye:orange", "excolor_orange", "orange") +mcl_core.add_stained_glass( S("Pink Stained Glass"), "mcl_dye:pink", "unicolor_light_red", "pink") +mcl_core.add_stained_glass( S("Grey Stained Glass"), "mcl_dye:dark_grey", "unicolor_darkgrey", "gray") +mcl_core.add_stained_glass( S("Lime Stained Glass"), "mcl_dye:green", "basecolor_green", "lime") +mcl_core.add_stained_glass( S("Light Grey Stained Glass"), "mcl_dye:grey", "basecolor_grey", "silver") +mcl_core.add_stained_glass( S("Magenta Stained Glass"), "mcl_dye:magenta", "basecolor_magenta", "magenta") +mcl_core.add_stained_glass( S("Purple Stained Glass"), "mcl_dye:violet", "excolor_violet", "purple") +mcl_core.add_stained_glass( S("Cyan Stained Glass"), "mcl_dye:cyan", "basecolor_cyan", "cyan") diff --git a/mods/ITEMS/xpanes/init.lua b/mods/ITEMS/xpanes/init.lua index e5e72b3ec..d4c7370f3 100644 --- a/mods/ITEMS/xpanes/init.lua +++ b/mods/ITEMS/xpanes/init.lua @@ -1,4 +1,5 @@ local S = minetest.get_translator("xpanes") +local mod_doc = minetest.get_modpath("doc") local function is_pane(pos) return minetest.get_item_group(minetest.get_node(pos).name, "pane") > 0 @@ -162,24 +163,35 @@ function xpanes.register_pane(name, def) recipe = def.recipe }) - if minetest.get_modpath("doc") then + if mod_doc and def._doc_items_create_entry ~= false then doc.add_entry_alias("nodes", "xpanes:" .. name .. "_flat", "nodes", "xpanes:" .. name) end end +local canonical_color = "blue" -- Register glass pane (stained and unstained) local pane = function(description, node, append) - local texture1 - + local texture1, longdesc, entry_name, create_entry + longdesc = S("Glass panes are thin layers of glass which neatly connect to their neighbors as you build them.") + local is_canonical = true -- Special case: Default (unstained) glass texture if append == "_natural" then texture1 = "default_glass.png" else + if append ~= "_"..canonical_color then + is_canonical = false + longdesc = nil + create_entry = false + else + entry_name = S("Stained Glass Pane") + end texture1 = "mcl_core_glass"..append..".png" end xpanes.register_pane("pane"..append, { description = description, - _doc_items_longdesc = S("Glass panes are thin layers of glass which neatly connect to their neighbors as you build them."), + _doc_items_create_entry = create_entry, + _doc_items_entry_name = entry_name, + _doc_items_longdesc = longdesc, textures = {texture1, texture1, "xpanes_top_glass"..append..".png"}, use_texture_alpha = true, inventory_image = texture1, @@ -194,6 +206,11 @@ local pane = function(description, node, append) _mcl_blast_resistance = 1.5, _mcl_hardness = 0.3, }) + + if mod_doc and not is_canonical then + doc.add_entry_alias("nodes", "xpanes:pane_".. canonical_color .. "_flat", "nodes", "xpanes:pane"..append) + doc.add_entry_alias("nodes", "xpanes:pane_".. canonical_color .. "_flat", "nodes", "xpanes:pane"..append.."_flat") + end end -- Iron Bars