summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--API.md19
-rw-r--r--init.lua13
2 files changed, 31 insertions, 1 deletions
diff --git a/API.md b/API.md
index e6d70fe..10b1037 100644
--- a/API.md
+++ b/API.md
@@ -69,6 +69,22 @@ item can be used but it is not needed for standard mining tools and weapons.
For more information, read the recommendations for
`doc.sub.items.set_items_longdesc` and `doc.sub.items.set_items_usagehelp`.
+#### Template texts
+For your convenience, a few template texts are provided for common texts
+to avoid redundancy and to increase consistency for somple things. You can
+use these as values in the setter functions. For more complex items, you
+should of course write your own texts instead. Read `init.lua` to see the
+actual texts.
+
+##### Long description
+* `doc.sub.items.temp.build`: For building blocks like the brick block in Minetest Game
+* `doc.sub.items.temp.deco`: For other decorational blocks.
+* `doc.sub.items.temp.craftitem`: For items solely or almost solely used for crafting
+
+##### Usage help
+* `doc.sub.items.temp.eat`: For eatable items using the `on_use=minetest.item_eat(1)` idiom
+* `doc.sub.items.temp.eat_bad`: Same as above, but eating them is considered a bad idea
+
### Forced and suppressed items
By default, an entry for each item is added, except for items in the group
`not_in_creative_inventory`. This default behaviour already covers most
@@ -144,6 +160,9 @@ purpose of a simple item, like that coal lumps are primarily used as fuel.
Sometimes, a long description is not neccessary because the item is already
exhaustively explained by factoids.
+For very simple items, consider using one of the text templates mentioned
+above.
+
Minimal style guide: Use complete sentences.
#### Example
diff --git a/init.lua b/init.lua
index a93d0c2..377c9b5 100644
--- a/init.lua
+++ b/init.lua
@@ -1,5 +1,15 @@
doc.sub.items = {}
+-- Template texts
+doc.sub.items.temp = {}
+doc.sub.items.temp.deco = "This is a decorational block."
+doc.sub.items.temp.build = "This block is a building block for creating various buildings."
+doc.sub.items.temp.craftitem = "This item is primarily used for crafting other items."
+
+doc.sub.items.temp.eat = "Hold it in your hand, then leftclick to eat it."
+doc.sub.items.temp.eat_bad = "Hold it in your hand, then leftclick to eat it. But why would you want to do this?"
+
+-- Local stuff
local groupdefs = {}
local mininggroups = {}
local miscgroups = {}
@@ -11,6 +21,7 @@ local item_name_overrides = {
["air"] = "Air"
}
+-- Helper functions
local groups_to_string = function(grouptable, filter)
local gstring = ""
local groups_count = 0
@@ -123,7 +134,7 @@ local fuel_factoid = function(itemstring, ctype)
end
-
+-- For factoids
local factoid_generators = {}
factoid_generators.nodes = {}
factoid_generators.tools = {}