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",
90 "xpanes:obsidian_pane",
93 "default:chest_locked_open",
96 local hidden_items
= {
98 "default:dirt_with_grass_footsteps",
101 local item_name_overrides
= {
102 ["screwdriver:screwdriver"] = S("Screwdriver"),
103 ["map:mapping_kit"] = S("Mapping Kit"),
104 ["binoculars:binoculars"] = S("Binoculars"),
105 ["carts:cart"] = S("Cart"),
106 ["fire:basic_flame"] = S("Basic Flame"),
107 ["farming:wheat_8"] = S("Wheat Plant"),
108 ["farming:cotton_8"] = S("Cotton Plant"),
109 ["default:lava_source"] = S("Lava"),
110 ["default:water_source"] = S("Water"),
111 ["default:river_water_source"] = S("River Water"),
112 ["doors:door_wood_a"] = minetest
.registered_items
["doors:door_wood"].description
,
113 ["doors:door_steel_a"] = minetest
.registered_items
["doors:door_steel"].description
,
114 ["doors:door_glass_a"] = minetest
.registered_items
["doors:door_glass"].description
,
115 ["doors:door_obsidian_glass_a"] = minetest
.registered_items
["doors:door_obsidian_glass"].description
,
118 local image_overrides
= {
119 ["doors:door_wood_a"] = minetest
.registered_items
["doors:door_wood"].inventory_image
,
120 ["doors:door_steel_a"] = minetest
.registered_items
["doors:door_steel"].inventory_image
,
121 ["doors:door_glass_a"] = minetest
.registered_items
["doors:door_glass"].inventory_image
,
122 ["doors:door_obsidian_glass_a"] = minetest
.registered_items
["doors:door_obsidian_glass"].inventory_image
,
125 doc
.sub
.items
.add_friendly_group_names(groupdefs
)
126 doc
.sub
.items
.add_notable_groups(miscgroups
)
128 for i
=1, #hidden_items
do
129 local item
= minetest
.registered_items
[hidden_items
[i]]
131 minetest
.override_item(hidden_items
[i
], { _doc_items_hidden
= true } )
134 for i
=1, #forced_items
do
135 local item
= minetest
.registered_items
[forced_items
[i]]
137 minetest
.override_item(forced_items
[i
], { _doc_items_create_entry
= true} )
140 for i
=1, #suppressed_items
do
141 local item
= minetest
.registered_items
[suppressed_items
[i]]
143 minetest
.override_item(suppressed_items
[i
], { _doc_items_create_entry
= false} )
146 for itemstring
, data
in pairs(item_name_overrides
) do
147 if minetest
.registered_items
[itemstring
] ~= nil then
148 minetest
.override_item(itemstring
, { _doc_items_entry_name
= data
} )
151 for itemstring
, data
in pairs(image_overrides
) do
152 if minetest
.registered_items
[itemstring
] ~= nil then
153 minetest
.override_item(itemstring
, { _doc_items_image
= data
} )
157 -- Minetest Game Factoids
160 local function f_cools_lava(itemstring
, def
)
161 if def
.groups
.cools_lava
~= nil or def
.groups
.water
~= nil then
162 return S("This block turns adjacent lava sources into obsidian and adjacent flowing lava into stone.")
168 -- Groups flammable, puts_out_fire
169 local function f_fire(itemstring
, def
)
172 if def
.groups
.flammable
~= nil then
173 s
= s
.. S("This block is flammable.")
176 if def
.groups
.puts_out_fire
~= nil then
177 if def
.groups
.flammable
~= nil then
180 s
= s
.. S("This block will extinguish nearby fire.")
183 if def
.groups
.igniter
~= nil then
184 if def
.groups
.flammable
~= nil or def
.groups
.puts_out_fire
~= nil then
187 s
= s
.. S("This block will set flammable blocks within a radius of @1 on fire.", def
.groups
.igniter
)
188 if def
.walkable
== false then
189 s
= s
.. S(" It also destroys flammable items which have been dropped inside.")
196 local function f_flora(itemstring
, def
)
197 if def
.groups
.flora
== 1 then
198 local groupname
= doc
.sub
.items
.get_group_name("flora")
199 -- Dry shrub rule not complete; flora dies on group:sand except default:sand. But that's okay.
200 -- The missing nodes will be covered on their own entries by the f_and_dry_shrub factoid.
201 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
)
207 -- sand nodes which turn flora blocks into dry shrub (e.g. silver sand, desert sand)
208 local function f_sand_dry_shrub(itemstring
, def
)
209 if def
.groups
.sand
== 1 and itemstring
~= "default:sand" then
211 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"))
218 local function f_soil(itemstring
, def
)
219 if def
.groups
.soil
== 1 then
220 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"))
221 elseif def
.groups
.soil
== 2 or def
.groups
.soil
== 3 then
222 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.")
228 local function f_leafdecay(itemstring
, def
)
229 local formstring
= ""
230 if def
.groups
.leafdecay
~= nil then
231 if def
.groups
.leafdecay_drop
~= nil then
232 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
)
234 if def
.drop
~= "" and def
.drop
~= nil and def
.drop
~= itemstring
then
235 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
)
237 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
)
244 local function f_spreading_dirt_type(itemstring
, def
)
245 if def
.groups
.spreading_dirt_type
then
246 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.")
252 local function f_hoe_soil(itemstring
, def
)
255 nodedef
= minetest
.registered_nodes
[def
.soil
.dry
]
257 name
= nodedef
.description
260 return S("This block can be turned into @1 with a hoe.", name
)
262 return S("This block can be cultivated by a hoe.")
269 --[[ Node defines skeleton key and key callbacks which probably implies that
270 it can be unlocked by keys ]]
271 local function f_key(itemstring
, def
)
272 if def
.on_key_use
and def
.on_skeleton_key_use
then
273 return S("This block is compatible with keys.")
279 doc
.sub
.items
.register_factoid("nodes", "use", f_key
)
280 doc
.sub
.items
.register_factoid("nodes", "use", f_hoe_soil
)
281 doc
.sub
.items
.register_factoid("nodes", "groups", f_cools_lava
)
282 doc
.sub
.items
.register_factoid("nodes", "groups", f_fire
)
283 doc
.sub
.items
.register_factoid("nodes", "groups", f_flora
)
284 doc
.sub
.items
.register_factoid("nodes", "groups", f_sand_dry_shrub
)
285 doc
.sub
.items
.register_factoid("nodes", "groups", f_leafdecay
)
286 doc
.sub
.items
.register_factoid("nodes", "groups", f_soil
)
287 doc
.sub
.items
.register_factoid("nodes", "groups", f_spreading_dirt_type
)
291 doc
.add_entry_alias("nodes", "default:grass_1", "nodes", "default:grass_"..i
)
292 doc
.add_entry_alias("nodes", "default:dry_grass_1", "nodes", "default:dry_grass_"..i
)
295 doc
.add_entry_alias("nodes", "farming:wheat_8", "nodes", "farming:wheat_"..i
)
296 doc
.add_entry_alias("nodes", "farming:cotton_8", "nodes", "farming:cotton_"..i
)
298 doc
.add_entry_alias("nodes", "default:lava_source", "nodes", "default:lava_flowing")
299 doc
.add_entry_alias("nodes", "default:water_source", "nodes", "default:water_flowing")
300 doc
.add_entry_alias("nodes", "default:river_water_source", "nodes", "default:river_water_flowing")
301 doc
.add_entry_alias("nodes", "default:furnace", "nodes", "default:furnace_active")
302 doc
.add_entry_alias("nodes", "default:torch", "nodes", "default:torch_wall")
303 doc
.add_entry_alias("nodes", "default:torch", "nodes", "default:torch_ceiling")
304 doc
.add_entry_alias("nodes", "doors:door_wood_fake", "craftitems", "doors:door_wood")
305 doc
.add_entry_alias("nodes", "doors:door_steel_fake", "craftitems", "doors:door_steel")
306 doc
.add_entry_alias("nodes", "doors:door_glass_fake", "craftitems", "doors:door_glass")
307 doc
.add_entry_alias("nodes", "doors:door_obsidian_glass_fake", "craftitems", "doors:door_obsidian_glass")
308 doc
.add_entry_alias("nodes", "doors:door_wood_fake", "nodes", "doors:door_wood_a")
309 doc
.add_entry_alias("nodes", "doors:door_steel_fake", "nodes", "doors:door_steel_a")
310 doc
.add_entry_alias("nodes", "doors:door_glass_fake", "nodes", "doors:door_glass_a")
311 doc
.add_entry_alias("nodes", "doors:door_obsidian_glass_fake", "nodes", "doors:door_obsidian_glass_a")
312 doc
.add_entry_alias("nodes", "doors:door_wood_fake", "nodes", "doors:door_wood_b")
313 doc
.add_entry_alias("nodes", "doors:door_steel_fake", "nodes", "doors:door_steel_b")
314 doc
.add_entry_alias("nodes", "doors:door_glass_fake", "nodes", "doors:door_glass_b")
315 doc
.add_entry_alias("nodes", "doors:door_obsidian_glass_fake", "nodes", "doors:door_obsidian_glass_b")
316 doc
.add_entry_alias("nodes", "doors:gate_wood_closed", "nodes", "doors:gate_wood_open")
317 doc
.add_entry_alias("nodes", "doors:gate_junglewood_closed", "nodes", "doors:gate_junglewood_open")
318 doc
.add_entry_alias("nodes", "doors:gate_acacia_wood_closed", "nodes", "doors:gate_acacia_wood_open")
319 doc
.add_entry_alias("nodes", "doors:gate_aspen_wood_closed", "nodes", "doors:gate_aspen_wood_open")
320 doc
.add_entry_alias("nodes", "doors:gate_pine_wood_closed", "nodes", "doors:gate_pine_wood_open")
321 doc
.add_entry_alias("nodes", "doors:trapdoor", "nodes", "doors:trapdoor_open")
322 doc
.add_entry_alias("nodes", "doors:trapdoor_steel", "nodes", "doors:trapdoor_steel_open")
323 doc
.add_entry_alias("nodes", "tnt:tnt", "nodes", "tnt:tnt_burning")
324 doc
.add_entry_alias("nodes", "tnt:gunpowder", "nodes", "tnt:gunpowder_burning")
325 doc
.add_entry_alias("nodes", "xpanes:pane_flat", "nodes", "xpanes:pane")
326 doc
.add_entry_alias("nodes", "xpanes:obsidian_pane_flat", "nodes", "xpanes:obsidian_pane")
327 doc
.add_entry_alias("nodes", "xpanes:bar_flat", "nodes", "xpanes:bar")
328 doc
.add_entry_alias("nodes", "default:chest", "nodes", "default:chest_open")
329 doc
.add_entry_alias("nodes", "default:chest_locked", "nodes", "default:chest_locked_open")
332 dofile(minetest
.get_modpath("doc_minetest_game") .. "/helptexts.lua")
334 -- Register boat object for doc_identifier
335 if minetest
.get_modpath("doc_identifier") ~= nil then
336 doc
.sub
.identifier
.register_object("boats:boat", "craftitems", "boats:boat")
337 doc
.sub
.identifier
.register_object("carts:cart", "craftitems", "carts:cart")
341 --[[ Completely create door entries from scratch. We suppressed all normal door entries
342 before. This is quite a hack, but required because of the weird way how door items are
343 implemented in Minetest Game.
344 CHECKME: As doors are sensitive, check this entire section after each Minetest Game release.
347 local doors
= { "doors:door_wood", "doors:door_steel", "doors:door_glass", "doors:door_obsidian_glass" }
350 local door
= doors
[d
]
351 local def1
= table.copy(minetest
.registered_items
[door
])
352 local def2
= table.copy(minetest
.registered_items
[door
.."_a"])
354 def2
._doc_items_image
= def1
.inventory_image
356 def2
.stack_max
= def1
.stack_max
or minetest
.nodedef_default
.stack_max
357 def2
.liquidtype
= "none"
358 def2
._doc_items_longdesc
= def1
._doc_items_longdesc
359 def2
._doc_items_usagehelp
= def1
._doc_items_usagehelp
361 doc
.add_entry("nodes", door
.."_fake", {
362 name
= def2
.description
,
363 hidden
= def2
._doc_items_hidden
== true,
366 longdesc
= def2
._doc_items_longdesc
,
367 usagehelp
= def2
._doc_items_usagehelp
,
373 -- Remove the superficial “help” comment from screwdriver and cart description as redundant
374 minetest
.override_item("screwdriver:screwdriver", {description
= item_name_overrides
["screwdriver:screwdriver"]})
375 minetest
.override_item("carts:cart", {description
= item_name_overrides
["carts:cart"]})