Show meta descriptions in crafting guide
This commit is contained in:
parent
eed43032bc
commit
3f6aa287d9
21
init.lua
21
init.lua
|
@ -1308,7 +1308,7 @@ local function get_tooltip(item, info)
|
|||
tooltip = S("Any item belonging to the groups: @1", groupstr)
|
||||
end
|
||||
else
|
||||
tooltip = get_desc(item)
|
||||
tooltip = info.meta_desc or get_desc(item)
|
||||
end
|
||||
|
||||
local function add(str)
|
||||
|
@ -1400,8 +1400,8 @@ local function get_output_fs(fs, data, rcp, is_recipe, shapeless, right, btn_siz
|
|||
if rcp.type == "fuel" then
|
||||
fs("animated_image", X + 0.05, Y, ITEM_BTN_SIZE, ITEM_BTN_SIZE, PNG.fire_anim, 8, 180)
|
||||
else
|
||||
local item = rcp.output
|
||||
item = ItemStack(clean_name(item))
|
||||
local item = ItemStack(rcp.output)
|
||||
local meta = item:get_meta()
|
||||
local name = item:get_name()
|
||||
local count = item:get_count()
|
||||
local bt_s = ITEM_BTN_SIZE * 1.2
|
||||
|
@ -1421,6 +1421,10 @@ local function get_output_fs(fs, data, rcp, is_recipe, shapeless, right, btn_siz
|
|||
local weird = name ~= "" and desc and weird_desc(desc) or nil
|
||||
local burntime = fuel_cache[name] and fuel_cache[name].burntime
|
||||
|
||||
local short_desc = meta:get_string("short_description")
|
||||
local long_desc = meta:get_string("description")
|
||||
local meta_desc = (short_desc ~= "" and short_desc) or (long_desc ~= "" and long_desc)
|
||||
|
||||
local infos = {
|
||||
unknown = unknown,
|
||||
weird = weird,
|
||||
|
@ -1428,6 +1432,7 @@ local function get_output_fs(fs, data, rcp, is_recipe, shapeless, right, btn_siz
|
|||
repair = repairable(name),
|
||||
rarity = rcp.rarity,
|
||||
tools = rcp.tools,
|
||||
meta_desc = meta_desc,
|
||||
}
|
||||
|
||||
if next(infos) then
|
||||
|
@ -1457,8 +1462,8 @@ local function get_grid_fs(fs, data, rcp, is_recipe)
|
|||
end
|
||||
|
||||
for i = 1, width * rows do
|
||||
local item = rcp.items[i] or ""
|
||||
item = clean_name(item)
|
||||
local _item = rcp.items[i] or ""
|
||||
local item = clean_name(_item)
|
||||
local name = match(item, "%S*")
|
||||
|
||||
local X = ceil((i - 1) % width - width)
|
||||
|
@ -1530,6 +1535,11 @@ local function get_grid_fs(fs, data, rcp, is_recipe)
|
|||
local weird = name ~= "" and desc and weird_desc(desc) or nil
|
||||
local burntime = fuel_cache[name] and fuel_cache[name].burntime
|
||||
|
||||
local meta = ItemStack(_item):get_meta()
|
||||
local short_desc = meta:get_string("short_description")
|
||||
local long_desc = meta:get_string("description")
|
||||
local meta_desc = (short_desc ~= "" and short_desc) or (long_desc ~= "" and long_desc)
|
||||
|
||||
local infos = {
|
||||
unknown = unknown,
|
||||
weird = weird,
|
||||
|
@ -1537,6 +1547,7 @@ local function get_grid_fs(fs, data, rcp, is_recipe)
|
|||
burntime = burntime,
|
||||
cooktime = cooktime,
|
||||
replace = replace,
|
||||
meta_desc = meta_desc,
|
||||
}
|
||||
|
||||
if next(infos) then
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
local mt = ItemStack("default:wood")
|
||||
mt:get_meta():set_string("description", "test wood")
|
||||
mt:get_meta():set_string("color", "#000")
|
||||
|
||||
local mt2 = ItemStack("dye:red")
|
||||
mt2:get_meta():set_string("description", "test red")
|
||||
mt2:get_meta():set_string("color", "#ff0")
|
||||
|
||||
minetest.register_craft({
|
||||
output = minetest.itemstring_with_palette("default:wood", 3),
|
||||
output = mt:to_string(),
|
||||
type = "shapeless",
|
||||
recipe = {
|
||||
"default:wood",
|
||||
"dye:red",
|
||||
mt2:to_string(),
|
||||
},
|
||||
})
|
||||
|
||||
i3.register_craft({
|
||||
result = "default:ladder_wood",
|
||||
items = {"default:copper_ingot 7, default:tin_ingot, default:steel_ingot 2"},
|
||||
})
|
||||
|
||||
i3.register_craft({
|
||||
grid = {
|
||||
"X #",
|
||||
|
|
Ŝarĝante…
Reference in New Issue