From 79da0248ed14257480f2c434d2f88d507975f8f0 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 28 Dec 2016 15:19:28 +0100 Subject: [PATCH] Create hoe soil factoid to auto-generate soil help --- helptexts.lua | 6 +++--- init.lua | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/helptexts.lua b/helptexts.lua index 3af3275..bf8d479 100644 --- a/helptexts.lua +++ b/helptexts.lua @@ -124,14 +124,14 @@ local export_longdesc = { ["default:desert_stonebrick"] = buildnode, ["default:dirt_with_grass"] = S("Very common on the surface, found in grasslands, forests and jungles. It is a resourceful block which supports the growth and spreading of many small plants and trees. This block can be turned into soil for farming with a hoe. Dirt with grass turns into dirt with snow when a snow block is placed on top of it."), ["default:dirt_with_grass_footsteps"] = S("A decorational variant of dirt with grass, it looks like someone has stepped on the grass. Unlike dirt with grass, it doesn't change on its own and doesn't spread its grass on other dirt blocks."), - ["default:dirt_with_dry_grass"] = S("Common on the surface, found in savannahs. This block can be turned into soil for farming with a hoe."), + ["default:dirt_with_dry_grass"] = S("Common on the surface, found in savannahs."), ["default:dirt_with_snow"] = S("Dirt with a snow cover, found in cold regions."), ["default:snow"] = S("A thin layer of snow. When it it on top of dirt, the dirt will slowly turn into dirt with snow. When snow lands on dirt with grass, it immediately turns into dirt with snow."), ["default:snowblock"] = S("A very thick layer of snow, filling an entire block. Snow this thick can usually only be found in arctic regions. When this block is placed on top of dirt with grass, the dirt with grass turns into dirt with snow."), ["default:ice"] = S("Ice is found in arctic regions. It can appear either in huge glacier formations below snow blocks, or above water."), - ["default:dirt"] = S("Dirt is found often directly under the surface and very common in many regions of the world. When exposed to sunlight, the surface of dirt may change, depending on its neighbors. It can be turned into soil for farming with a hoe."), + ["default:dirt"] = S("Dirt is found often directly under the surface and very common in many regions of the world. When exposed to sunlight, the surface of dirt may change, depending on its neighbors."), ["default:sand"] = S("Sand is found in large quantities at beaches, but it occasionally appears in small chunks around the world."), - ["default:desert_sand"] = S("Usually found in huge quantities at the surface of deserts. Members of the @1 group will slowly turn into dry shrubs when placed on desert sand. Desert sand can be turned into desert sand soil with a hoe.", groupname_flora), + ["default:desert_sand"] = S("Usually found in huge quantities at the surface of deserts. Members of the @1 group will slowly turn into dry shrubs when placed on desert sand.", groupname_flora), ["default:silver_sand"] = S("Silver sand can be found in cold biomes in the form of so-called cold deserts."), ["default:gravel"] = S("This block consists of a couple of loose stones and can't support itself. It is common only at the beaches of very cold regions, but it can be found in small quantities on the surface and underground."), ["default:clay"] = S("Clay is a rather soft material and it sometimes found in sand beaches."), diff --git a/init.lua b/init.lua index 06ec80e..9afbff3 100644 --- a/init.lua +++ b/init.lua @@ -232,6 +232,23 @@ local function f_spreading_dirt_type(itemstring, def) end end +local function f_hoe_soil(itemstring, def) + if def.soil then + local name, node + nodedef = minetest.registered_nodes[def.soil.dry] + if nodedef then + name = nodedef.description + end + if name then + return S("This block can be turned into @1 with a hoe.", name) + else + return S("This block can be cultivated by a hoe.") + end + 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) @@ -243,6 +260,7 @@ local function f_key(itemstring, def) end doc.sub.items.register_factoid("nodes", "use", f_key) +doc.sub.items.register_factoid("nodes", "use", f_hoe_soil) 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) -- 2.11.4.GIT