Implement description coloring according to rarity group in autogroups
This commit is contained in:
parent
f4f68a1caa
commit
796cf0291f
@ -79,6 +79,15 @@ local groups_mtg2mcl = {
|
|||||||
["snappy"] = { group = "swordy", hardness = 0.2 },
|
["snappy"] = { group = "swordy", hardness = 0.2 },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local C = core.colorize
|
||||||
|
|
||||||
|
-- maps rarity group rating to their colors; 1=uncommen, 2=rare, 3=epic
|
||||||
|
local rarity_colors = {
|
||||||
|
mcl_colors.YELLOW,
|
||||||
|
mcl_colors.AQUA,
|
||||||
|
mcl_colors.DARK_PURPLE,
|
||||||
|
}
|
||||||
|
|
||||||
-- Get new groups and hardness
|
-- Get new groups and hardness
|
||||||
local function convert_mtg_groups(nname)
|
local function convert_mtg_groups(nname)
|
||||||
local groups = table.copy(minetest.registered_nodes[nname].groups)
|
local groups = table.copy(minetest.registered_nodes[nname].groups)
|
||||||
@ -404,6 +413,14 @@ local function overwrite()
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local rarity_group = core.get_item_group(tname, "rarity")
|
||||||
|
if rarity_group > 0 and rarity_colors[rarity_group] then
|
||||||
|
local desc = tdef.description or tname
|
||||||
|
core.override_item(tname, {
|
||||||
|
description = C(rarity_colors[rarity_group], desc)
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
if tdef._mcl_burntime and tdef._mcl_burntime > 0 then
|
if tdef._mcl_burntime and tdef._mcl_burntime > 0 then
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user