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
|
local groupdefs = {
["book"] = "Books",
["vessel"] = "Vessels",
["dye"] = "Dyes",
["stick"] = "Sticks",
["wool"] = "Wool",
["sand"] = "Sand",
["wood"] = "Wood",
["stone"] = "Stones",
["metal"] = "Metal",
["tree"] = "Tree Trunks",
["fence"] = "Fences",
["wall"] = "Walls",
["leaves"] = "Leaves and Needles",
["flower"] = "Flowers",
["sapling"] = "Saplings",
["water"] = "Water",
["lava"] = "Lava",
["cracky"] = "Cracky",
["crumbly"] = "Crumbly",
["choppy"] = "Choppy",
["snappy"] = "Snappy",
["bendy"] = "Bendy",
["oddly_breakable_by_hand"] = "Hand-breakable",
["fleshy"] = "Flesh",
}
local miscgroups = { "book", "vessel", "dye", "stick", "wool", "sand", "wood", "stone", "metal", "tree", "fence", "wall", "leaves", "flower", "sapling", "water", "lava" }
local mininggroups = { "cracky", "crumbly", "choppy", "snappy", "bendy", "oddly_breakable_by_hand" }
local forced_items = {
"default:book_written",
"default:cloud",
"bones:bones",
"farming:soil",
"farming:soil_wet",
"farming:desert_sand_soil",
"farming:desert_sand_soil_wet",
"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 = {
"doors:door_wood",
"doors:door_steel",
"doors:door_glass",
"doors:door_obsidian_glass",
}
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,
}
doc.sub.items.add_real_group_names(groupdefs)
doc.sub.items.add_notable_groups(miscgroups)
doc.sub.items.add_mining_groups(mininggroups)
doc.sub.items.add_forced_item_entries(forced_items)
doc.sub.items.add_suppressed_item_entries(suppressed_items)
doc.sub.items.add_item_name_overrides(item_name_overrides)
-- Minetest Game Factoids
-- Groups flammable, puts_out_fire
local function f_fire(itemstring, def)
local s = ""
-- Fire
if def.groups.flammable == 1 then
s = s .. "This block is flammable and burns slowly."
elseif def.groups.flammable == 2 then
s = s .. "This block is flammable and burns at medium speed."
elseif def.groups.flammable == 3 then
s = s .. "This block is highly flammable and burns very quickly."
elseif def.groups.flammable == 4 then
s = s .. "This block is very easily set on fire and burns extremely quickly."
elseif def.groups.flammable ~= nil then
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 .. "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 .. "This block will set flammable blocks within a radius of "..def.groups.igniter.." on fire."
end
return s
end
-- flora group
local function f_flora(itemstring, def)
if def.groups.flora == 1 then
return "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. 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 "This block is natural soil. It supports the spreading of blocks belonging to the Flora group and the growth of blocks belonging to the Saplings group."
elseif def.groups.soil == 2 or def.groups.soil == 3 then
return "This block serves as a soil for wild plants (Flora, Saplings) as well as plants grown from seeds. It supports their growth and spreading."
else
return ""
end
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_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_alias("nodes", "doors:door_wood_a", "doors:door_wood_b")
doc.add_entry_alias("nodes", "doors:door_steel_a", "doors:door_steel_b")
doc.add_entry_alias("nodes", "doors:door_glass_a", "doors:door_glass_b")
doc.add_entry_alias("nodes", "doors:door_obsidian_glass_a", "doors:door_obsidian_glass_b")
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")
-- 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_identifier.register_object("boats:boat", "craftitems", "boats:boat")
end
-- Achievement
local awardchecktime = 0
if minetest.get_modpath("awards") ~= nil then
-- TODO: Change the goal to unlocking/discovering all block entries of Minetest Game
-- (excluding unused blocks like default:cloud)
awards.register_achievement("doc_minetest_game_allnodes", {
title = "Block Index Completed",
icon = "doc_awards_icon_generic.png",
description = "Read all help entries about blocks.",
})
minetest.register_globalstep(function(dtime)
-- Check awards every 30 seconds
awardchecktime = awardchecktime + dtime
if awardchecktime < 30 then return end
awardchecktime = 30 - awardchecktime
local players = minetest.get_connected_players()
for p=1,#players do
local playername = players[p]:get_player_name()
local count = doc.get_viewed_count(playername, "nodes")
if count ~= nil and count >= doc.get_entry_count("nodes") then
awards.unlock(playername, "doc_minetest_game_allnodes")
end
end
end)
end
|