Show meta descriptions in crafting guide
This commit is contained in:
parent
eed43032bc
commit
3f6aa287d9
47
init.lua
47
init.lua
|
@ -1308,7 +1308,7 @@ local function get_tooltip(item, info)
|
||||||
tooltip = S("Any item belonging to the groups: @1", groupstr)
|
tooltip = S("Any item belonging to the groups: @1", groupstr)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
tooltip = get_desc(item)
|
tooltip = info.meta_desc or get_desc(item)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function add(str)
|
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
|
if rcp.type == "fuel" then
|
||||||
fs("animated_image", X + 0.05, Y, ITEM_BTN_SIZE, ITEM_BTN_SIZE, PNG.fire_anim, 8, 180)
|
fs("animated_image", X + 0.05, Y, ITEM_BTN_SIZE, ITEM_BTN_SIZE, PNG.fire_anim, 8, 180)
|
||||||
else
|
else
|
||||||
local item = rcp.output
|
local item = ItemStack(rcp.output)
|
||||||
item = ItemStack(clean_name(item))
|
local meta = item:get_meta()
|
||||||
local name = item:get_name()
|
local name = item:get_name()
|
||||||
local count = item:get_count()
|
local count = item:get_count()
|
||||||
local bt_s = ITEM_BTN_SIZE * 1.2
|
local bt_s = ITEM_BTN_SIZE * 1.2
|
||||||
|
@ -1421,13 +1421,18 @@ 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 weird = name ~= "" and desc and weird_desc(desc) or nil
|
||||||
local burntime = fuel_cache[name] and fuel_cache[name].burntime
|
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 = {
|
local infos = {
|
||||||
unknown = unknown,
|
unknown = unknown,
|
||||||
weird = weird,
|
weird = weird,
|
||||||
burntime = burntime,
|
burntime = burntime,
|
||||||
repair = repairable(name),
|
repair = repairable(name),
|
||||||
rarity = rcp.rarity,
|
rarity = rcp.rarity,
|
||||||
tools = rcp.tools,
|
tools = rcp.tools,
|
||||||
|
meta_desc = meta_desc,
|
||||||
}
|
}
|
||||||
|
|
||||||
if next(infos) then
|
if next(infos) then
|
||||||
|
@ -1457,8 +1462,8 @@ local function get_grid_fs(fs, data, rcp, is_recipe)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = 1, width * rows do
|
for i = 1, width * rows do
|
||||||
local item = rcp.items[i] or ""
|
local _item = rcp.items[i] or ""
|
||||||
item = clean_name(item)
|
local item = clean_name(_item)
|
||||||
local name = match(item, "%S*")
|
local name = match(item, "%S*")
|
||||||
|
|
||||||
local X = ceil((i - 1) % width - width)
|
local X = ceil((i - 1) % width - width)
|
||||||
|
@ -1525,18 +1530,24 @@ local function get_grid_fs(fs, data, rcp, is_recipe)
|
||||||
|
|
||||||
local def = reg_items[name]
|
local def = reg_items[name]
|
||||||
local unknown = not def or nil
|
local unknown = not def or nil
|
||||||
unknown = not groups and unknown or nil
|
unknown = not groups and unknown or nil
|
||||||
local desc = def and def.description
|
local desc = def and def.description
|
||||||
local weird = name ~= "" and desc and weird_desc(desc) or nil
|
local weird = name ~= "" and desc and weird_desc(desc) or nil
|
||||||
local burntime = fuel_cache[name] and fuel_cache[name].burntime
|
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 = {
|
local infos = {
|
||||||
unknown = unknown,
|
unknown = unknown,
|
||||||
weird = weird,
|
weird = weird,
|
||||||
groups = groups,
|
groups = groups,
|
||||||
burntime = burntime,
|
burntime = burntime,
|
||||||
cooktime = cooktime,
|
cooktime = cooktime,
|
||||||
replace = replace,
|
replace = replace,
|
||||||
|
meta_desc = meta_desc,
|
||||||
}
|
}
|
||||||
|
|
||||||
if next(infos) then
|
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({
|
minetest.register_craft({
|
||||||
output = minetest.itemstring_with_palette("default:wood", 3),
|
output = mt:to_string(),
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
recipe = {
|
recipe = {
|
||||||
"default:wood",
|
"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({
|
i3.register_craft({
|
||||||
grid = {
|
grid = {
|
||||||
"X #",
|
"X #",
|
||||||
|
|
Ŝarĝante…
Reference in New Issue