summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--API.md14
-rw-r--r--init.lua36
2 files changed, 37 insertions, 13 deletions
diff --git a/API.md b/API.md
index 659011c..76bf969 100644
--- a/API.md
+++ b/API.md
@@ -188,9 +188,17 @@ Add a custom factoid (see above) for the specified category.
* `nil`: All of the above
* `factoid_type`: Rough categorization of the factoid's content. Controls
where in the text the factoid appears. Possible values:
- * `"groups"`: Factoid appears near groups
- * `"misc"`: Factoid of other type, appears near the end
- * **(more to come)**
+ * For all items:
+ * `"groups"`: Group-related factoid
+ * `"misc"`: Factoid doesn't fit anywhere else, is shown near the end
+ * For nodes only:
+ * `damage`: Related to player/mob damage or health
+ * `movement`: Related to player movement on, in or at node
+ * `sound`: Related to node sounds
+ * `gravity`: Related to gravity (e.g. falling node)
+ * `drop_detroy`: Related to node being destroyed or node dropping as an item
+ * `light`: Related to node light (luminance)
+ * `mining`: Related to mining
* `factoid_generator`: A function which turns item definition into a string
(see blow)
diff --git a/init.lua b/init.lua
index ba6a544..3facfea 100644
--- a/init.lua
+++ b/init.lua
@@ -388,6 +388,8 @@ doc.new_category("nodes", {
datastring = datastring .. S("The fall damage on this block is reduced by @1%.", math.abs(fdap)) .. "\n"
end
end
+ datastring = datastring .. get_custom_factoids("nodes", "damage", data)
+ datastring = newline2(datastring)
---- Movement
if data.def.groups.disable_jump == 1 then
@@ -400,7 +402,8 @@ doc.new_category("nodes", {
if bouncy ~= nil then
datastring = datastring .. S("This block will make you bounce off with an elasticity of @1%.", bouncy).."\n"
end
-
+ datastring = datastring .. get_custom_factoids("nodes", "movement", data)
+ datastring = newline2(datastring)
---- Sounds
local function is_silent(def, soundtype)
@@ -431,12 +434,16 @@ doc.new_category("nodes", {
datastring = datastring .. S("Building this block is completely silent.").."\n"
end
end
+ datastring = datastring .. get_custom_factoids("nodes", "sound", data)
+ datastring = newline2(datastring)
-- Block activity
--- Gravity
if data.def.groups.falling_node == 1 then
datastring = datastring .. S("This block is affected by gravity and can fall.").."\n"
end
+ datastring = datastring .. get_custom_factoids("nodes", "gravity", data)
+ datastring = newline2(datastring)
--- Dropping and destruction
if data.def.buildable_to == true then
@@ -462,6 +469,8 @@ doc.new_category("nodes", {
if data.def.floodable == true then
datastring = datastring .. S("Liquids can flow into this block and destroy it.").."\n"
end
+ datastring = datastring .. get_custom_factoids("nodes", "drop_destroy", data)
+ datastring = newline2(datastring)
-- Block appearance
--- Light
@@ -485,6 +494,8 @@ doc.new_category("nodes", {
elseif data.def.sunlight_propagates then
datastring = datastring .. S("This block allows sunlight to propagate without loss in brightness.").."\n"
end
+ datastring = datastring .. get_custom_factoids("nodes", "light", data)
+ datastring = newline2(datastring)
--- List nodes/groups to which this node connects to
if data.def.connects_to ~= nil then
@@ -533,6 +544,8 @@ doc.new_category("nodes", {
datastring = newline2(datastring)
-- Mining groups
+ datastring = datastring .. get_custom_factoids("nodes", "mining", data)
+ datastring = newline(datastring)
if data.def.pointable ~= false and (data.def.liquid_type == "none" or data.def.liquid_type == nil) then
-- Check if there are no mining groups at all
local nogroups = true
@@ -755,17 +768,18 @@ doc.new_category("nodes", {
datastring = newline(datastring)
end
end
+ datastring = newline2(datastring)
-- Show fuel recipe
- datastring = newline2(datastring)
datastring = datastring .. fuel_factoid(data.itemstring, "nodes")
+ datastring = newline2(datastring)
-- Other custom factoids
- datastring = newline2(datastring)
datastring = datastring .. get_custom_factoids("nodes", "misc", data)
-
datastring = newline2(datastring)
+
datastring = datastring .. itemstring_factoid(data.itemstring, playername)
+ datastring = newline2(datastring)
formstring = formstring .. doc.widgets.text(datastring, nil, nil, doc.FORMSPEC.ENTRY_WIDTH - 1.2)
@@ -836,17 +850,18 @@ doc.new_category("tools", {
datastring = datastring .. S("This tool belongs to these groups: @1.", gstring).."\n"
end
end
+ datastring = newline2(datastring)
-- Show fuel recipe
- datastring = newline2(datastring)
datastring = datastring .. fuel_factoid(data.itemstring, "tools")
+ datastring = newline2(datastring)
-- Other custom factoids
- datastring = newline2(datastring)
datastring = datastring .. get_custom_factoids("tools", "misc", data)
-
datastring = newline2(datastring)
+
datastring = datastring .. itemstring_factoid(data.itemstring, playername)
+ datastring = newline2(datastring)
formstring = formstring .. doc.widgets.text(datastring, nil, nil, doc.FORMSPEC.ENTRY_WIDTH - 1.2)
@@ -910,17 +925,18 @@ doc.new_category("craftitems", {
datastring = datastring .. S("This item belongs to these groups: @1.", gstring) .. "\n"
end
end
+ datastring = newline2(datastring)
-- Show fuel recipe
- datastring = newline2(datastring)
datastring = datastring .. fuel_factoid(data.itemstring, "craftitems")
+ datastring = newline2(datastring)
-- Other custom factoids
- datastring = newline2(datastring)
datastring = datastring .. get_custom_factoids("craftitems", "misc", data)
-
datastring = newline2(datastring)
+
datastring = datastring .. itemstring_factoid(data.itemstring, playername)
+ datastring = newline2(datastring)
formstring = formstring .. doc.widgets.text(datastring, nil, nil, doc.FORMSPEC.ENTRY_WIDTH - 1.2)