forked from VoxeLibre/VoxeLibre
add basic tooltip to colored armor
This commit is contained in:
parent
d9fef2966f
commit
459f142fc5
|
@ -82,8 +82,21 @@ mcl_armor.register_set({
|
|||
feet = "mcl_armor_inv_boots_leather.png",
|
||||
},
|
||||
repair_material = "mcl_mobitems:leather",
|
||||
groups = {armor_leather_colored = 1},
|
||||
})
|
||||
|
||||
tt.register_priority_snippet(function(_, _, itemstack)
|
||||
if not itemstack or not itemstack:get_definition().groups.armor_leather_colored == 1 then
|
||||
return
|
||||
end
|
||||
local color = itemstack:get_meta():get_string("color")
|
||||
if color and color ~= "" then
|
||||
local text = "Color: "..color
|
||||
return text, false
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
-- This command is only temporary
|
||||
|
||||
minetest.register_chatcommand("color_leather", {
|
||||
|
@ -94,6 +107,7 @@ minetest.register_chatcommand("color_leather", {
|
|||
if player then
|
||||
local item = player:get_wielded_item()
|
||||
item:get_meta():set_string("color", param)
|
||||
tt.reload_itemstack_description(item)
|
||||
player:set_wielded_item(item)
|
||||
return true, "Done."
|
||||
else
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name = mcl_armor
|
||||
author = stu
|
||||
description = Adds craftable armor that is visible to other players.
|
||||
depends = mcl_core, mcl_player, mcl_enchanting, mcl_damage
|
||||
depends = mcl_core, mcl_player, mcl_enchanting, mcl_damage, tt
|
||||
optional_depends = mcl_fire, ethereal, bakedclay
|
||||
|
|
Loading…
Reference in New Issue