1 -- Boilerplate to support localized strings if intllib mod is installed.
3 if minetest
.get_modpath("intllib") then
4 S
= intllib
.Getter(minetest
.get_current_modname())
6 S
= function(s
,a
,...)a
={a
,...}return s
:gsub("@(%d+)",function(n
)return a
[tonumber(n
)]end)end
10 ["book"] = S("Books"),
11 ["vessel"] = S("Vessels"),
13 ["stick"] = S("Sticks"),
17 ["stone"] = S("Stones"),
18 ["metal"] = S("Metal"),
19 ["tree"] = S("Tree Trunks"),
20 ["fence"] = S("Fences"),
21 ["wall"] = S("Walls"),
22 ["leaves"] = S("Leaves and Needles"),
23 ["flower"] = S("Flowers"),
24 ["sapling"] = S("Saplings"),
25 ["water"] = S("Water"),
28 ["water_bucket"] = S("Water buckets"),
29 ["flora"] = S("Flora"),
31 ["cracky"] = S("Cracky"),
32 ["crumbly"] = S("Crumbly"),
33 ["choppy"] = S("Choppy"),
34 ["snappy"] = S("Snappy"),
35 ["bendy"] = S("Bendy"),
36 ["oddly_breakable_by_hand"] = S("Hand-breakable"),
38 ["fleshy"] = S("Flesh"),
41 local miscgroups
= { "book", "vessel", "dye", "stick", "wool", "sand", "wood", "stone", "metal", "tree", "fence", "wall", "leaves", "flower", "sapling", "water", "lava", "coal", "water_bucket" }
43 local forced_items
= {
50 "doors:door_obsidian_glass_a",
55 local suppressed_items
= {
56 "default:water_flowing",
57 "default:river_water_flowing",
58 "default:lava_flowing",
59 "default:dry_grass_2",
60 "default:dry_grass_3",
61 "default:dry_grass_4",
62 "default:dry_grass_5",
67 "default:furnace_active",
71 "doors:door_obsidian_glass",
75 "doors:door_obsidian_glass_b",
76 "doors:gate_wood_open",
77 "doors:gate_junglewood_open",
78 "doors:gate_acacia_wood_open",
79 "doors:gate_aspen_wood_open",
80 "doors:gate_pine_wood_open",
81 "doors:trapdoor_steel_open",
82 "doors:trapdoor_open",
88 local hidden_items
= {
90 "default:dirt_with_grass_footsteps",
93 local item_name_overrides
= {
94 ["screwdriver:screwdriver"] = S("Screwdriver"),
95 ["carts:cart"] = S("Cart"),
96 ["fire:basic_flame"] = S("Basic Flame"),
97 ["farming:wheat_8"] = S("Wheat Plant"),
98 ["farming:cotton_8"] = S("Cotton Plant"),
99 ["default:lava_source"] = S("Lava"),
100 ["default:water_source"] = S("Water"),
101 ["default:river_water_source"] = S("River Water"),
102 ["doors:door_wood_a"] = minetest
.registered_items
["doors:door_wood"].description
,
103 ["doors:door_steel_a"] = minetest
.registered_items
["doors:door_steel"].description
,
104 ["doors:door_glass_a"] = minetest
.registered_items
["doors:door_glass"].description
,
105 ["doors:door_obsidian_glass_a"] = minetest
.registered_items
["doors:door_obsidian_glass"].description
,
106 ["xpanes:pane_1"] = minetest
.registered_items
["xpanes:pane"].description
,
107 ["xpanes:bar_1"] = minetest
.registered_items
["xpanes:bar"].description
,
110 local image_overrides
= {
111 ["doors:door_wood_a"] = minetest
.registered_items
["doors:door_wood"].inventory_image
,
112 ["doors:door_steel_a"] = minetest
.registered_items
["doors:door_steel"].inventory_image
,
113 ["doors:door_glass_a"] = minetest
.registered_items
["doors:door_glass"].inventory_image
,
114 ["doors:door_obsidian_glass_a"] = minetest
.registered_items
["doors:door_obsidian_glass"].inventory_image
,
115 ["xpanes:pane_1"] = minetest
.registered_items
["xpanes:pane"].inventory_image
,
116 ["xpanes:bar_1"] = minetest
.registered_items
["xpanes:bar"].inventory_image
,
119 doc
.sub
.items
.add_friendly_group_names(groupdefs
)
120 doc
.sub
.items
.add_notable_groups(miscgroups
)
122 for i
=1, #hidden_items
do
123 local item
= minetest
.registered_items
[hidden_items
[i]]
125 minetest
.override_item(hidden_items
[i
], { _doc_items_hidden
= true } )
128 for i
=1, #forced_items
do
129 local item
= minetest
.registered_items
[forced_items
[i]]
131 minetest
.override_item(forced_items
[i
], { _doc_items_create_entry
= true} )
134 for i
=1, #suppressed_items
do
135 local item
= minetest
.registered_items
[suppressed_items
[i]]
137 minetest
.override_item(suppressed_items
[i
], { _doc_items_create_entry
= false} )
140 for itemstring
, data
in pairs(item_name_overrides
) do
141 if minetest
.registered_items
[itemstring
] ~= nil then
142 minetest
.override_item(itemstring
, { _doc_items_entry_name
= data
} )
145 for itemstring
, data
in pairs(image_overrides
) do
146 if minetest
.registered_items
[itemstring
] ~= nil then
147 minetest
.override_item(itemstring
, { _doc_items_image
= data
} )
151 -- Minetest Game Factoids
154 local function f_cools_lava(itemstring
, def
)
155 if def
.groups
.cools_lava
~= nil then
156 return S("This block turns adjacent lava sources into obsidian and adjacent flowing lava into stone.")
162 -- Groups flammable, puts_out_fire
163 local function f_fire(itemstring
, def
)
166 if def
.groups
.flammable
~= nil then
167 -- TODO: When the fire mod supports different flammable levels, add flavor texts
168 s
= s
.. S("This block is flammable.")
171 if def
.groups
.puts_out_fire
~= nil then
172 if def
.groups
.flammable
~= nil then
175 s
= s
.. S("This block will extinguish nearby fire.")
178 if def
.groups
.igniter
~= nil then
179 if def
.groups
.flammable
~= nil or def
.groups
.puts_out_fire
~= nil then
182 s
= s
.. S("This block will set flammable blocks within a radius of @1 on fire.", def
.groups
.igniter
)
188 local function f_flora(itemstring
, def
)
189 if def
.groups
.flora
== 1 then
190 local groupname
= doc
.sub
.items
.get_group_name("flora")
191 return S("This block belongs to the @1 group. It a living organism which likes to grow and spread on dirt with grass or dirt with dry grass when it is in light. Spreading will stop when the surrounding area is too crammed with @2 blocks. On desert sand, it will wither and die and turn into a dry shrub.", groupname
, groupname
)
198 local function f_soil(itemstring
, def
)
199 if def
.groups
.soil
== 1 then
200 return S("This block serves as a soil for saplings. Blocks in the Saplings group will grow into trees on this block.")
201 elseif def
.groups
.soil
== 2 or def
.groups
.soil
== 3 then
202 return S("This block serves as a soil for saplings as well as plants grown from seeds. It supports their growth.")
208 local function f_leafdecay(itemstring
, def
)
209 local formstring
= ""
210 if def
.groups
.leafdecay
~= nil then
211 local groupname
= doc
.sub
.items
.get_group_name("tree")
212 if def
.groups
.leafdecay_drop
~= nil then
213 formstring
= S("This block may drop as an item when no trunk is nearby. This is prevented if any block of the group “@1” is nearby (up to a distance of @2), the block is completely surrounded by blocks which are neither air or a liquid or it has been manually placed by a player.", groupname
, def
.groups
.leafdecay
)
215 if def
.drop
~= "" and def
.drop
~= nil and def
.drop
~= itemstring
then
216 formstring
= S("This block may decay when no trunk is nearby. When decaying, it disappears and may drop one of its mining drops (but never itself). Decay is prevented if any block of the group “@1” is nearby (up to a distance of @2), the block is completely surrounded by blocks which are neither air or a liquid or it has been placed by a player.", groupname
, def
.groups
.leafdecay
)
218 formstring
= S("This block may decay and disappear when no trunk is nearby. Decay is prevented if any block of the group “@1” is nearby (up to a distance of @2), the block is completely surrounded by blocks which are neither air or a liquid or it has been placed by a player.", groupname
, def
.groups
.leafdecay
)
225 --[[ Node defines skeleton key and key callbacks which probably implies that
226 it can be unlocked by keys ]]
227 local function f_key(itemstring
, def
)
228 if def
.on_key_use
and def
.on_skeleton_key_use
then
229 return S("This block is compatible with keys.")
235 doc
.sub
.items
.register_factoid("nodes", "use", f_key
)
236 doc
.sub
.items
.register_factoid("nodes", "groups", f_cools_lava
)
237 doc
.sub
.items
.register_factoid("nodes", "groups", f_fire
)
238 doc
.sub
.items
.register_factoid("nodes", "groups", f_flora
)
239 doc
.sub
.items
.register_factoid("nodes", "groups", f_leafdecay
)
240 doc
.sub
.items
.register_factoid("nodes", "groups", f_soil
)
244 doc
.add_entry_alias("nodes", "default:grass_1", "default:grass_"..i
)
245 doc
.add_entry_alias("nodes", "default:dry_grass_1", "default:dry_grass_"..i
)
248 doc
.add_entry_alias("nodes", "farming:wheat_8", "farming:wheat_"..i
)
249 doc
.add_entry_alias("nodes", "farming:cotton_8", "farming:cotton_"..i
)
251 doc
.add_entry_alias("nodes", "default:lava_source", "default:lava_flowing")
252 doc
.add_entry_alias("nodes", "default:water_source", "default:water_flowing")
253 doc
.add_entry_alias("nodes", "default:river_water_source", "default:river_water_flowing")
254 doc
.add_entry_alias("nodes", "default:furnace", "default:furnace_active")
255 doc
.add_entry_aliases("nodes", "default:torch", {"default:torch_wall", "default:torch_ceiling"})
256 doc
.add_entry_aliases("nodes", "doors:door_wood_a", {"doors:door_wood_b", "doors:doors_wood"})
257 doc
.add_entry_aliases("nodes", "doors:door_steel_a", {"doors:door_steel_b", "doors:door_steel"})
258 doc
.add_entry_aliases("nodes", "doors:door_glass_a", {"doors:door_glass_b", "doors:door_glass"})
259 doc
.add_entry_aliases("nodes", "doors:door_obsidian_glass_a", {"doors:door_obsidian_glass_b", "doors:door_obsidian_glass"})
260 doc
.add_entry_alias("nodes", "doors:gate_wood_closed", "doors:gate_wood_open")
261 doc
.add_entry_alias("nodes", "doors:gate_junglewood_closed", "doors:gate_junglewood_open")
262 doc
.add_entry_alias("nodes", "doors:gate_acacia_wood_closed", "doors:gate_acacia_wood_open")
263 doc
.add_entry_alias("nodes", "doors:gate_aspen_wood_closed", "doors:gate_aspen_wood_open")
264 doc
.add_entry_alias("nodes", "doors:gate_pine_wood_closed", "doors:gate_pine_wood_open")
265 doc
.add_entry_alias("nodes", "doors:trapdoor", "doors:trapdoor_open")
266 doc
.add_entry_alias("nodes", "doors:trapdoor_steel", "doors:trapdoor_steel_open")
267 doc
.add_entry_alias("nodes", "tnt:tnt", "tnt:tnt_burning")
268 doc
.add_entry_alias("nodes", "tnt:gunpowder", "tnt:gunpowder_burning")
269 local pane_aliases
= {}
270 local bar_aliases
= {}
272 table.insert(pane_aliases
, "xpanes:pane_"..i
)
273 table.insert(bar_aliases
, "xpanes:bar_"..i
)
275 table.insert(pane_aliases
, "xpanes:pane")
276 table.insert(bar_aliases
, "xpanes:bar")
277 doc
.add_entry_aliases("nodes", "xpanes:pane_1", pane_aliases
)
278 doc
.add_entry_aliases("nodes", "xpanes:bar_1", bar_aliases
)
281 dofile(minetest
.get_modpath("doc_minetest_game") .. "/helptexts.lua")
283 -- Register boat object for doc_identifier
284 if minetest
.get_modpath("doc_identifier") ~= nil then
285 doc
.sub
.identifier
.register_object("boats:boat", "craftitems", "boats:boat")
286 doc
.sub
.identifier
.register_object("carts:cart", "craftitems", "carts:cart")
289 -- Add another craft for encyclopedia
290 if minetest
.get_modpath("doc_encyclopedia") ~= nil then
291 minetest
.register_craft({
292 output
= "doc_encyclopedia:encyclopedia",
303 -- Remove the “helper” comment from screwdriver description since the help is
304 -- provided by this mod
305 minetest
.override_item("screwdriver:screwdriver", {description
= item_name_overrides
["screwdriver:screwdriver"]})
308 -- TODO: Maybe add achievement for discovering all Minetest Game node entries