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
|
-- Boilerplate to support localized strings if intllib mod is installed.
local S
if minetest.get_modpath("intllib") then
dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
else
S = function(s) return s 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"),
["cracky"] = S("Cracky"),
["crumbly"] = S("Crumbly"),
["choppy"] = S("Choppy"),
["snappy"] = S("Snappy"),
["bendy"] = S("Bendy"),
["oddly_breakable_by_hand"] = S("Hand-breakable"),
["fleshy"] = S("Flesh"),
}
local miscgroups = { "book", "vessel", "dye", "stick", "wool", "sand", "wood", "stone", "metal", "tree", "fence", "wall", "leaves", "flower", "sapling", "water", "lava" }
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",
"xpanes:pane_1",
"xpanes:bar_1",
}
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"] = "Screwdriver",
["fire:basic_flame"] = "Basic Flame",
["farming:wheat_8"] = "Wheat Plant",
["farming:cotton_8"] = "Cotton Plant",
["default:lava_source"] = "Lava",
["default:water_source"] = "Water",
["default:river_water_source"] = "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,
["xpanes:pane_1"] = minetest.registered_items["xpanes:pane"].description,
["xpanes:bar_1"] = minetest.registered_items["xpanes:bar"].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,
["xpanes:pane_1"] = minetest.registered_items["xpanes:pane"].inventory_image,
["xpanes:bar_1"] = minetest.registered_items["xpanes:bar"].inventory_image,
}
doc.sub.items.add_real_group_names(groupdefs)
doc.sub.items.add_notable_groups(miscgroups)
doc.sub.items.add_forced_item_entries(forced_items)
doc.sub.items.add_suppressed_item_entries(suppressed_items)
doc.sub.items.add_hidden_item_entries(hidden_items)
doc.sub.items.add_item_name_overrides(item_name_overrides)
doc.sub.items.add_item_image_overrides(image_overrides)
-- Minetest Game Factoids
-- Groups flammable, puts_out_fire
local function f_fire(itemstring, def)
local s = ""
-- Fire
if def.groups.flammable ~= nil then
-- TODO: When the fire mod supports different flammable levels, add flavor texts
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 .. string.format(S("This block will set flammable blocks within a radius of %d on fire."), def.groups.igniter)
end
return s
end
-- flora group
local function f_flora(itemstring, def)
if def.groups.flora == 1 then
return S("This block belongs to the Flora 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 Flora blocks. On desert sand, it will wither and die and turn into a dry shrub.")
else
return ""
end
end
-- soil group
local function f_soil(itemstring, def)
if def.groups.soil == 1 then
return S("This block is natural soil. It supports the growth of blocks belonging to the Saplings group.")
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
if def.groups.leafdecay_drop ~= nil then
formstring = string.format(S("This block may drop as an item when no trunk is nearby. This is prevented if any block of the group “Tree Trunks” is nearby (up to a distance of %d), the block is completely surrounded by blocks which are neither air or a liquid or it has been manually placed by a player."), def.groups.leafdecay)
else
if def.drop ~= "" and def.drop ~= nil and def.drop ~= itemstring then
formstring = string.format(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 “Tree Trunks” is nearby (up to a distance of %d), the block is completely surrounded by blocks which are neither air or a liquid or it has been placed by a player."), def.groups.leafdecay)
else
formstring = string.format(S("This block may decay and disappear when no trunk is nearby. Decay is prevented if any block of the group “Tree Trunks” is nearby (up to a distance of %d), the block is completely surrounded by blocks which are neither air or a liquid or it has been placed by a player."), def.groups.leafdecay)
end
end
end
return formstring
end
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)
-- 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", "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")
local pane_aliases = {}
local bar_aliases = {}
for i=2,15 do
table.insert(pane_aliases, "xpanes:pane_"..i)
table.insert(bar_aliases, "xpanes:bar_"..i)
end
table.insert(pane_aliases, "xpanes:pane")
table.insert(bar_aliases, "xpanes:bar")
doc.add_entry_aliases("nodes", "xpanes:pane_1", pane_aliases)
doc.add_entry_aliases("nodes", "xpanes:bar_1", bar_aliases)
-- 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")
end
-- Remove the “helper” comment from screwdriver description since the help is
-- provided by this mod
minetest.override_item("screwdriver:screwdriver", {description = item_name_overrides["screwdriver:screwdriver"]})
-- TODO: Maybe add achievement for discovering all Minetest Game node entries
|