Disable hiding, add support for overriding images
This commit is contained in:
parent
fc0c681a6e
commit
ecb88e3dc6
34
init.lua
34
init.lua
@ -197,7 +197,11 @@ doc.new_category("nodes", {
|
|||||||
|
|
||||||
local formstring = ""
|
local formstring = ""
|
||||||
if data.itemstring ~= "air" then
|
if data.itemstring ~= "air" then
|
||||||
formstring = formstring .. "item_image[11,0;1,1;"..data.itemstring.."]"
|
if data.image ~= nil then
|
||||||
|
formstring = formstring .. "image[11,0;1,1;"..data.image.."]"
|
||||||
|
else
|
||||||
|
formstring = formstring .. "item_image[11,0;1,1;"..data.itemstring.."]"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
formstring = formstring .. "textarea[0.25,0.5;11,10;;"
|
formstring = formstring .. "textarea[0.25,0.5;11,10;;"
|
||||||
if longdesc ~= nil then
|
if longdesc ~= nil then
|
||||||
@ -569,6 +573,8 @@ doc.new_category("tools", {
|
|||||||
if data.itemstring == "" then
|
if data.itemstring == "" then
|
||||||
formstring = formstring .. "image[11,0;1,1;"..minetest.formspec_escape(minetest.registered_items[""].wield_image).."]"
|
formstring = formstring .. "image[11,0;1,1;"..minetest.formspec_escape(minetest.registered_items[""].wield_image).."]"
|
||||||
-- Other tools
|
-- Other tools
|
||||||
|
elseif data.image ~= nil then
|
||||||
|
formstring = formstring .. "image[11,0;1,1;"..data.image.."]"
|
||||||
else
|
else
|
||||||
formstring = formstring .. "item_image[11,0;1,1;"..data.itemstring.."]"
|
formstring = formstring .. "item_image[11,0;1,1;"..data.itemstring.."]"
|
||||||
end
|
end
|
||||||
@ -626,7 +632,11 @@ doc.new_category("craftitems", {
|
|||||||
if data then
|
if data then
|
||||||
local longdesc = data.longdesc
|
local longdesc = data.longdesc
|
||||||
local usagehelp = data.usagehelp
|
local usagehelp = data.usagehelp
|
||||||
local formstring = "item_image[11,0;1,1;"..data.itemstring.."]"
|
if data.image ~= nil then
|
||||||
|
formstring = formstring .. "image[11,0;1,1;"..data.image.."]"
|
||||||
|
else
|
||||||
|
formstring = formstring .. "item_image[11,0;1,1;"..data.itemstring.."]"
|
||||||
|
end
|
||||||
formstring = formstring .. "textarea[0.25,0.5;11,10;;"
|
formstring = formstring .. "textarea[0.25,0.5;11,10;;"
|
||||||
if longdesc ~= nil then
|
if longdesc ~= nil then
|
||||||
formstring = formstring .. "Description: "..minetest.formspec_escape(longdesc).."\n\n"
|
formstring = formstring .. "Description: "..minetest.formspec_escape(longdesc).."\n\n"
|
||||||
@ -673,6 +683,8 @@ doc.new_category("craftitems", {
|
|||||||
doc.sub.items.help = {}
|
doc.sub.items.help = {}
|
||||||
doc.sub.items.help.longdesc = {}
|
doc.sub.items.help.longdesc = {}
|
||||||
doc.sub.items.help.usagehelp = {}
|
doc.sub.items.help.usagehelp = {}
|
||||||
|
doc.sub.items.help.image = {}
|
||||||
|
|
||||||
-- Sets the long description for a table of items
|
-- Sets the long description for a table of items
|
||||||
function doc.sub.items.set_items_longdesc(longdesc_table)
|
function doc.sub.items.set_items_longdesc(longdesc_table)
|
||||||
for k,v in pairs(longdesc_table) do
|
for k,v in pairs(longdesc_table) do
|
||||||
@ -686,6 +698,12 @@ function doc.sub.items.set_items_usagehelp(usagehelp_table)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function doc.sub.items.add_item_image_overrides(image_overrides)
|
||||||
|
for itemstring, new_image in pairs(image_overrides) do
|
||||||
|
doc.sub.items.help.image[itemstring] = new_image
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Register group definition stuff
|
-- Register group definition stuff
|
||||||
-- “Real” group names to replace the rather technical names
|
-- “Real” group names to replace the rather technical names
|
||||||
function doc.sub.items.add_real_group_names(groupnames)
|
function doc.sub.items.add_real_group_names(groupnames)
|
||||||
@ -758,7 +776,7 @@ local function gather_descs()
|
|||||||
|
|
||||||
local add_entries = function(deftable, category_id)
|
local add_entries = function(deftable, category_id)
|
||||||
for id, def in pairs(deftable) do
|
for id, def in pairs(deftable) do
|
||||||
local name, ld, uh
|
local name, ld, uh, im
|
||||||
local forced = false
|
local forced = false
|
||||||
if (forced_items[id] == true or def.groups.in_doc) and def ~= nil then forced = true end
|
if (forced_items[id] == true or def.groups.in_doc) and def ~= nil then forced = true end
|
||||||
if item_name_overrides[id] ~= nil then
|
if item_name_overrides[id] ~= nil then
|
||||||
@ -766,23 +784,25 @@ local function gather_descs()
|
|||||||
else
|
else
|
||||||
name = def.description
|
name = def.description
|
||||||
end
|
end
|
||||||
if not (name == nil or name == "" or def.groups.not_in_doc or forced_items[id] == false) or forced then
|
if not (name == nil or name == "" or def.groups.not_in_doc or def.groups.not_in_creative_inventory or forced_items[id] == false) or forced then
|
||||||
if help.longdesc[id] ~= nil then
|
if help.longdesc[id] ~= nil then
|
||||||
ld = help.longdesc[id]
|
ld = help.longdesc[id]
|
||||||
end
|
end
|
||||||
if help.usagehelp[id] ~= nil then
|
if help.usagehelp[id] ~= nil then
|
||||||
uh = help.usagehelp[id]
|
uh = help.usagehelp[id]
|
||||||
end
|
end
|
||||||
local hide = false
|
if help.image[id] ~= nil then
|
||||||
if def.groups.not_in_creative_inventory ~= nil and not forced then
|
im = help.image[id]
|
||||||
hide = true
|
|
||||||
end
|
end
|
||||||
|
local hide = false
|
||||||
|
local custom_image
|
||||||
local infotable = {
|
local infotable = {
|
||||||
name = name,
|
name = name,
|
||||||
hidden = hide,
|
hidden = hide,
|
||||||
data = {
|
data = {
|
||||||
longdesc = ld,
|
longdesc = ld,
|
||||||
usagehelp = uh,
|
usagehelp = uh,
|
||||||
|
image = im,
|
||||||
itemstring = id,
|
itemstring = id,
|
||||||
def = def,
|
def = def,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user