minetest_doc_minetest_game/init.lua

134 lines
4.6 KiB
Lua
Raw Normal View History

2015-05-16 13:57:51 -07:00
local groupdefs = {
2016-07-31 14:58:58 -07:00
["book"] = "Books",
["vessel"] = "Vessels",
["dye"] = "Dyes",
["wheat"] = "Wheat",
["stick"] = "Sticks",
["wool"] = "Wool",
["sand"] = "Sand",
["wood"] = "Wood",
["stone"] = "Stone",
2016-07-31 19:31:53 -07:00
["metal"] = "Metal",
2016-07-31 14:58:58 -07:00
["tree"] = "Tree Trunks",
["leaves"] = "Leaves and Needles",
["flower"] = "Flowers",
["sapling"] = "Saplings",
2016-07-31 19:31:53 -07:00
["fleshy"] = "Flesh",
}
local minegroups = {
["cracky"] = "Cracky",
["crumbly"] = "Crumbly",
["choppy"] = "Choppy",
["snappy"] = "Snappy",
["bendy"] = "Bendy",
["oddly_breakable_by_hand"] = "Oddly breakable by hand",
}
local damagegroups= {
["fleshy"] = "Flesh",
2015-05-16 13:57:51 -07:00
}
local forced_nodes = {
2016-07-19 11:21:46 -07:00
"default:cloud",
2015-05-16 13:57:51 -07:00
"bones:bones",
"farming:soil",
"farming:soil_wet",
"farming:desert_sand_soil",
"farming:desert_sand_soil_wet",
2016-07-19 08:25:24 -07:00
"fire:basic_flame",
2016-07-25 10:27:54 -07:00
"farming:wheat_8",
"farming:cotton_8",
2015-05-16 13:57:51 -07:00
}
local item_name_overrides = {
["screwdriver:screwdriver"] = "Screwdriver",
["fire:basic_flame"] = "Basic Flame",
2016-07-25 10:27:54 -07:00
["farming:wheat_8"] = "Wheat Plant",
["farming:cotton_8"] = "Cotton Plant",
2016-07-31 18:20:46 -07:00
["default:lava_source"] = "Lava",
["default:water_source"] = "Water",
["default:river_water_source"] = "River Water",
}
doc.sub.items.add_real_group_names(groupdefs)
doc.sub.items.add_mine_group_names(minegroups)
doc.sub.items.add_damage_group_names(damagegroups)
doc.sub.items.add_forced_node_entries(forced_nodes)
doc.sub.items.add_item_name_overrides(item_name_overrides)
2015-05-16 13:57:51 -07:00
--[[
2015-05-16 13:57:51 -07:00
-- minetest_game factoids
2016-07-31 22:12:43 -07:00
-- Fire
2015-05-16 13:57:51 -07:00
if data.def.groups.flammable == 1 then
formstring = formstring .. "This block is flammable and burns slowly.\n"
elseif data.def.groups.flammable == 2 then
formstring = formstring .. "This block is flammable and burns at medium speed.\n"
elseif data.def.groups.flammable == 3 then
formstring = formstring .. "This block is highly flammable and burns very quickly.\n"
elseif data.def.groups.flammable == 4 then
formstring = formstring .. "This block is very easily set on fire and burns extremely quickly.\n"
elseif data.def.groups.flammable ~= nil then
formstring = formstring .. "This block is flammable.\n"
end
2016-03-11 00:30:33 -08:00
if data.def.groups.puts_out_fire ~= nil then
formstring = formstring .. "This block will extinguish nearby fire.\n"
end
2016-07-31 22:12:43 -07:00
-- Other noteworthy groups
2016-07-23 17:14:01 -07:00
if data.def.groups.flora == 1 then
2016-07-31 15:41:05 -07:00
formstring = formstring .. "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.\n"
2016-07-23 17:14:01 -07:00
end
2016-07-19 13:21:08 -07:00
if data.def.groups.soil == 1 then
2016-07-31 15:41:05 -07:00
formstring = formstring .. "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.\n"
2016-07-23 17:14:01 -07:00
elseif data.def.groups.soil == 2 or data.def.groups.soil == 3 then
2016-07-31 15:41:05 -07:00
formstring = formstring .. "This block serves as a soil for wild plants (Flora, Saplings) as well as plants grown from seeds. It supports their growth and spreading.\n"
2016-07-19 13:21:08 -07:00
end
]]
2015-05-16 13:57:51 -07:00
-- 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
2016-07-25 10:27:54 -07:00
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
2016-07-31 18:20:46 -07:00
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")
-- Gather help texts
2015-05-16 13:57:51 -07:00
dofile(minetest.get_modpath("doc_minetest_game") .. "/helptexts.lua")
-- 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",
2016-08-01 13:48:46 -07:00
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
2016-08-01 08:57:37 -07:00
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
2016-08-01 08:57:37 -07:00
awards.unlock(playername, "doc_minetest_game_allnodes")
end
end
end)
end