From 423d5f8ab85b9fd8d2b905c82321749d1e2d1ca1 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 24 Mar 2019 09:06:35 +0100 Subject: [PATCH] Squash help entries of beds --- mods/ITEMS/mcl_beds/api.lua | 2 ++ mods/ITEMS/mcl_beds/beds.lua | 17 +++++++++++++++++ mods/ITEMS/mcl_beds/depends.txt | 1 + mods/ITEMS/mcl_beds/locale/mcl_beds.de.tr | 1 + mods/ITEMS/mcl_beds/locale/template.txt | 1 + 5 files changed, 22 insertions(+) diff --git a/mods/ITEMS/mcl_beds/api.lua b/mods/ITEMS/mcl_beds/api.lua index 7d76b76eb..777fa2225 100644 --- a/mods/ITEMS/mcl_beds/api.lua +++ b/mods/ITEMS/mcl_beds/api.lua @@ -66,6 +66,8 @@ function mcl_beds.register_bed(name, def) description = def.description, _doc_items_longdesc = def._doc_items_longdesc or beddesc, _doc_items_usagehelp = def._doc_items_usagehelp or beduse, + _doc_items_create_entry = def._doc_items_create_entry, + _doc_items_entry_name = def._doc_items_entry_name, inventory_image = def.inventory_image, wield_image = def.wield_image, drawtype = "nodebox", diff --git a/mods/ITEMS/mcl_beds/beds.lua b/mods/ITEMS/mcl_beds/beds.lua index 6ac2071e5..8f41c7a3f 100644 --- a/mods/ITEMS/mcl_beds/beds.lua +++ b/mods/ITEMS/mcl_beds/beds.lua @@ -1,4 +1,5 @@ local S = minetest.get_translator("mcl_beds") +local mod_doc = minetest.get_modpath("doc") local nodebox = { bottom = { @@ -32,9 +33,11 @@ local colors = { { "light_blue", S("Light Blue Bed"), "mcl_wool:light_blue", "mcl_dye:lightblue" }, { "white", S("White Bed"), "mcl_wool:white", "mcl_dye:white" }, } +local canonical_color = "red" for c=1, #colors do local colorid = colors[c][1] + local is_canonical = colorid == canonical_color -- Recoloring recipe for white bed if minetest.get_modpath("mcl_dye") then @@ -54,9 +57,19 @@ for c=1, #colors do } end + local entry_name, create_entry + if mod_doc then + if is_canonical then + entry_name = S("Bed") + else + create_entry = false + end + end -- Register bed mcl_beds.register_bed("mcl_beds:bed_"..colorid, { description = colors[c][2], + _doc_items_entry_name = entry_name, + _doc_items_create_entry = create_entry, inventory_image = "mcl_beds_bed_"..colorid..".png", wield_image = "mcl_beds_bed_"..colorid..".png", tiles = { @@ -89,6 +102,10 @@ for c=1, #colors do }, recipe = main_recipe, }) + if mod_doc and not is_canonical then + doc.add_entry_alias("nodes", "mcl_beds:bed_"..canonical_color.."_bottom", "nodes", "mcl_beds:bed_"..colorid.."_bottom") + doc.add_entry_alias("nodes", "mcl_beds:bed_"..canonical_color.."_bottom", "nodes", "mcl_beds:bed_"..colorid.."_top") + end end diff --git a/mods/ITEMS/mcl_beds/depends.txt b/mods/ITEMS/mcl_beds/depends.txt index 3285e5914..34e12adc5 100644 --- a/mods/ITEMS/mcl_beds/depends.txt +++ b/mods/ITEMS/mcl_beds/depends.txt @@ -6,3 +6,4 @@ mcl_dye? mcl_tnt? mcl_weather? mcl_spawn? +doc? diff --git a/mods/ITEMS/mcl_beds/locale/mcl_beds.de.tr b/mods/ITEMS/mcl_beds/locale/mcl_beds.de.tr index bcf26fc3e..079951c8d 100644 --- a/mods/ITEMS/mcl_beds/locale/mcl_beds.de.tr +++ b/mods/ITEMS/mcl_beds/locale/mcl_beds.de.tr @@ -5,6 +5,7 @@ You have heard of other worlds in which a bed would set the start point for your By using a bed, you set the starting point for your next life. If you die, you will start your next life at this bed, unless it is obstructed or destroyed.=Indem Sie ein Bett benutzen, setzen Sie den Startpunkt Ihres nächsten Lebens. Wenn Sie sterben, werden Sie Ihr nächstes Leben auf diesem Bett beginnen, es sei denn, es ist blockiert oder zerstört. In this world, going to bed won't skip the night, but it will skip thunderstorms.=In dieser Welt können mit dem Bett Nächte nicht übersprungen werden, nur Gewitterstürme. Sleeping allows you to skip the night. The night is skipped when all players in this world went to sleep. The night is skipped after sleeping for a few seconds. Thunderstorms can be skipped in the same manner.=Mit Schlaf können Sie die Nacht überspringen. Die Nacht wird übersprungen, wenn alle Spieler in dieser Welt sich schlafen gelegt haben. Die Nacht wird dann nach ein paar Sekunden übersprungen. Gewitterstürme werden auf die gleiche Weise übersprungen. +Bed=Bett Red Bed=Rotes Bett Blue Bed=Blaues Bett Cyan Bed=Türkises Bett diff --git a/mods/ITEMS/mcl_beds/locale/template.txt b/mods/ITEMS/mcl_beds/locale/template.txt index 0cba8424f..9664c8001 100644 --- a/mods/ITEMS/mcl_beds/locale/template.txt +++ b/mods/ITEMS/mcl_beds/locale/template.txt @@ -5,6 +5,7 @@ You have heard of other worlds in which a bed would set the start point for your By using a bed, you set the starting point for your next life. If you die, you will start your next life at this bed, unless it is obstructed or destroyed.= In this world, going to bed won't skip the night, but it will skip thunderstorms.= Sleeping allows you to skip the night. The night is skipped when all players in this world went to sleep. The night is skipped after sleeping for a few seconds. Thunderstorms can be skipped in the same manner.= +Bed= Red Bed= Blue Bed= Cyan Bed=