1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
|
-- Boilerplate to support localized strings if intllib mod is installed.
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter(minetest.get_current_modname())
else
S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
end
local groupdefs = {
["book"] = S("Books"),
["vessel"] = S("Vessels"),
["dye"] = S("Dyes"),
["stick"] = S("Sticks"),
["wool"] = S("Wool"),
["sand"] = S("Sand"),
["wood"] = S("Wood"),
["stone"] = S("Stones"),
["metal"] = S("Metal"),
["tree"] = S("Tree Trunks"),
["fence"] = S("Fences"),
["wall"] = S("Walls"),
["leaves"] = S("Leaves and Needles"),
["flower"] = S("Flowers"),
["sapling"] = S("Saplings"),
["water"] = S("Water"),
["lava"] = S("Lava"),
["coal"] = S("Coal"),
["water_bucket"] = S("Water buckets"),
["flora"] = S("Flora"),
["cracky"] = S("Cracky"),
["crumbly"] = S("Crumbly"),
["choppy"] = S("Choppy"),
["snappy"] = S("Snappy"),
["oddly_breakable_by_hand"] = S("Hand-breakable"),
["fleshy"] = S("Flesh"),
}
local miscgroups = {
"book", -- for placing in bookshelf
"vessel", -- for placing in vessels shelf
"sand", -- for cactus growth ABM
"flora", -- for the plant spreading ABM
"sapling", -- for the sapling growth ABM
"water", -- for the obsidian and farming ABMs
}
local forced_items = {
"fire:basic_flame",
"farming:wheat_8",
"farming:cotton_8",
"doors:door_wood_a",
"doors:door_steel_a",
"doors:door_glass_a",
"doors:door_obsidian_glass_a",
}
local suppressed_items = {
"default:water_flowing",
"default:river_water_flowing",
"default:lava_flowing",
"default:dry_grass_2",
"default:dry_grass_3",
"default:dry_grass_4",
"default:dry_grass_5",
"default:grass_2",
"default:grass_3",
"default:grass_4",
"default:grass_5",
"default:furnace_active",
"doors:door_wood",
"doors:door_steel",
"doors:door_glass",
"doors:door_obsidian_glass",
"doors:door_wood_b",
"doors:door_steel_b",
"doors:door_glass_b",
"doors:door_obsidian_glass_b",
"doors:gate_wood_open",
"doors:gate_junglewood_open",
"doors:gate_acacia_wood_open",
"doors:gate_aspen_wood_open",
"doors:gate_pine_wood_open",
"doors:trapdoor_steel_open",
"doors:trapdoor_open",
"doors:hidden",
"xpanes:pane",
"xpanes:bar",
}
local hidden_items = {
"default:cloud",
"default:dirt_with_grass_footsteps",
}
local item_name_overrides = {
["screwdriver:screwdriver"] = S("Screwdriver"),
["carts:cart"] = S("Cart"),
["fire:basic_flame"] = S("Basic Flame"),
["farming:wheat_8"] = S("Wheat Plant"),
["farming:cotton_8"] = S("Cotton Plant"),
["default:lava_source"] = S("Lava"),
["default:water_source"] = S("Water"),
["default:river_water_source"] = S("River Water"),
["doors:door_wood_a"] = minetest.registered_items["doors:door_wood"].description,
["doors:door_steel_a"] = minetest.registered_items["doors:door_steel"].description,
["doors:door_glass_a"] = minetest.registered_items["doors:door_glass"].description,
["doors:door_obsidian_glass_a"] = minetest.registered_items["doors:door_obsidian_glass"].description,
}
local image_overrides = {
["doors:door_wood_a"] = minetest.registered_items["doors:door_wood"].inventory_image,
["doors:door_steel_a"] = minetest.registered_items["doors:door_steel"].inventory_image,
["doors:door_glass_a"] = minetest.registered_items["doors:door_glass"].inventory_image,
["doors:door_obsidian_glass_a"] = minetest.registered_items["doors:door_obsidian_glass"].inventory_image,
}
doc.sub.items.add_friendly_group_names(groupdefs)
doc.sub.items.add_notable_groups(miscgroups)
for i=1, #hidden_items do
local item = minetest.registered_items[hidden_items[i]]
if item then
minetest.override_item(hidden_items[i], { _doc_items_hidden = true } )
end
end
for i=1, #forced_items do
local item = minetest.registered_items[forced_items[i]]
if item then
minetest.override_item(forced_items[i], { _doc_items_create_entry = true} )
end
end
for i=1, #suppressed_items do
local item = minetest.registered_items[suppressed_items[i]]
if item then
minetest.override_item(suppressed_items[i], { _doc_items_create_entry = false} )
end
end
for itemstring, data in pairs(item_name_overrides) do
if minetest.registered_items[itemstring] ~= nil then
minetest.override_item(itemstring, { _doc_items_entry_name = data} )
end
end
for itemstring, data in pairs(image_overrides) do
if minetest.registered_items[itemstring] ~= nil then
minetest.override_item(itemstring, { _doc_items_image = data} )
end
end
-- Minetest Game Factoids
-- Lava cooling
local function f_cools_lava(itemstring, def)
if def.groups.cools_lava ~= nil or def.groups.water ~= nil then
return S("This block turns adjacent lava sources into obsidian and adjacent flowing lava into stone.")
else
return ""
end
end
-- Groups flammable, puts_out_fire
local function f_fire(itemstring, def)
local s = ""
-- Fire
if def.groups.flammable ~= nil then
s = s .. S("This block is flammable.")
end
if def.groups.puts_out_fire ~= nil then
if def.groups.flammable ~= nil then
s = s .. "\n"
end
s = s .. S("This block will extinguish nearby fire.")
end
if def.groups.igniter ~= nil then
if def.groups.flammable ~= nil or def.groups.puts_out_fire ~= nil then
s = s .. "\n"
end
s = s .. S("This block will set flammable blocks within a radius of @1 on fire.", def.groups.igniter)
if def.walkable == false then
s = s .. S(" It also destroys flammable items which have been dropped inside.")
end
end
return s
end
-- flora group
local function f_flora(itemstring, def)
if def.groups.flora == 1 then
local groupname = doc.sub.items.get_group_name("flora")
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)
else
return ""
end
end
-- soil group
local function f_soil(itemstring, def)
if def.groups.soil == 1 then
return S("This block serves as a soil for saplings. Blocks in the Saplings group will grow into trees on this block.")
elseif def.groups.soil == 2 or def.groups.soil == 3 then
return S("This block serves as a soil for saplings as well as plants grown from seeds. It supports their growth.")
else
return ""
end
end
local function f_leafdecay(itemstring, def)
local formstring = ""
if def.groups.leafdecay ~= nil then
local groupname = doc.sub.items.get_group_name("tree")
if def.groups.leafdecay_drop ~= nil then
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)
else
if def.drop ~= "" and def.drop ~= nil and def.drop ~= itemstring then
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)
else
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)
end
end
end
return formstring
end
local function f_spreading_dirt_type(itemstring, def)
if def.groups.spreading_dirt_type then
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.")
else
return ""
end
end
--[[ Node defines skeleton key and key callbacks which probably implies that
it can be unlocked by keys ]]
local function f_key(itemstring, def)
if def.on_key_use and def.on_skeleton_key_use then
return S("This block is compatible with keys.")
else
return ""
end
end
doc.sub.items.register_factoid("nodes", "use", f_key)
doc.sub.items.register_factoid("nodes", "groups", f_cools_lava)
doc.sub.items.register_factoid("nodes", "groups", f_fire)
doc.sub.items.register_factoid("nodes", "groups", f_flora)
doc.sub.items.register_factoid("nodes", "groups", f_leafdecay)
doc.sub.items.register_factoid("nodes", "groups", f_soil)
doc.sub.items.register_factoid("nodes", "groups", f_spreading_dirt_type)
-- Add node aliases
for i=2,5 do
doc.add_entry_alias("nodes", "default:grass_1", "default:grass_"..i)
doc.add_entry_alias("nodes", "default:dry_grass_1", "default:dry_grass_"..i)
end
for i=1,7 do
doc.add_entry_alias("nodes", "farming:wheat_8", "farming:wheat_"..i)
doc.add_entry_alias("nodes", "farming:cotton_8", "farming:cotton_"..i)
end
doc.add_entry_alias("nodes", "default:lava_source", "default:lava_flowing")
doc.add_entry_alias("nodes", "default:water_source", "default:water_flowing")
doc.add_entry_alias("nodes", "default:river_water_source", "default:river_water_flowing")
doc.add_entry_alias("nodes", "default:furnace", "default:furnace_active")
doc.add_entry_aliases("nodes", "default:torch", {"default:torch_wall", "default:torch_ceiling"})
doc.add_entry_aliases("nodes", "doors:door_wood_a", {"doors:door_wood_b", "doors:doors_wood"})
doc.add_entry_aliases("nodes", "doors:door_steel_a", {"doors:door_steel_b", "doors:door_steel"})
doc.add_entry_aliases("nodes", "doors:door_glass_a", {"doors:door_glass_b", "doors:door_glass"})
doc.add_entry_aliases("nodes", "doors:door_obsidian_glass_a", {"doors:door_obsidian_glass_b", "doors:door_obsidian_glass"})
doc.add_entry_alias("nodes", "doors:gate_wood_closed", "doors:gate_wood_open")
doc.add_entry_alias("nodes", "doors:gate_junglewood_closed", "doors:gate_junglewood_open")
doc.add_entry_alias("nodes", "doors:gate_acacia_wood_closed", "doors:gate_acacia_wood_open")
doc.add_entry_alias("nodes", "doors:gate_aspen_wood_closed", "doors:gate_aspen_wood_open")
doc.add_entry_alias("nodes", "doors:gate_pine_wood_closed", "doors:gate_pine_wood_open")
doc.add_entry_alias("nodes", "doors:trapdoor", "doors:trapdoor_open")
doc.add_entry_alias("nodes", "doors:trapdoor_steel", "doors:trapdoor_steel_open")
doc.add_entry_alias("nodes", "tnt:tnt", "tnt:tnt_burning")
doc.add_entry_alias("nodes", "tnt:gunpowder", "tnt:gunpowder_burning")
doc.add_entry_alias("nodes", "xpanes:pane_flat", "xpanes:pane")
doc.add_entry_alias("nodes", "xpanes:bar_flat", "xpanes:bar")
-- Gather help texts
dofile(minetest.get_modpath("doc_minetest_game") .. "/helptexts.lua")
-- Register boat object for doc_identifier
if minetest.get_modpath("doc_identifier") ~= nil then
doc.sub.identifier.register_object("boats:boat", "craftitems", "boats:boat")
doc.sub.identifier.register_object("carts:cart", "craftitems", "carts:cart")
end
-- Remove the superficial “help” comment from screwdriver and cart description as redundant
minetest.override_item("screwdriver:screwdriver", {description = item_name_overrides["screwdriver:screwdriver"]})
minetest.override_item("carts:cart", {description = item_name_overrides["carts:cart"]})
-- TODO: Maybe add achievement for discovering all Minetest Game node entries
|