From 5b38bb2737430ce8bb20603aef9930ef203014da Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 29 Aug 2017 23:34:02 +0200 Subject: [PATCH] Add back the redstone help --- .../ITEMS/REDSTONE/mesecons_wires/depends.txt | 1 + mods/ITEMS/REDSTONE/mesecons_wires/init.lua | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/mods/ITEMS/REDSTONE/mesecons_wires/depends.txt b/mods/ITEMS/REDSTONE/mesecons_wires/depends.txt index acaa92412..4fdbda79f 100644 --- a/mods/ITEMS/REDSTONE/mesecons_wires/depends.txt +++ b/mods/ITEMS/REDSTONE/mesecons_wires/depends.txt @@ -1 +1,2 @@ mesecons +doc? diff --git a/mods/ITEMS/REDSTONE/mesecons_wires/init.lua b/mods/ITEMS/REDSTONE/mesecons_wires/init.lua index d90ccd1fc..05a5e7171 100644 --- a/mods/ITEMS/REDSTONE/mesecons_wires/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_wires/init.lua @@ -214,21 +214,33 @@ local function register_wires() local tiles_off = { crossing_off, crossing_off, straight0_off, straight1_off, straight0_off, straight1_off } local tiles_on = { crossing_on, crossing_on, straight0_on, straight1_on, straight0_on, straight1_on } + local wirehelp, longdesc, usagehelp if nodeid == "00000000" then -- Non-connected redstone wire nodebox.fixed = {-8/16, -.5, -8/16, 8/16, -.5+1/64, 8/16} -- “Dot” texture tiles_off = { dot_off, dot_off, "blank.png", "blank.png", "blank.png", "blank.png" } tiles_on = { dot_on, dot_on, "blank.png", "blank.png", "blank.png", "blank.png" } + + longdesc = [[Redstone is a versatile conductive mineral which transmits redstone power. It can be placed on trail the ground as a trail. +A redstone trail can be in two states: Powered or not powered. A powered redstone trail will power (and thus activate) adjacent redstone components. +Redstone power can be received from various redstone components, such as a block of redstone or a button. Redstone power is used to activate numerous mechanisms, such as redstone lamps or pistons.]] + usagehelp = [[Place redstone on the ground to build a redstone trail. The trails will connect to each other automatically and it can also go over hills. An easy way to power a redstone trail is by placing a redstone torch. + +Read the help entries on the other redstone components to learn how redstone components interact.]] else -- Connected redstone wire table.insert(nodebox, box_center) tiles_off = { crossing_off, crossing_off, straight0_off, straight1_off, straight0_off, straight1_off, } tiles_on = { crossing_on, crossing_on, straight0_on, straight1_on, straight0_on, straight1_on, } + wirehelp = false end mesecon.register_node(":mesecons:wire_"..nodeid, { description = "Redstone", + _doc_items_create_entry = wirehelp, + _doc_items_longdesc = longdesc, + _doc_items_usagehelp = usagehelp, drawtype = "nodebox", inventory_image = "redstone_redstone_dust.png", wield_image = "redstone_redstone_dust.png", @@ -243,6 +255,14 @@ local function register_wires() }, {tiles = tiles_off, mesecons = meseconspec_off, groups = groups_off}, {tiles = tiles_on, mesecons = meseconspec_on, groups = groups_on}) + -- Add Help entry aliases for e.g. making it identifiable by the lookup tool [doc_identifier] + if minetest.get_modpath("doc") then + if nodeid ~= "00000000" then + doc.add_entry_alias("nodes", "mesecons:wire_00000000_off", "nodes", "mesecons:wire_"..nodeid.."_off") + end + doc.add_entry_alias("nodes", "mesecons:wire_00000000_off", "nodes", "mesecons:wire_"..nodeid.."_on") + end + if (nid_inc(nid) == false) then return end end end