summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-08-05 02:41:16 +0200
committerWuzzy <almikes@aol.com>2016-08-05 02:41:16 +0200
commit82b77ebc0ff07c92e133c054a50d46a8b99f5395 (patch)
tree15ca564ce15f02960c094a9ddb7426050b46c461 /init.lua
parent17b3d87e37a950c8713e09cee0d622a512802751 (diff)
Fix very bad range display
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua35
1 files changed, 29 insertions, 6 deletions
diff --git a/init.lua b/init.lua
index 19436d6..38609e5 100644
--- a/init.lua
+++ b/init.lua
@@ -110,6 +110,25 @@ local toolcaps_to_text = function(tool_capabilities)
return formstring
end
+local range_factoid = function(itemstring, def)
+ local handrange = minetest.registered_items[""].range
+ local itemrange = def.range
+ if itemstring == "" then
+ if handrange ~= nil then
+ return "Range: "..itemrange
+ else
+ return "Range: 4"
+ end
+ else
+ if handrange == nil then handrange = 4 end
+ if itemrange ~= nil then
+ return "Range: "..itemrange
+ else
+ return "Range: "..minetest.formspec_escape(item_name_overrides[""]).." ("..handrange..")"
+ end
+ end
+end
+
-- Smelting fuel factoid
local fuel_factoid = function(itemstring, ctype)
local formstring = ""
@@ -177,6 +196,14 @@ doc.new_category("nodes", {
end
formstring = formstring .. "Maximum stack size: "..data.def.stack_max.. "\n"
+ formstring = formstring .. range_factoid(data.itemstring, data.def) .. "\n"
+
+ formstring = formstring .. "\n"
+
+ formstring = formstring .. toolcaps_to_text(data.def.tool_capabilities)
+
+ formstring = formstring .. "\n"
+
local yesno = function(bool)
if bool==true then return "Yes"
elseif bool==false then return "No"
@@ -515,9 +542,7 @@ doc.new_category("tools", {
else return "N/A" end
end
- local range = 4.0
- if data.def.range ~= nil then range = data.def.range end
- formstring = formstring .. "Range: "..range.."\n"
+ formstring = formstring .. range_factoid(data.itemstring, data.def) .. "\n"
formstring = formstring .. "\n"
@@ -576,9 +601,7 @@ doc.new_category("craftitems", {
else return "N/A" end
end
- local range = 4.0
- if data.def.range ~= nil then range = data.def.range end
- formstring = formstring .. "Range: "..range.."\n"
+ formstring = formstring .. range_factoid(data.itemstring, data.def) .. "\n"
formstring = formstring .. "\n"