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"),
30 ["snowy"] = S("Snowy"),
32 ["cracky"] = S("Cracky"),
33 ["crumbly"] = S("Crumbly"),
34 ["choppy"] = S("Choppy"),
35 ["snappy"] = S("Snappy"),
36 ["oddly_breakable_by_hand"] = S("Hand-breakable"),
38 ["fleshy"] = S("Flesh"),
42 "book", -- for placing in bookshelf
43 "vessel", -- for placing in vessels shelf
44 "sand", -- for cactus growth ABM
45 "flora", -- for the plant spreading ABM
46 "sapling", -- for the sapling growth ABM
47 "water", -- for the obsidian and farming ABMs
50 local forced_items
= {
56 local suppressed_items
= {
57 "default:water_flowing",
58 "default:river_water_flowing",
59 "default:lava_flowing",
60 "default:dry_grass_2",
61 "default:dry_grass_3",
62 "default:dry_grass_4",
63 "default:dry_grass_5",
68 "default:furnace_active",
72 "doors:door_obsidian_glass",
76 "doors:door_obsidian_glass_a",
80 "doors:door_obsidian_glass_b",
81 "doors:gate_wood_open",
82 "doors:gate_junglewood_open",
83 "doors:gate_acacia_wood_open",
84 "doors:gate_aspen_wood_open",
85 "doors:gate_pine_wood_open",
86 "doors:trapdoor_steel_open",
87 "doors:trapdoor_open",
92 "default:chest_locked_open",
95 local hidden_items
= {
97 "default:dirt_with_grass_footsteps",
100 local item_name_overrides
= {
101 ["screwdriver:screwdriver"] = S("Screwdriver"),
102 ["carts:cart"] = S("Cart"),
103 ["fire:basic_flame"] = S("Basic Flame"),
104 ["farming:wheat_8"] = S("Wheat Plant"),
105 ["farming:cotton_8"] = S("Cotton Plant"),
106 ["default:lava_source"] = S("Lava"),
107 ["default:water_source"] = S("Water"),
108 ["default:river_water_source"] = S("River Water"),
109 ["doors:door_wood_a"] = minetest
.registered_items
["doors:door_wood"].description
,
110 ["doors:door_steel_a"] = minetest
.registered_items
["doors:door_steel"].description
,
111 ["doors:door_glass_a"] = minetest
.registered_items
["doors:door_glass"].description
,
112 ["doors:door_obsidian_glass_a"] = minetest
.registered_items
["doors:door_obsidian_glass"].description
,
115 local image_overrides
= {
116 ["doors:door_wood_a"] = minetest
.registered_items
["doors:door_wood"].inventory_image
,
117 ["doors:door_steel_a"] = minetest
.registered_items
["doors:door_steel"].inventory_image
,
118 ["doors:door_glass_a"] = minetest
.registered_items
["doors:door_glass"].inventory_image
,
119 ["doors:door_obsidian_glass_a"] = minetest
.registered_items
["doors:door_obsidian_glass"].inventory_image
,
122 doc
.sub
.items
.add_friendly_group_names(groupdefs
)
123 doc
.sub
.items
.add_notable_groups(miscgroups
)
125 for i
=1, #hidden_items
do
126 local item
= minetest
.registered_items
[hidden_items
[i]]
128 minetest
.override_item(hidden_items
[i
], { _doc_items_hidden
= true } )
131 for i
=1, #forced_items
do
132 local item
= minetest
.registered_items
[forced_items
[i]]
134 minetest
.override_item(forced_items
[i
], { _doc_items_create_entry
= true} )
137 for i
=1, #suppressed_items
do
138 local item
= minetest
.registered_items
[suppressed_items
[i]]
140 minetest
.override_item(suppressed_items
[i
], { _doc_items_create_entry
= false} )
143 for itemstring
, data
in pairs(item_name_overrides
) do
144 if minetest
.registered_items
[itemstring
] ~= nil then
145 minetest
.override_item(itemstring
, { _doc_items_entry_name
= data
} )
148 for itemstring
, data
in pairs(image_overrides
) do
149 if minetest
.registered_items
[itemstring
] ~= nil then
150 minetest
.override_item(itemstring
, { _doc_items_image
= data
} )
154 -- Minetest Game Factoids
157 local function f_cools_lava(itemstring
, def
)
158 if def
.groups
.cools_lava
~= nil or def
.groups
.water
~= nil then
159 return S("This block turns adjacent lava sources into obsidian and adjacent flowing lava into stone.")
165 -- Groups flammable, puts_out_fire
166 local function f_fire(itemstring
, def
)
169 if def
.groups
.flammable
~= nil then
170 s
= s
.. S("This block is flammable.")
173 if def
.groups
.puts_out_fire
~= nil then
174 if def
.groups
.flammable
~= nil then
177 s
= s
.. S("This block will extinguish nearby fire.")
180 if def
.groups
.igniter
~= nil then
181 if def
.groups
.flammable
~= nil or def
.groups
.puts_out_fire
~= nil then
184 s
= s
.. S("This block will set flammable blocks within a radius of @1 on fire.", def
.groups
.igniter
)
185 if def
.walkable
== false then
186 s
= s
.. S(" It also destroys flammable items which have been dropped inside.")
193 local function f_flora(itemstring
, def
)
194 if def
.groups
.flora
== 1 then
195 local groupname
= doc
.sub
.items
.get_group_name("flora")
196 -- Dry shrub rule not complete; flora dies on group:sand except default:sand. But that's okay.
197 -- The missing nodes will be covered on their own entries by the f_and_dry_shrub factoid.
198 return S("This block belongs to the @1 group. It a living organism which likes to grow and spread on dirt with grass and similar “soil”-type blocks when it is in light. Spreading will stop when the surrounding area is too crammed with @2 blocks. On silver sand and desert sand, it will wither and die and turn into a dry shrub.", groupname
, groupname
)
204 -- sand nodes which turn flora blocks into dry shrub (e.g. silver sand, desert sand)
205 local function f_sand_dry_shrub(itemstring
, def
)
206 if def
.groups
.sand
== 1 and itemstring
~= "default:sand" then
208 return S("Flowers and other blocks in the @1 group will slowly turn into dry shrubs when placed on this block.", doc
.sub
.items
.get_group_name("flora"))
215 local function f_soil(itemstring
, def
)
216 if def
.groups
.soil
== 1 then
217 return S("This block serves as a soil for saplings and small plants. Blocks in the “@1” group will grow into trees. Blocks in the “@2” group will spread slowly.", doc
.sub
.items
.get_group_name("sapling"), doc
.sub
.items
.get_group_name("flora"))
218 elseif def
.groups
.soil
== 2 or def
.groups
.soil
== 3 then
219 return S("This block serves as a soil for saplings and other small plants as well as plants grown from seeds. It supports their growth.")
225 local function f_leafdecay(itemstring
, def
)
226 local formstring
= ""
227 if def
.groups
.leafdecay
~= nil then
228 if def
.groups
.leafdecay_drop
~= nil then
229 formstring
= S("This block may drop as an item when there is no trunk or stem of its species within a distance of @1. Leaf decay does not occour when the block has been manually placed by a player.", def
.groups
.leafdecay
)
231 if def
.drop
~= "" and def
.drop
~= nil and def
.drop
~= itemstring
then
232 formstring
= S("This block quickly decays when there is no trunk or stem block of its species within a distance of @1. When decaying, it disappears and may drop one of its mining drops (but not itself). The block does not decay when the block has been placed by a player.", def
.groups
.leafdecay
)
234 formstring
= S("This block quickly decays and disappears when there is no trunk or stem block of its species within a distance of @1. The block does not decay when the block has been placed by a player.", def
.groups
.leafdecay
)
241 local function f_spreading_dirt_type(itemstring
, def
)
242 if def
.groups
.spreading_dirt_type
then
243 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.")
249 local function f_hoe_soil(itemstring
, def
)
252 nodedef
= minetest
.registered_nodes
[def
.soil
.dry
]
254 name
= nodedef
.description
257 return S("This block can be turned into @1 with a hoe.", name
)
259 return S("This block can be cultivated by a hoe.")
266 --[[ Node defines skeleton key and key callbacks which probably implies that
267 it can be unlocked by keys ]]
268 local function f_key(itemstring
, def
)
269 if def
.on_key_use
and def
.on_skeleton_key_use
then
270 return S("This block is compatible with keys.")
276 doc
.sub
.items
.register_factoid("nodes", "use", f_key
)
277 doc
.sub
.items
.register_factoid("nodes", "use", f_hoe_soil
)
278 doc
.sub
.items
.register_factoid("nodes", "groups", f_cools_lava
)
279 doc
.sub
.items
.register_factoid("nodes", "groups", f_fire
)
280 doc
.sub
.items
.register_factoid("nodes", "groups", f_flora
)
281 doc
.sub
.items
.register_factoid("nodes", "groups", f_sand_dry_shrub
)
282 doc
.sub
.items
.register_factoid("nodes", "groups", f_leafdecay
)
283 doc
.sub
.items
.register_factoid("nodes", "groups", f_soil
)
284 doc
.sub
.items
.register_factoid("nodes", "groups", f_spreading_dirt_type
)
288 doc
.add_entry_alias("nodes", "default:grass_1", "nodes", "default:grass_"..i
)
289 doc
.add_entry_alias("nodes", "default:dry_grass_1", "nodes", "default:dry_grass_"..i
)
292 doc
.add_entry_alias("nodes", "farming:wheat_8", "nodes", "farming:wheat_"..i
)
293 doc
.add_entry_alias("nodes", "farming:cotton_8", "nodes", "farming:cotton_"..i
)
295 doc
.add_entry_alias("nodes", "default:lava_source", "nodes", "default:lava_flowing")
296 doc
.add_entry_alias("nodes", "default:water_source", "nodes", "default:water_flowing")
297 doc
.add_entry_alias("nodes", "default:river_water_source", "nodes", "default:river_water_flowing")
298 doc
.add_entry_alias("nodes", "default:furnace", "nodes", "default:furnace_active")
299 doc
.add_entry_alias("nodes", "default:torch", "nodes", "default:torch_wall")
300 doc
.add_entry_alias("nodes", "default:torch", "nodes", "default:torch_ceiling")
301 doc
.add_entry_alias("nodes", "doors:door_wood_fake", "craftitems", "doors:door_wood")
302 doc
.add_entry_alias("nodes", "doors:door_steel_fake", "craftitems", "doors:door_steel")
303 doc
.add_entry_alias("nodes", "doors:door_glass_fake", "craftitems", "doors:door_glass")
304 doc
.add_entry_alias("nodes", "doors:door_obsidian_glass_fake", "craftitems", "doors:door_obsidian_glass")
305 doc
.add_entry_alias("nodes", "doors:door_wood_fake", "nodes", "doors:door_wood_a")
306 doc
.add_entry_alias("nodes", "doors:door_steel_fake", "nodes", "doors:door_steel_a")
307 doc
.add_entry_alias("nodes", "doors:door_glass_fake", "nodes", "doors:door_glass_a")
308 doc
.add_entry_alias("nodes", "doors:door_obsidian_glass_fake", "nodes", "doors:door_obsidian_glass_a")
309 doc
.add_entry_alias("nodes", "doors:door_wood_fake", "nodes", "doors:door_wood_b")
310 doc
.add_entry_alias("nodes", "doors:door_steel_fake", "nodes", "doors:door_steel_b")
311 doc
.add_entry_alias("nodes", "doors:door_glass_fake", "nodes", "doors:door_glass_b")
312 doc
.add_entry_alias("nodes", "doors:door_obsidian_glass_fake", "nodes", "doors:door_obsidian_glass_b")
313 doc
.add_entry_alias("nodes", "doors:gate_wood_closed", "nodes", "doors:gate_wood_open")
314 doc
.add_entry_alias("nodes", "doors:gate_junglewood_closed", "nodes", "doors:gate_junglewood_open")
315 doc
.add_entry_alias("nodes", "doors:gate_acacia_wood_closed", "nodes", "doors:gate_acacia_wood_open")
316 doc
.add_entry_alias("nodes", "doors:gate_aspen_wood_closed", "nodes", "doors:gate_aspen_wood_open")
317 doc
.add_entry_alias("nodes", "doors:gate_pine_wood_closed", "nodes", "doors:gate_pine_wood_open")
318 doc
.add_entry_alias("nodes", "doors:trapdoor", "nodes", "doors:trapdoor_open")
319 doc
.add_entry_alias("nodes", "doors:trapdoor_steel", "nodes", "doors:trapdoor_steel_open")
320 doc
.add_entry_alias("nodes", "tnt:tnt", "nodes", "tnt:tnt_burning")
321 doc
.add_entry_alias("nodes", "tnt:gunpowder", "nodes", "tnt:gunpowder_burning")
322 doc
.add_entry_alias("nodes", "xpanes:pane_flat", "nodes", "xpanes:pane")
323 doc
.add_entry_alias("nodes", "xpanes:bar_flat", "nodes", "xpanes:bar")
324 doc
.add_entry_alias("nodes", "default:chest", "nodes", "default:chest_open")
325 doc
.add_entry_alias("nodes", "default:chest_locked", "nodes", "default:chest_locked_open")
328 dofile(minetest
.get_modpath("doc_minetest_game") .. "/helptexts.lua")
330 -- Register boat object for doc_identifier
331 if minetest
.get_modpath("doc_identifier") ~= nil then
332 doc
.sub
.identifier
.register_object("boats:boat", "craftitems", "boats:boat")
333 doc
.sub
.identifier
.register_object("carts:cart", "craftitems", "carts:cart")
337 --[[ Completely create door entries from scratch. We suppressed all normal door entries
338 before. This is quite a hack, but required because of the weird way how door items are
339 implemented in Minetest Game.
340 CHECKME: As doors are sensitive, check this entire section after each Minetest Game release.
343 local doors
= { "doors:door_wood", "doors:door_steel", "doors:door_glass", "doors:door_obsidian_glass" }
346 local door
= doors
[d
]
347 local def1
= table.copy(minetest
.registered_items
[door
])
348 local def2
= table.copy(minetest
.registered_items
[door
.."_a"])
350 def2
._doc_items_image
= def1
.inventory_image
352 def2
.stack_max
= def1
.stack_max
or minetest
.nodedef_default
.stack_max
353 def2
.liquidtype
= "none"
354 def2
._doc_items_longdesc
= def1
._doc_items_longdesc
355 def2
._doc_items_usagehelp
= def1
._doc_items_usagehelp
357 doc
.add_entry("nodes", door
.."_fake", {
358 name
= def2
.description
,
359 hidden
= def2
._doc_items_hidden
== true,
362 longdesc
= def2
._doc_items_longdesc
,
363 usagehelp
= def2
._doc_items_usagehelp
,
369 -- Remove the superficial “help” comment from screwdriver and cart description as redundant
370 minetest
.override_item("screwdriver:screwdriver", {description
= item_name_overrides
["screwdriver:screwdriver"]})
371 minetest
.override_item("carts:cart", {description
= item_name_overrides
["carts:cart"]})