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 ["oddly_breakable_by_hand"] = S("Hand-breakable"),
37 ["fleshy"] = S("Flesh"),
41 "book", -- for placing in bookshelf
42 "vessel", -- for placing in vessels shelf
43 "sand", -- for cactus growth ABM
44 "flora", -- for the plant spreading ABM
45 "sapling", -- for the sapling growth ABM
46 "water", -- for the obsidian and farming ABMs
49 local forced_items
= {
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",
72 "doors:gate_wood_open",
73 "doors:gate_junglewood_open",
74 "doors:gate_acacia_wood_open",
75 "doors:gate_aspen_wood_open",
76 "doors:gate_pine_wood_open",
77 "doors:trapdoor_steel_open",
78 "doors:trapdoor_open",
84 local hidden_items
= {
86 "default:dirt_with_grass_footsteps",
89 local item_name_overrides
= {
90 ["screwdriver:screwdriver"] = S("Screwdriver"),
91 ["carts:cart"] = S("Cart"),
92 ["fire:basic_flame"] = S("Basic Flame"),
93 ["farming:wheat_8"] = S("Wheat Plant"),
94 ["farming:cotton_8"] = S("Cotton Plant"),
95 ["default:lava_source"] = S("Lava"),
96 ["default:water_source"] = S("Water"),
97 ["default:river_water_source"] = S("River Water"),
98 ["doors:door_wood_a"] = minetest
.registered_items
["doors:door_wood"].description
,
99 ["doors:door_steel_a"] = minetest
.registered_items
["doors:door_steel"].description
,
100 ["doors:door_glass_a"] = minetest
.registered_items
["doors:door_glass"].description
,
101 ["doors:door_obsidian_glass_a"] = minetest
.registered_items
["doors:door_obsidian_glass"].description
,
104 local image_overrides
= {
105 ["doors:door_wood_a"] = minetest
.registered_items
["doors:door_wood"].inventory_image
,
106 ["doors:door_steel_a"] = minetest
.registered_items
["doors:door_steel"].inventory_image
,
107 ["doors:door_glass_a"] = minetest
.registered_items
["doors:door_glass"].inventory_image
,
108 ["doors:door_obsidian_glass_a"] = minetest
.registered_items
["doors:door_obsidian_glass"].inventory_image
,
111 doc
.sub
.items
.add_friendly_group_names(groupdefs
)
112 doc
.sub
.items
.add_notable_groups(miscgroups
)
114 for i
=1, #hidden_items
do
115 local item
= minetest
.registered_items
[hidden_items
[i]]
117 minetest
.override_item(hidden_items
[i
], { _doc_items_hidden
= true } )
120 for i
=1, #forced_items
do
121 local item
= minetest
.registered_items
[forced_items
[i]]
123 minetest
.override_item(forced_items
[i
], { _doc_items_create_entry
= true} )
126 for i
=1, #suppressed_items
do
127 local item
= minetest
.registered_items
[suppressed_items
[i]]
129 minetest
.override_item(suppressed_items
[i
], { _doc_items_create_entry
= false} )
132 for itemstring
, data
in pairs(item_name_overrides
) do
133 if minetest
.registered_items
[itemstring
] ~= nil then
134 minetest
.override_item(itemstring
, { _doc_items_entry_name
= data
} )
137 for itemstring
, data
in pairs(image_overrides
) do
138 if minetest
.registered_items
[itemstring
] ~= nil then
139 minetest
.override_item(itemstring
, { _doc_items_image
= data
} )
143 -- Minetest Game Factoids
146 local function f_cools_lava(itemstring
, def
)
147 if def
.groups
.cools_lava
~= nil or def
.groups
.water
~= nil then
148 return S("This block turns adjacent lava sources into obsidian and adjacent flowing lava into stone.")
154 -- Groups flammable, puts_out_fire
155 local function f_fire(itemstring
, def
)
158 if def
.groups
.flammable
~= nil then
159 s
= s
.. S("This block is flammable.")
162 if def
.groups
.puts_out_fire
~= nil then
163 if def
.groups
.flammable
~= nil then
166 s
= s
.. S("This block will extinguish nearby fire.")
169 if def
.groups
.igniter
~= nil then
170 if def
.groups
.flammable
~= nil or def
.groups
.puts_out_fire
~= nil then
173 s
= s
.. S("This block will set flammable blocks within a radius of @1 on fire.", def
.groups
.igniter
)
174 if def
.walkable
== false then
175 s
= s
.. S(" It also destroys flammable items which have been dropped inside.")
182 local function f_flora(itemstring
, def
)
183 if def
.groups
.flora
== 1 then
184 local groupname
= doc
.sub
.items
.get_group_name("flora")
185 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
)
192 local function f_soil(itemstring
, def
)
193 if def
.groups
.soil
== 1 then
194 return S("This block serves as a soil for saplings. Blocks in the “@1” group will grow into trees on this block.", doc
.sub
.items
.get_group_name("sapling"))
195 elseif def
.groups
.soil
== 2 or def
.groups
.soil
== 3 then
196 return S("This block serves as a soil for saplings as well as plants grown from seeds. It supports their growth.")
202 local function f_leafdecay(itemstring
, def
)
203 local formstring
= ""
204 if def
.groups
.leafdecay
~= nil then
205 local groupname
= doc
.sub
.items
.get_group_name("tree")
206 if def
.groups
.leafdecay_drop
~= nil then
207 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
)
209 if def
.drop
~= "" and def
.drop
~= nil and def
.drop
~= itemstring
then
210 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
)
212 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
)
219 local function f_spreading_dirt_type(itemstring
, def
)
220 if def
.groups
.spreading_dirt_type
then
221 return S("Under sunlight, this block slowly spreads its dirt cover towards nearby dirt blocks. In the shadows, this block eventually loses its dirt cover and turns into plain dirt.")
227 local function f_hoe_soil(itemstring
, def
)
230 nodedef
= minetest
.registered_nodes
[def
.soil
.dry
]
232 name
= nodedef
.description
235 return S("This block can be turned into @1 with a hoe.", name
)
237 return S("This block can be cultivated by a hoe.")
244 --[[ Node defines skeleton key and key callbacks which probably implies that
245 it can be unlocked by keys ]]
246 local function f_key(itemstring
, def
)
247 if def
.on_key_use
and def
.on_skeleton_key_use
then
248 return S("This block is compatible with keys.")
254 doc
.sub
.items
.register_factoid("nodes", "use", f_key
)
255 doc
.sub
.items
.register_factoid("nodes", "use", f_hoe_soil
)
256 doc
.sub
.items
.register_factoid("nodes", "groups", f_cools_lava
)
257 doc
.sub
.items
.register_factoid("nodes", "groups", f_fire
)
258 doc
.sub
.items
.register_factoid("nodes", "groups", f_flora
)
259 doc
.sub
.items
.register_factoid("nodes", "groups", f_leafdecay
)
260 doc
.sub
.items
.register_factoid("nodes", "groups", f_soil
)
261 doc
.sub
.items
.register_factoid("nodes", "groups", f_spreading_dirt_type
)
265 doc
.add_entry_alias("nodes", "default:grass_1", "nodes", "default:grass_"..i
)
266 doc
.add_entry_alias("nodes", "default:dry_grass_1", "nodes", "default:dry_grass_"..i
)
269 doc
.add_entry_alias("nodes", "farming:wheat_8", "nodes", "farming:wheat_"..i
)
270 doc
.add_entry_alias("nodes", "farming:cotton_8", "nodes", "farming:cotton_"..i
)
272 doc
.add_entry_alias("nodes", "default:lava_source", "nodes", "default:lava_flowing")
273 doc
.add_entry_alias("nodes", "default:water_source", "nodes", "default:water_flowing")
274 doc
.add_entry_alias("nodes", "default:river_water_source", "nodes", "default:river_water_flowing")
275 doc
.add_entry_alias("nodes", "default:furnace", "nodes", "default:furnace_active")
276 doc
.add_entry_alias("nodes", "default:torch", "nodes", "default:torch_wall")
277 doc
.add_entry_alias("nodes", "default:torch", "nodes", "default:torch_ceiling")
278 doc
.add_entry_alias("nodes", "doors:door_wood_a", "nodes", "doors:door_wood_b")
279 --doc.add_entry_alias("nodes", "doors:door_wood_a", "craftitems", "doors:door_wood")
280 --[[doc.add_entry_alias("nodes", "doors:door_steel_a", "nodes", "doors:door_steel_b")
281 doc.add_entry_alias("nodes", "doors:door_steel_a", "craftitems", "doors:door_steel")
282 doc.add_entry_alias("nodes", "doors:door_glass_a", "nodes", "doors:door_glass_b")
283 doc.add_entry_alias("nodes", "doors:door_glass_a", "craftitems", "doors:door_glass")
284 doc.add_entry_alias("nodes", "doors:door_obsidian_glass_a", "nodes", "doors:door_obsidian_glass_b")
285 doc.add_entry_alias("nodes", "doors:door_obsidian_glass_a", "craftitems", "doors:door_obsidian_glass")
287 doc
.add_entry_alias("nodes", "doors:gate_wood_closed", "nodes", "doors:gate_wood_open")
288 doc
.add_entry_alias("nodes", "doors:gate_junglewood_closed", "nodes", "doors:gate_junglewood_open")
289 doc
.add_entry_alias("nodes", "doors:gate_acacia_wood_closed", "nodes", "doors:gate_acacia_wood_open")
290 doc
.add_entry_alias("nodes", "doors:gate_aspen_wood_closed", "nodes", "doors:gate_aspen_wood_open")
291 doc
.add_entry_alias("nodes", "doors:gate_pine_wood_closed", "nodes", "doors:gate_pine_wood_open")
292 doc
.add_entry_alias("nodes", "doors:trapdoor", "nodes", "doors:trapdoor_open")
293 doc
.add_entry_alias("nodes", "doors:trapdoor_steel", "nodes", "doors:trapdoor_steel_open")
294 doc
.add_entry_alias("nodes", "tnt:tnt", "nodes", "tnt:tnt_burning")
295 doc
.add_entry_alias("nodes", "tnt:gunpowder", "nodes", "tnt:gunpowder_burning")
296 doc
.add_entry_alias("nodes", "xpanes:pane_flat", "nodes", "xpanes:pane")
297 doc
.add_entry_alias("nodes", "xpanes:bar_flat", "nodes", "xpanes:bar")
300 dofile(minetest
.get_modpath("doc_minetest_game") .. "/helptexts.lua")
302 -- Register boat object for doc_identifier
303 if minetest
.get_modpath("doc_identifier") ~= nil then
304 doc
.sub
.identifier
.register_object("boats:boat", "craftitems", "boats:boat")
305 doc
.sub
.identifier
.register_object("carts:cart", "craftitems", "carts:cart")
310 -- Remove the superficial “help” comment from screwdriver and cart description as redundant
311 minetest
.override_item("screwdriver:screwdriver", {description
= item_name_overrides
["screwdriver:screwdriver"]})
312 minetest
.override_item("carts:cart", {description
= item_name_overrides
["carts:cart"]})