diff options
-rw-r--r-- | depends.txt | 1 | ||||
-rw-r--r-- | helptexts.lua | 101 | ||||
-rw-r--r-- | init.lua | 254 |
3 files changed, 356 insertions, 0 deletions
diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..8e695ec --- /dev/null +++ b/depends.txt @@ -0,0 +1 @@ +doc diff --git a/helptexts.lua b/helptexts.lua new file mode 100644 index 0000000..aac9f70 --- /dev/null +++ b/helptexts.lua @@ -0,0 +1,101 @@ +help = {} +help.longdesc = { + ["default:apple"] = "Eat it to restore 2 HP.", + ["default:furnace"] = "Cooks several items, using a furnace fuel, into something else.", + ["default:chest"] = "Provides 32 slots of inventory space.", + ["default:chest_locked"] = "Provides 32 slots of inventory space, is accessible only to the player who placed it.", + ["default:chest_locked"] = "Provides 32 slots of inventory space, is accessible only to the player who placed it.", + ["default:stone"] = "A very common block in the world of Minetest. It sometimes contains ores. Usable for a variety in crafting recipes. Can be dug with a wooden pickaxe or better.", + ["default:desert_stone"] = "A less common block in the world, usually only found in deserts. Can be dug with a wooden pickaxe or better.", + ["default:stone_with_coal"] = "Some natural coal! Can be dug with a wooden pickaxe or better.", + ["default:stone_with_iron"] = "Some natural iron! Can be dug with a stone pickaxe or better.", + ["default:stone_with_copper"] = "Some natural copper! Can be dug with a stone pickaxe or better.", + ["default:stone_with_mese"] = "This stone contains a small amount of Mese! Can be dug with a steel pickaxe or better to obtain a mese crystal.", + ["default:stone_with_gold"] = "Some natural gold! Can be dug with a steel pickaxe or better.", + ["default:stone_with_diamond"] = "Hooray, diamonds! Can be dug with a steel pickaxe or better.", + ["default:stonebrick"] = "A decorational block.", + ["default:desert_stonebrick"] = "A decorational block.", + ["default:dirt_with_grass"] = "Natural soil for a variety of plants. It has been exposed to sunlight and is thus grassy. Can be dug with a shovel.", + ["default:dirt"] = "Natural soil for a variety of plants. Its top will become grassy if it becomes exposed to sunlight. Can be dug with a shovel.", + ["default:sand"] = "An unstable block, it will fall if nothing is below it. Usually found at beaches. It is best dug with a shovel.", + ["default:desert_sand"] = "An unstable block, it will fall if nothing is below it. Usually found in deserts. It is best dug with a shovel.", + ["default:gravel"] = "An unstable block, it will fall if nothing is below it. It is best dug with a shovel.", + ["default:sandstone"] = "A decorational block. It can be mined with a pickaxe or shovel", + ["default:sandstonebrick"] = "A decorational block.", + ["default:clay"] = "Clay.", + ["default:brick"] = "A decorational block.", + ["default:tree"] = "A trunk of an ordinary tree. You can break it with your bare hands!", + ["default:jungletree"] = "A trunk of a jungle tree. You can break it with your bare hands!", + ["default:wood"] = "A decorational and flammable block.", + ["default:junglewood"] = "A decorational and flammable block.", + ["default:pinewood"] = "A decorational and flammable block.", + ["default:sapling"] = "When placed on dirt and exposed to sunlight, this sapling will grow into an ordinary tree or an apple tree after some time.", + ["default:junglesapling"] = "When placed on dirt and exposed to sunlight, this sapling will grow into a large jungle tree after some time.", + ["default:pine_sapling"] = "When placed on dirt and exposed to sunlight, this sapling will grow into a pine tree after some time.", + ["default:leaves"] = "Leaves of an ordinary tree or apple tree. It will decay if there is no tree trunk near it, unless you have placed the leaves manually.", + ["default:jungleleaves"] = "Leaves of a jungle tree. It will decay if there is no tree trunk near it, unless you have placed the leaves manually.", + ["default:pine_needles"] = "Needles of a pine tree. It will decay if there is no tree trunk near it, unless you have placed the pine needles manually.", + ["default:cactus"] = "A piece of cactus usually found in deserts. Cactus placed on desert sand will slowly grow up to 4 cactus blocks high.", + ["default:papyrus"] = "A papyrus piece usually found near water. Papyrus will grow up to 4 blocks high when it is near a water source.", + ["default:bookshelf"] = "A bookshelf provides space for 16 books.", + ["default:glass"] = "A decorational, transparent block.", + ["default:fence_wood"] = "A fence post. When multiple of these are placed to next to each other, they will automatically build a nice fence structure. You can easily jump over a low fence.", + ["default:rail"] = "Railroad tracks. Place these on the ground to build your railway, the blocks will automatically connect to each other nicely.", + ["default:ladder"] = "A piece of ladder which allows you to move vertically.", + ["default:water_flowing"] = "You can swim easily in water, but you need to catch your breath from time to time.", + ["default:water_source"] = "You can swim easily in water, but you need to catch your breath from time to time.", + ["default:lava_source"] = "Don't touch the lava, it will hurt you very much and once you're in, it is hard to get out.", + ["default:lava_flowing"] = "Don't touch the lava, it will hurt you very much and once you're in, it is hard to get out.", + ["default:torch"] = "Provides plenty of light, but not as much as a sun would do. It can be placed on almost any block facing any direction.", + ["default:sign_wall"] = "A sign which is placed at walls. You can write anything you want on it.", + + ["default:cobble"] = "A decorational block.", + ["default:desert_cobble"] = "A decorational block.", + ["default:mossycobble"] = "A decorational block.", + ["default:coalblock"] = "A decorational block.", + ["default:steelblock"] = "A decorational block.", + ["default:copperblock"] = "A decorational block.", + ["default:bronzeblock"] = "A decorational block.", + ["default:goldblock"] = "A decorational block.", + ["default:diamondblock"] = "A very hard decorational block.", + ["default:obsidian_glass"] = "A decorational, transparent block.", + ["default:obsidian"] = "A hard mineral which is generated when a lava source meets a water source.", + ["default:nyancat"] = "A pop-tart cat in a block. Just for fun.", + ["default:nyancat_rainbow"] = "A rainbow in a block. Just for fun.", + ["default:grass_1"] = "Some grass. On a dirt with grass block, it will slowly spread.", + + + ["bones:bones"] = "These are the remains of a deceased player. It contains the player's inventory.", + + ["farming:soil"] = "Dry soil, this is where you can grow crops on. Dry soil will become wet if a water source is near.", + ["farming:soil_wet"] = "Wet soil, this is where you can grow crops on.", + ["farming:desert_sand_soil"] = "Dry soil, this is where you can grow crops on. Dry soil will become wet if a water source is near.", + ["farming:desert_sand_soil_wet"] = "Wet soil, this is where you can grow crops on.", + + ["tnt:tnt"] = "An explosive device which is capable of damaging living beings and destroys blocks around it, shortly after it has been ignited. With a small chance, blocks may drop as an item. TNT can be ignited by explosions and fire.", + ["tnt:gunpowder"] = "Gunpowder is used to craft TNT and to create gunpowder trails which can be ignited.", + + ["fire:basic_flame"] = "Fire is a damaging and destructive but short-lived kind of block. It will destroy and spread towards near flammable blocks, but fire will disappear if there is nothing to burn left. Fire will be extinguished faster if water is near it (no matter from which direction). A single fire block can be destroyed safely by punching it, but it is hurtful if you stand directly in fire.", + + ["bedrock2:bedrock"] = "If you have found this block then you have reached the bottom of the world. Bedrock cannot be moved, altered or destroyed by any means.", + + ["doors:trapdoor"] = "A trapdoor covers a hole in the floor and can be opened manually to access the area below it. An opened trapdoor can be climbed like a ladder.", +} + +help.usagehelp = { + ["default:apple"] = "Leftclick to eat.", + ["default:furnace"] = "Rightclick the furnace to view it. Place a furnace fuel in the lower slot and the source material in the upper slot. The furnace will slowly use its fuel to smelt the item. The result will be placed into the 4 slots at the right side.", + ["default:chest"] = "Rightclick the chest to open it and to exchange items.", + ["default:chest_locked"] = "Rightclick the chest to open it and to exchange items. This is only possible if you own the chest.", + ["default:ladder"] = "Hold the jump key to climb up and the sneak or use key (depends on configuration) to climb down.", + ["default:sign_wall"] = "Rightclick the sign to edit the text.", + + ["default:bookshelf"] = "Rightclick to open the bookshelf. You can store one book per inventory slot. To collect the bookshelf, you must make sure it does not contain any books.", + + ["bones:bones"] = "Rightclick to access the inventory, dig it to obtain all items immediately. If these are not your bones, you have to wait 10 minutes before you can do this. It is only possible to take from this inventory, nothing can be stored into it.", + + ["tnt:gunpowder"] = "Place gunpowder on the ground to create gunpowder trails. Punch it with a torch to light the gunpowder, which will then ignore neighbor gunpowder and TNT.", + ["tnt:tnt"] = "Place the TNT on the ground and punch it with a torch to light it and quickly get in a safe distance before it explodes. A burning gunpowder trail will also light the TNT.", + + ["doors:trapdoor"] = "Rightclick the trapdoor to open or close it. When the trapdoor is open, use the sneak or use key (depends on your configuration) to climb down, and the jump key to climb up.", +} diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..874f51f --- /dev/null +++ b/init.lua @@ -0,0 +1,254 @@ +local groupdefs = { +} + +local forced_nodes = { + "bones:bones", + "farming:soil", + "farming:soil_wet", + "farming:desert_sand_soil", + "farming:desert_sand_soil_wet", +} + +local groups_to_string = function(grouptable) + local gstring = "" + if #grouptable == 0 then + return nil + end + for id, value in pairs(grouptable) do + if groupdefs[id] ~= nil then + gstring = gstring .. groupdefs[id][value] .. "\\, " + end + end + return gstring +end + +doc.new_category("nodes", { + name = "Blocks", + build_formspec = function(data) + if data then + local longdesc = data.longdesc or "N/A" + local usagehelp = data.usagehelp or "N/A" + local formstring = "item_image[11,0;1,1;"..data.itemstring.."]" + formstring = formstring .. "textarea[0.25,1;10,8;;Description: "..longdesc.."\n\n" + formstring = formstring .. "Usage: "..usagehelp .. "\n\n" + formstring = formstring .. "Maximum stack size: "..data.def.stack_max.. "\n" + + local yesno = function(bool) + if bool==true then return "Yes" + elseif bool==false then return "No" + else return "N/A" end + end + + formstring = formstring .. "Collidable: "..yesno(data.def.walkable).. "\n" + local liquid + if data.def.liquidtype ~= "none" then liquid = true else liquid = false end + formstring = formstring .. "Liquid: "..yesno(liquid).. "\n" + if liquid then + local range, renew, viscos + if data.def.liquid_range then range = data.def.liquid_range else range = 8 end + if data.def.liquid_renewable then range = data.def.liquid_renewable else renew = true end + if data.def.liquid_viscosity then viscos = data.def.liquid_viscosity else viscosity = 0 end + formstring = formstring .. "Liquid range: "..range.. "\n" + formstring = formstring .. "Liquid viscosity: "..viscos.. "\n" + formstring = formstring .. "Renewable liquid: "..yesno(renew).. "\n" + end + formstring = formstring .. "Pointable: "..yesno(data.def.pointable).. "\n" + formstring = formstring .. "Transparent to sunlight: "..yesno(data.def.sunlight_propagates).. "\n" + + formstring = formstring .. "\n" + + -- Global factoids + if data.def.buildable_to == true then + formstring = formstring .. "This block will be replaced when building on it.\n" + end + if data.def.light_source == 15 then + formstring = formstring .. "This block is a very bright source of light. It glows as bright the sun.\n" + elseif data.def.light_source > 12 then + formstring = formstring .. "This block is a bright source of light.\n" + elseif data.def.light_source > 5 then + formstring = formstring .. "This block is a source of light.\n" + elseif data.def.light_source > 0 then + formstring = formstring .. "This block is a source of light and glow faintly.\n" + end + if data.def.climbable == true then + formstring = formstring .. "This block can be climbed.\n" + end + if data.def.damage_per_second > 1 then + formstring = formstring .. "This block causes a damage of "..data.def.damage_per_second.." hit points per second.\n" + elseif data.def.damage_per_second == 1 then + formstring = formstring .. "This block causes a damage of "..data.def.damage_per_second.." hit point per second.\n" + elseif data.def.damage_per_second < -1 then + formstring = formstring .. "This block heals "..data.def.damage_per_second.." hit points per second.\n" + elseif data.def.damage_per_second == -1 then + formstring = formstring .. "This block heals "..data.def.damage_per_second.." hit point per second.\n" + end + if data.def.drowning > 0 then + formstring = formstring .. "You will slowly lose breath in this block.\n" + end + + if data.def.groups.immortal == 1 then + formstring = formstring .. "This block can not be dug by ordinary digging tools.\n" + end + if data.def.groups.dig_immediate == 2 then + formstring = formstring .. "This block can be dug by any tool in half a second.\n" + elseif data.def.groups.dig_immediate == 3 then + formstring = formstring .. "This block can be dug by any tool immediately.\n" + end + + if data.def.groups.falling_node == 1 then + formstring = formstring .. "This block is affected by gravity and can fall.\n" + end + if data.def.groups.attached_node == 1 then + formstring = formstring .. "This block must be attached to another block\\, otherwise it will drop as an item.\n" + end + if data.def.groups.disable_jump == 1 then + formstring = formstring .. "You can not jump while standing on this block.\n" + end + local fdap = data.def.groups.fall_damage_add_percent + if fdap ~= nil then + if fdap > 0 then + formstring = formstring .. "The fall damage is "..fdap.."% higher on this block.\n" + elseif fdap == -100 then + formstring = formstring .. "This block negates all fall damage.\n" + else + formstring = formstring .. "The fall damage is "..math.abs(fdap).."% lower on this block.\n" + end + end + local bouncy = data.def.groups.bouncy + if bouncy ~= nil then + formstring = formstring .. "You will bounce on this block with a bounce speed of "..bouncy.."%.\n" + end + + formstring = formstring .. "\n" + + -- minetest_game factoids + 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 + + formstring = formstring .. "\n" + if data.def.groups.oddly_breakable_by_hand ~= nil then + formstring = formstring .. "This block can be dug by hand.\n" + end + + if data.def.groups.cracky == 1 then + formstring = formstring .. "This block is slightly cracky and can be dug by a strong pickaxe.\n" + elseif data.def.groups.cracky == 2 then + formstring = formstring .. "This block is cracky and can be dug by a pickaxe.\n" + elseif data.def.groups.cracky == 3 then + formstring = formstring .. "This block is very cracky and can be dug easily by a pickaxe.\n" + elseif data.def.groups.cracky ~= nil then + formstring = formstring .. "This block is cracky in some way.\n" + end + + + if data.def.groups.crumbly == 1 then + formstring = formstring .. "This block is slightly crumbly and can be dug by a good shovel.\n" + elseif data.def.groups.crumbly == 2 then + formstring = formstring .. "This block is crumbly and can be dug by a shovel.\n" + elseif data.def.groups.crumbly == 3 then + formstring = formstring .. "This block is very crumbly and can be dug easily by a shovel.\n" + elseif data.def.groups.crumbly ~= nil then + formstring = formstring .. "This block is crumbly in some way.\n" + end + + if data.def.groups.explody == 1 then + formstring = formstring .. "This block is a bit prone to explosions.\n" + elseif data.def.groups.explody == 2 then + formstring = formstring .. "This block is prone to explosions.\n" + elseif data.def.groups.explody == 3 then + formstring = formstring .. "This block is very prone to explosions and easily affected by them.\n" + elseif data.def.groups.explody ~= nil then + formstring = formstring .. "This block is prone to explosions to some extent.\n" + end + + if data.def.groups.snappy == 1 then + formstring = formstring .. "This block is slightly snappy and can be dug by fine tools.\n" + elseif data.def.groups.snappy == 2 then + formstring = formstring .. "This block is snappy and can be dug by fine tools.\n" + elseif data.def.groups.snappy == 3 then + formstring = formstring .. "This block is highly snappy and can be dug easily by fine tools.\n" + elseif data.def.groups.snappy ~= nil then + formstring = formstring .. "This block is to some extent snappy.\n" + end + + if data.def.groups.choppy == 1 then + formstring = formstring .. "This block is a bit choppy and can be dug by tools which involve brute force.\n" + elseif data.def.groups.choppy == 2 then + formstring = formstring .. "This block is choppy and can be dug by tools which involve brute force.\n" + elseif data.def.groups.choppy == 3 then + formstring = formstring .. "This block is highly choppy and can easily be dug by tools which involve brute force.\n" + elseif data.def.groups.choppy ~= nil then + formstring = formstring .. "This block is choppy to some extent.\n" + end + + if data.def.groups.fleshy ~= nil then + formstring = formstring .. "This block is made out of flesh.\n" + end + + formstring = formstring .. "\n\n" + + -- Show other “exposable” groups + local gstring = groups_to_string(data.def.groups) + if gstring ~= nil then + formstring = formstring .. "This block is member of the following additional groups: "..groups_to_string(data.def.groups).."\n" + end + + + formstring = formstring .. ";]" + + return formstring + else + return "label[0,1;NO DATA AVALIABLE!" + end + end +}) + +dofile(minetest.get_modpath("doc_minetest_game") .. "/helptexts.lua") + +local function gather_descs() + doc.new_entry("nodes", "air", { + name = "Air", + data = { + itemstring = "air", + longdesc = "A transparent block, basically empty space. It is usually left behind after digging something.", + def = minetest.registered_nodes["air"], + } + }) + for id, def in pairs(minetest.registered_nodes) do + local name, ld, uh + name = def.description + local forced = false + for i=1, #forced_nodes do + if name == forced_nodes then forced = true end + end + if not (name == nil or name == "" or def.groups.not_in_creative_inventory) or forced then + if help.longdesc[id] ~= nil then + ld = help.longdesc[id] + end + if help.usagehelp[id] ~= nil then + uh = help.usagehelp[id] + end + local infotable = { + name = name, + data = { + longdesc = ld, + usagehelp = uh, + itemstring = id, + def = def, + } + } + doc.new_entry("nodes", id, infotable) + end + end +end + +minetest.after(0, gather_descs) |